summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-02-10 18:06:56 +0000
committerDr. Stephen Henson <steve@openssl.org>2015-02-13 13:28:50 +0000
commiteff1a4d24f3f23b48984b7b60d4c343a3a995f38 (patch)
tree3273ab19d9025140ceea56472c91eb1e2282f3d8 /crypto/evp
parent6906a7c1a34d753b783cb38083bf95f417fef684 (diff)
New macro to set mac key.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/evp.h4
-rw-r--r--crypto/evp/pmeth_gn.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
index 0dbd420103..2e9f83fac7 100644
--- a/crypto/evp/evp.h
+++ b/crypto/evp/evp.h
@@ -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
diff --git a/crypto/evp/pmeth_gn.c b/crypto/evp/pmeth_gn.c
index 46057cfac2..45559eb4f7 100644
--- a/crypto/evp/pmeth_gn.c
+++ b/crypto/evp/pmeth_gn.c
@@ -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;