summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/cmac
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/cmac')
-rw-r--r--src/lib/libcrypto/cmac/cmac.c17
-rw-r--r--src/lib/libcrypto/cmac/cmac.h3
2 files changed, 2 insertions, 18 deletions
diff --git a/src/lib/libcrypto/cmac/cmac.c b/src/lib/libcrypto/cmac/cmac.c
index 81d6ffc9b5..7ad3434836 100644
--- a/src/lib/libcrypto/cmac/cmac.c
+++ b/src/lib/libcrypto/cmac/cmac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cmac.c,v 1.22 2024/01/30 17:43:39 tb Exp $ */ 1/* $OpenBSD: cmac.c,v 1.23 2024/03/02 09:30:21 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -323,18 +323,3 @@ CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen)
323 return 1; 323 return 1;
324} 324}
325LCRYPTO_ALIAS(CMAC_Final); 325LCRYPTO_ALIAS(CMAC_Final);
326
327int
328CMAC_resume(CMAC_CTX *ctx)
329{
330 if (ctx->nlast_block == -1)
331 return 0;
332 /* The buffer "tbl" containes the last fully encrypted block
333 * which is the last IV (or all zeroes if no last encrypted block).
334 * The last block has not been modified since CMAC_final().
335 * So reinitialising using the last decrypted block will allow
336 * CMAC to continue after calling CMAC_Final().
337 */
338 return EVP_EncryptInit_ex(ctx->cipher_ctx, NULL, NULL, NULL, ctx->tbl);
339}
340LCRYPTO_ALIAS(CMAC_resume);
diff --git a/src/lib/libcrypto/cmac/cmac.h b/src/lib/libcrypto/cmac/cmac.h
index cb6d64b02f..f77dae12b3 100644
--- a/src/lib/libcrypto/cmac/cmac.h
+++ b/src/lib/libcrypto/cmac/cmac.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: cmac.h,v 1.3 2014/06/21 13:42:14 jsing Exp $ */ 1/* $OpenBSD: cmac.h,v 1.4 2024/03/02 09:30:21 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -74,7 +74,6 @@ int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
74 const EVP_CIPHER *cipher, ENGINE *impl); 74 const EVP_CIPHER *cipher, ENGINE *impl);
75int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 75int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen);
76int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 76int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen);
77int CMAC_resume(CMAC_CTX *ctx);
78 77
79#ifdef __cplusplus 78#ifdef __cplusplus
80} 79}