aboutsummaryrefslogtreecommitdiffstats
path: root/g10/pkclist.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-08-13 19:00:23 +0000
committerDavid Shaw <[email protected]>2002-08-13 19:00:23 +0000
commit1111da19a858ba517898dcd34680ea40ee3b3ab9 (patch)
treed4b1153ef1332a05089d91e1ef3b3904ac150f08 /g10/pkclist.c
parent* cipher.h: Add AES aliases for RIJNDAEL algo numbers. (diff)
downloadgnupg-1111da19a858ba517898dcd34680ea40ee3b3ab9.tar.gz
gnupg-1111da19a858ba517898dcd34680ea40ee3b3ab9.zip
* encode.c (encode_simple): Fix problem with using compression algo 2 and
symmetric compressed files. * encode.c (encode_simple, encode_crypt): If we are not using a MDC, compress even if a file is already compressed. This is to help against the chosen ciphertext attack. * pkclist.c (select_algo_from_prefs): Fix requested algorithm bug so the request succeeds even if the requested algorithm is not the first found. * cipher.c (write_header), encode.c (use_mdc, encode_simple, encode_crypt, encrypt_filter), g10.c (main): Be more eager to use a MDC. We use a MDC if the keys directly support it, if the keys list AES (any) or TWOFISH anywhere in the prefs, or if the cipher chosen does not have a 64 bit blocksize.
Diffstat (limited to 'g10/pkclist.c')
-rw-r--r--g10/pkclist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/g10/pkclist.c b/g10/pkclist.c
index 671b56879..cf6eca659 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -1159,6 +1159,11 @@ select_algo_from_prefs(PK_LIST pk_list, int preftype, int request, void *hint)
i = -1;
any = 0;
+ /* Can we use the requested algorithm? */
+ if(request>-1 && (bits[request/32] & (1<<(request%32))) &&
+ algo_available(preftype,request,hint))
+ return request;
+
/* If we have personal prefs set, use them instead of the last key */
if(preftype==PREFTYPE_SYM && opt.personal_cipher_prefs)
prefs=opt.personal_cipher_prefs;
@@ -1190,10 +1195,6 @@ select_algo_from_prefs(PK_LIST pk_list, int preftype, int request, void *hint)
}
}
- /* Can we use the requested algorithm? */
- if(request>-1 && request==i)
- return i;
-
#if 0
log_debug("prefs of type %d: selected %d\n", preftype, i );
#endif