mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpg: Try hard to use MDC also for sign+symenc.
* g10/encrypt.c (use_mdc): Make it a global func. * g10/sign.c (sign_symencrypt_file): Use that function to decide whether to use an MDC. * tests/openpgp/conventional-mdc.test: Add a simple test case. -- We used --force-mdc in sign+symenc mode (-cs) only with --force-mdc. That broke our assumption from commit 625e292 (GnuPG 2.1.9) that all uses of modern ciphers are using MDC. Reported-by: Ben Kibbey <bjk@luxsci.net> Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
b0627ec259
commit
4584125802
@ -101,8 +101,8 @@ encrypt_seskey (DEK *dek, DEK **seskey, byte *enckey)
|
|||||||
|
|
||||||
|
|
||||||
/* We try very hard to use a MDC */
|
/* We try very hard to use a MDC */
|
||||||
static int
|
int
|
||||||
use_mdc(PK_LIST pk_list,int algo)
|
use_mdc (pk_list_t pk_list,int algo)
|
||||||
{
|
{
|
||||||
/* RFC-2440 don't has MDC */
|
/* RFC-2440 don't has MDC */
|
||||||
if (RFC2440)
|
if (RFC2440)
|
||||||
|
@ -211,6 +211,7 @@ void display_online_help( const char *keyword );
|
|||||||
|
|
||||||
/*-- encode.c --*/
|
/*-- encode.c --*/
|
||||||
int setup_symkey (STRING2KEY **symkey_s2k,DEK **symkey_dek);
|
int setup_symkey (STRING2KEY **symkey_s2k,DEK **symkey_dek);
|
||||||
|
int use_mdc (pk_list_t pk_list,int algo);
|
||||||
int encrypt_symmetric (const char *filename );
|
int encrypt_symmetric (const char *filename );
|
||||||
int encrypt_store (const char *filename );
|
int encrypt_store (const char *filename );
|
||||||
int encrypt_crypt (ctrl_t ctrl, int filefd, const char *filename,
|
int encrypt_crypt (ctrl_t ctrl, int filefd, const char *filename,
|
||||||
|
13
g10/sign.c
13
g10/sign.c
@ -1261,12 +1261,7 @@ sign_symencrypt_file (const char *fname, strlist_t locusr)
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We have no way to tell if the recipient can handle messages
|
cfx.dek->use_mdc = use_mdc (NULL, cfx.dek->algo);
|
||||||
with an MDC, so this defaults to no. Perhaps in a few years,
|
|
||||||
this can be defaulted to yes. Note that like regular
|
|
||||||
encrypting, --force-mdc overrides --disable-mdc. */
|
|
||||||
if(opt.force_mdc)
|
|
||||||
cfx.dek->use_mdc=1;
|
|
||||||
|
|
||||||
/* now create the outfile */
|
/* now create the outfile */
|
||||||
rc = open_outfile (-1, fname, opt.armor? 1:0, 0, &out);
|
rc = open_outfile (-1, fname, opt.armor? 1:0, 0, &out);
|
||||||
@ -1309,7 +1304,11 @@ sign_symencrypt_file (const char *fname, strlist_t locusr)
|
|||||||
|
|
||||||
/* Push the compress filter */
|
/* Push the compress filter */
|
||||||
if (default_compress_algo())
|
if (default_compress_algo())
|
||||||
push_compress_filter(out,&zfx,default_compress_algo());
|
{
|
||||||
|
if (cfx.dek && cfx.dek->use_mdc)
|
||||||
|
zfx.new_ctb = 1;
|
||||||
|
push_compress_filter (out, &zfx,default_compress_algo() );
|
||||||
|
}
|
||||||
|
|
||||||
/* Write the one-pass signature packets */
|
/* Write the one-pass signature packets */
|
||||||
/*(current filters: zip - encrypt - armor)*/
|
/*(current filters: zip - encrypt - armor)*/
|
||||||
|
@ -31,5 +31,14 @@ for ciph in `all_cipher_algos`; do
|
|||||||
cmp z y || error "$ciph/$i: mismatch"
|
cmp z y || error "$ciph/$i: mismatch"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
progress_end
|
progress_end
|
||||||
|
|
||||||
|
#info Checking sign+symencrypt
|
||||||
|
for i in $plain_files $data_files; do
|
||||||
|
echo "Hier spricht HAL" | $GPG --passphrase-fd 0 $s2k -cs -o x --yes $i
|
||||||
|
echo "Hier spricht HAL" | $GPG --passphrase-fd 0 $s2k -o y --yes x
|
||||||
|
cmp $i y || error "$i: mismatch in sign+symenc"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# eof
|
||||||
|
Loading…
x
Reference in New Issue
Block a user