From: Andre Noll Date: Fri, 5 Aug 2011 10:53:46 +0000 (+0200) Subject: gcrypt: Return key size in bytes. X-Git-Tag: v0.4.8~21^2 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=c13f9045d75565f517a4e73cade098da7cc46fcc;p=paraslash.git gcrypt: Return key size in bytes. The crypto API requires get_asymmetric_key() to return the size of the RSA key in bytes on success. The return value is evaluated in populate_user_list() where keys which are too short to encrypt a challenge buffer are rejected right away. However, for ASN.1 keys, the gcrypt implementation returned the number of *bits* instead. This caused para_server to accept keys which are in fact not suitable for authentication. The fix is trivial. --- diff --git a/gcrypt.c b/gcrypt.c index 775abd76..b40b7b6e 100644 --- a/gcrypt.c +++ b/gcrypt.c @@ -587,7 +587,7 @@ static int get_asn_public_key(const char *key_file, struct asymmetric_key **resu key = para_malloc(sizeof(*key)); key->sexp = sexp; *result = key; - ret = n_size * 8; + ret = n_size; PARA_INFO_LOG("successfully read %u bit asn public key\n", n_size * 8); release_e: