From: Andre Noll <maan@systemlinux.org>
Date: Wed, 18 Feb 2015 15:40:40 +0000 (+0100)
Subject: gcrypt: Initialize key size of public ASN keys.
X-Git-Tag: v0.5.5~45^2
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=1641ae9fd2ed9bee616396a410c6e5cf65253064;p=paraslash.git

gcrypt: Initialize key size of public ASN keys.

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.
---

diff --git a/gcrypt.c b/gcrypt.c
index b4718ec0..6bb7452c 100644
--- 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);