Backport CMAC support from HEAD.
[openssl.git] / crypto / asn1 / ameth_lib.c
index 18957c669e45abe8831a1f344766549c0f9f3b95..b5854f101a43f1aeccde0ce6f147501d21132e69 100644 (file)
@@ -69,6 +69,7 @@ extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[];
 extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth;
 extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth;
 extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth;
 
 /* Keep this sorted in type order !! */
 static const EVP_PKEY_ASN1_METHOD *standard_methods[] = 
@@ -90,7 +91,8 @@ static const EVP_PKEY_ASN1_METHOD *standard_methods[] =
 #ifndef OPENSSL_NO_EC
        &eckey_asn1_meth,
 #endif
-       &hmac_asn1_meth
+       &hmac_asn1_meth,
+       &cmac_asn1_meth
        };
 
 typedef int sk_cmp_fn_type(const char * const *a, const char * const *b);
@@ -172,7 +174,6 @@ static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)
 const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type)
        {
        const EVP_PKEY_ASN1_METHOD *t;
-       ENGINE *e;
 
        for (;;)
                {
@@ -184,6 +185,7 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type)
        if (pe)
                {
 #ifndef OPENSSL_NO_ENGINE
+               ENGINE *e;
                /* type will contain the final unaliased type */
                e = ENGINE_get_pkey_asn1_meth_engine(type);
                if (e)
@@ -301,6 +303,8 @@ EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags,
                if (!ameth->info)
                        goto err;
                }
+       else
+               ameth->info = NULL;
 
        if (pem_str)
                {
@@ -308,6 +312,8 @@ EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags,
                if (!ameth->pem_str)
                        goto err;
                }
+       else
+               ameth->pem_str = NULL;
 
        ameth->pub_decode = 0;
        ameth->pub_encode = 0;