mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-02 16:43:03 +01:00
* mdc.c (use_mdc): Simplified.
This commit is contained in:
parent
73b5da4c7d
commit
f9867edfb8
@ -4,6 +4,7 @@
|
|||||||
the warning since all compatibility checks with PGP succeeded.
|
the warning since all compatibility checks with PGP succeeded.
|
||||||
* mainproc.c (symkey_decrypt_sesskey): Better check for the
|
* mainproc.c (symkey_decrypt_sesskey): Better check for the
|
||||||
algorithm and check the return values of some functions.
|
algorithm and check the return values of some functions.
|
||||||
|
* mdc.c (use_mdc): Simplified.
|
||||||
|
|
||||||
2003-08-07 Werner Koch <wk@gnupg.org>
|
2003-08-07 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
29
g10/encode.c
29
g10/encode.c
@ -115,6 +115,14 @@ encode_sesskey (DEK * dek, DEK ** ret_dek, byte * enckey)
|
|||||||
static int
|
static int
|
||||||
use_mdc (PK_LIST pk_list,int algo)
|
use_mdc (PK_LIST pk_list,int algo)
|
||||||
{
|
{
|
||||||
|
byte cipher_algid[4] = {
|
||||||
|
CIPHER_ALGO_AES,
|
||||||
|
CIPHER_ALGO_AES192,
|
||||||
|
CIPHER_ALGO_AES256,
|
||||||
|
CIPHER_ALGO_TWOFISH
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
|
||||||
/* --force-mdc overrides --disable-mdc */
|
/* --force-mdc overrides --disable-mdc */
|
||||||
if (opt.force_mdc)
|
if (opt.force_mdc)
|
||||||
return 1;
|
return 1;
|
||||||
@ -132,25 +140,14 @@ use_mdc(PK_LIST pk_list,int algo)
|
|||||||
can handle a MDC. This is valid for PGP 7, which can handle MDCs
|
can handle a MDC. This is valid for PGP 7, which can handle MDCs
|
||||||
though it will not generate them. 2440bis allows this, by the
|
though it will not generate them. 2440bis allows this, by the
|
||||||
way. */
|
way. */
|
||||||
|
for (i=0; i < DIM (cipher_algid); i++)
|
||||||
if(select_algo_from_prefs(pk_list,PREFTYPE_SYM,
|
{
|
||||||
CIPHER_ALGO_AES,NULL)==CIPHER_ALGO_AES)
|
if (select_algo_from_prefs (pk_list, PREFTYPE_SYM, cipher_algid[i],
|
||||||
return 1;
|
NULL) == cipher_algid[i])
|
||||||
|
|
||||||
if(select_algo_from_prefs(pk_list,PREFTYPE_SYM,
|
|
||||||
CIPHER_ALGO_AES192,NULL)==CIPHER_ALGO_AES192)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if(select_algo_from_prefs(pk_list,PREFTYPE_SYM,
|
|
||||||
CIPHER_ALGO_AES256,NULL)==CIPHER_ALGO_AES256)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if(select_algo_from_prefs(pk_list,PREFTYPE_SYM,
|
|
||||||
CIPHER_ALGO_TWOFISH,NULL)==CIPHER_ALGO_TWOFISH)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Last try. Use MDC for the modern ciphers. */
|
/* Last try. Use MDC for the modern ciphers. */
|
||||||
|
|
||||||
if (gcry_cipher_get_algo_blklen (algo) != 8)
|
if (gcry_cipher_get_algo_blklen (algo) != 8)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user