Index: include/cipher.h =================================================================== RCS file: /cvs/gnupg/gnupg/include/cipher.h,v retrieving revision 1.53.2.6 diff -u -r1.53.2.6 cipher.h --- include/cipher.h 29 Nov 2004 21:07:43 -0000 1.53.2.6 +++ include/cipher.h 8 Feb 2005 04:12:12 -0000 @@ -76,6 +76,7 @@ int keylen; int algo_info_printed; int use_mdc; + int symmetric; byte key[32]; /* this is the largest used keylen (256 bit) */ } DEK; Index: g10/mainproc.c =================================================================== RCS file: /cvs/gnupg/gnupg/g10/mainproc.c,v retrieving revision 1.112.2.27 diff -u -r1.112.2.27 mainproc.c --- g10/mainproc.c 27 Jun 2004 18:26:49 -0000 1.112.2.27 +++ g10/mainproc.c 8 Feb 2005 04:12:13 -0000 @@ -317,6 +317,8 @@ c->dek = passphrase_to_dek( NULL, 0, algo, &enc->s2k, 0, NULL, NULL ); if(c->dek) { + c->dek->symmetric=1; + /* FIXME: This doesn't work perfectly if a symmetric key comes before a public key in the message - if the user doesn't know the passphrase, then there is a chance Index: g10/encr-data.c =================================================================== RCS file: /cvs/gnupg/gnupg/g10/encr-data.c,v retrieving revision 1.29 diff -u -r1.29 encr-data.c --- g10/encr-data.c 29 Jun 2002 13:46:33 -0000 1.29 +++ g10/encr-data.c 8 Feb 2005 04:12:14 -0000 @@ -120,7 +120,7 @@ cipher_sync( dfx.cipher_hd ); p = temp; /* log_hexdump( "prefix", temp, nprefix+2 ); */ - if( p[nprefix-2] != p[nprefix] || p[nprefix-1] != p[nprefix+1] ) { + if( dek->symmetric && (p[nprefix-2] != p[nprefix] || p[nprefix-1] != p[nprefix+1]) ) { rc = G10ERR_BAD_KEY; goto leave; }