From: Nikos Mavrogiannopoulos Date: Thu, 30 Jan 2014 15:37:52 +0000 (+0100) Subject: when importing public keys set the correct algorithm. X-Git-Tag: gnutls_3_3_0pre0~230 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4e9fcfb4fadcb76c3a00193c4c2ae4f405a0da84;p=thirdparty%2Fgnutls.git when importing public keys set the correct algorithm. --- diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c index 7b228eb082..49688571d7 100644 --- a/lib/x509/privkey.c +++ b/lib/x509/privkey.c @@ -130,6 +130,8 @@ _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum_t * raw_key, gnutls_pk_params_init(&pkey->params); + pkey->params.algo = GNUTLS_PK_RSA; + if ((result = asn1_create_element(_gnutls_get_gnutls_asn(), "GNUTLS.RSAPrivateKey", @@ -244,6 +246,8 @@ _gnutls_privkey_decode_ecc_key(ASN1_TYPE* pkey_asn, const gnutls_datum_t * raw_k gnutls_pk_params_init(&pkey->params); + pkey->params.algo = GNUTLS_PK_EC; + if ((ret = asn1_create_element(_gnutls_get_gnutls_asn(), "GNUTLS.ECPrivateKey", @@ -349,7 +353,9 @@ decode_dsa_key(const gnutls_datum_t * raw_key, gnutls_x509_privkey_t pkey) return NULL; } - pkey->params.params_nr = 0; + gnutls_pk_params_init(&pkey->params); + + pkey->params.algo = GNUTLS_PK_DSA; result = asn1_der_decoding(&dsa_asn, raw_key->data, raw_key->size,