]> granicus.if.org Git - openssl/commitdiff
New macro to set mac key.
authorDr. Stephen Henson <steve@openssl.org>
Tue, 10 Feb 2015 18:06:56 +0000 (18:06 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 13 Feb 2015 13:28:50 +0000 (13:28 +0000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/evp/evp.h
crypto/evp/pmeth_gn.c

index 0dbd420103d1eb6bf5b4ec234caa4a42f98f6e32..2e9f83fac74d8a0908b68e1e9cdaf38a645b8200 100644 (file)
@@ -1198,6 +1198,10 @@ void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,
                 EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG,  \
                                         EVP_PKEY_CTRL_GET_MD, 0, (void *)pmd)
 
+# define  EVP_PKEY_CTX_set_mac_key(ctx, key, len)        \
+                EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN,  \
+                                  EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)key)
+
 # define EVP_PKEY_CTRL_MD                1
 # define EVP_PKEY_CTRL_PEER_KEY          2
 
index 46057cfac26200378f7646b25b115d68886e6a87..45559eb4f7ee82d8c6388e25bc8b5d5e616413ee 100644 (file)
@@ -202,9 +202,7 @@ EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,
         return NULL;
     if (EVP_PKEY_keygen_init(mac_ctx) <= 0)
         goto merr;
-    if (EVP_PKEY_CTX_ctrl(mac_ctx, -1, EVP_PKEY_OP_KEYGEN,
-                          EVP_PKEY_CTRL_SET_MAC_KEY,
-                          keylen, (void *)key) <= 0)
+    if (EVP_PKEY_CTX_set_mac_key(mac_ctx, key, keylen) <= 0)
         goto merr;
     if (EVP_PKEY_keygen(mac_ctx, &mac_key) <= 0)
         goto merr;