summaryrefslogtreecommitdiffstats
path: root/crypto/cmac
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-02-16 22:17:43 +0000
committerDr. Stephen Henson <steve@openssl.org>2016-02-16 22:52:59 +0000
commit866b282d1b288c2738318aac4360eba71b72d10f (patch)
treeff0a59fc6a50484de91be0b0b368ce6103c5819d /crypto/cmac
parent24e6a0dba44a610d4c58239b715569316d473904 (diff)
Switch to FIPS implementation for CMAC.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/cmac')
-rw-r--r--crypto/cmac/cmac.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/cmac/cmac.c b/crypto/cmac/cmac.c
index 774e6dc919..2954b6eb7d 100644
--- a/crypto/cmac/cmac.c
+++ b/crypto/cmac/cmac.c
@@ -160,6 +160,14 @@ int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
EVPerr(EVP_F_CMAC_INIT, EVP_R_DISABLED_FOR_FIPS);
return 0;
}
+
+ /* Switch to FIPS cipher implementation if possible */
+ if (cipher != NULL) {
+ const EVP_CIPHER *fcipher;
+ fcipher = FIPS_get_cipherbynid(EVP_CIPHER_nid(cipher));
+ if (fcipher != NULL)
+ cipher = fcipher;
+ }
/*
* Other algorithm blocking will be done in FIPS_cmac_init, via
* FIPS_cipherinit().