gcrypt: Initialize key size of public ASN keys.
authorAndre Noll <maan@systemlinux.org>
Wed, 18 Feb 2015 15:40:40 +0000 (16:40 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 6 Apr 2015 17:10:55 +0000 (17:10 +0000)
This bug could make applications acccept short keys. Not a serious
problem since (a) ASN keys are deprecated in favor of ssh keys and
(b) encrypting a 256 byte buffer fails anyways on short keys. Let's
fix it anyway.

gcrypt.c

index b4718ec0f8c7910dbdbb3c451adeaa790e24e0d2..6bb7452c254f550499945226ab96e4bc44c81c66 100644 (file)
--- a/gcrypt.c
+++ b/gcrypt.c
@@ -583,6 +583,7 @@ static int get_asn_public_key(const char *key_file, struct asymmetric_key **resu
        }
        key = para_malloc(sizeof(*key));
        key->sexp = sexp;
+       key->num_bytes = n_size;
        *result = key;
        ret = n_size;
        PARA_INFO_LOG("successfully read %u bit asn public key\n", n_size * 8);