]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
when importing public keys set the correct algorithm.
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 30 Jan 2014 15:37:52 +0000 (16:37 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 30 Jan 2014 15:40:42 +0000 (16:40 +0100)
lib/x509/privkey.c

index 7b228eb082700bfca65eeaa4da007320dcee471f..49688571d77e739fec3919acf38ebc8a6b2f491b 100644 (file)
@@ -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,