* keygen.c (ask_key_flags): New. (ask_algo): Call it here in --expert mode
[gnupg.git] / g10 / armor.c
index 2003ce3..6d27472 100644 (file)
@@ -562,7 +562,7 @@ fake_packet( armor_filter_context_t *afx, IOBUF a,
                    ; /* this is okay */
                else {
                    if( type != BEGIN_SIGNATURE ) {
-                       log_info(_("unexpected armor:"));
+                       log_info(_("unexpected armor: "));
                        print_string( stderr, p, n, 0 );
                        putc('\n', stderr);
                    }
@@ -692,7 +692,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
            break;
        }
        else if( (c = asctobin[(c2=c)]) == 255 ) {
-           log_error(_("invalid radix64 character %02x skipped\n"), c2);
+           log_error(_("invalid radix64 character %02X skipped\n"), c2);
            continue;
        }
        switch(idx) {
@@ -771,13 +771,17 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
            if( c == -1 ) {
                log_info(_("premature eof (in CRC)\n"));
                rc = invalid_crc();
-                           }
+           }
+           else if( idx == 0 ) {
+               /* No CRC at all is legal ("MAY") */
+               rc=0;
+           }
            else if( idx != 4 ) {
                log_info(_("malformed CRC\n"));
                rc = invalid_crc();
            }
            else if( mycrc != afx->crc ) {
-                log_info (_("CRC error; %06lx - %06lx\n"),
+                log_info (_("CRC error; %06lX - %06lX\n"),
                                    (ulong)afx->crc, (ulong)mycrc);
                 rc = invalid_crc();
            }
@@ -797,7 +801,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
                if( rc == -1 )
                    rc = 0;
                else if( rc == 2 ) {
-                   log_error(_("premature eof (in Trailer)\n"));
+                   log_error(_("premature eof (in trailer)\n"));
                    rc = G10ERR_INVALID_ARMOR;
                }
                else {
@@ -899,7 +903,7 @@ armor_filter( void *opaque, int control,
                        afx->pgp2mode = 1;
                }
                n=0;
-                /* first a gpg control packet */
+                /* First a gpg control packet... */
                 buf[n++] = 0xff; /* new format, type 63, 1 length byte */
                 n++;   /* see below */
                 memcpy(buf+n, sesmark, sesmarklen ); n+= sesmarklen;
@@ -919,17 +923,16 @@ armor_filter( void *opaque, int control,
                     buf[n++] = DIGEST_ALGO_SHA512;
                 buf[1] = n - 2;
 
-               /* followed by an invented plaintext packet.
+               /* ...followed by an invented plaintext packet.
                   Amusingly enough, this packet is not compliant with
                   2440 as the initial partial length is less than 512
                   bytes.  Of course, we'll accept it anyway ;) */
 
                buf[n++] = 0xCB; /* new packet format, type 11 */
-               buf[n++] = 0xE3; /* 2^3 */
+               buf[n++] = 0xE1; /* 2^1 == 2 bytes */
                buf[n++] = 't';  /* canonical text mode */
-               buf[n++] = 2;    /* namelength */
-               buf[n++] = 'i';  /* padding to get us to 2^3 bytes */
-               buf[n++] = 's';  /* this comment intentionally left blank */
+               buf[n++] = 0;    /* namelength */
+               buf[n++] = 0xE2; /* 2^2 == 4 more bytes */
                memset(buf+n, 0, 4); /* timestamp */
                n += 4;
            }
@@ -1274,7 +1277,7 @@ unarmor_pump (UnarmorPump x, int c)
         {
             int c2;
             if( (c = asctobin[(c2=c)]) == 255 ) {
-                log_error(_("invalid radix64 character %02x skipped\n"), c2);
+                log_error(_("invalid radix64 character %02X skipped\n"), c2);
                 break;
             }
         }
@@ -1311,7 +1314,7 @@ unarmor_pump (UnarmorPump x, int c)
         if( (c = asctobin[c]) == 255 ) {
             rval = -1; /* ready */
             if( x->crc != x->mycrc ) {
-                log_info (_("CRC error; %06lx - %06lx\n"),
+                log_info (_("CRC error; %06lX - %06lX\n"),
                           (ulong)x->crc, (ulong)x->mycrc);
                 if ( invalid_crc() )
                     rval = -3;