EVP_MAC-CMAC - The CMAC EVP_MAC implementation
| Use Case | Command | Description |
|---|---|---|
| đ Fetch CMAC algorithm | EVP_MAC_fetch(NULL, "CMAC", NULL) | Obtain the CMAC implementation |
| đ§° Create context | EVP_MAC_CTX_new(mac) | Allocate a new MAC context |
| đ Initialize with key | EVP_MAC_init(ctx, key, key_len, params) | Set key and optional cipher via params |
| đ¨ Feed data | EVP_MAC_update(ctx, data, data_len) | Hash message in chunks |
| â Finalize MAC | EVP_MAC_final(ctx, out, &out_len, out_size) | Produce the authentication tag |
| đ Get MAC size | EVP_MAC_CTX_get_mac_size(ctx) | Retrieve expected tag length |
| âī¸ Set cipher | EVP_MAC_CTX_set_params(ctx, {OSSL_MAC_PARAM_CIPHER, "aes-128-cbc"}) | Choose the underlying cipher |
| âģī¸ Clean up | EVP_MAC_CTX_free(ctx); EVP_MAC_free(mac) | Release resources |
Support for computing CMAC MACs through the EVP_MAC API.
This implementation uses EVP_CIPHER functions to get access to the underlying cipher.
This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():
"CMAC", "provider=default" or "provider=fips"
The general description of these parameters can be found in "PARAMETERS" in EVP_MAC(3).
The following parameter can be set with EVP_MAC_CTX_set_params():
"key" (OSSL_MAC_PARAM_KEY) <octet string>EVP_MAC_init(3)."cipher" (OSSL_MAC_PARAM_CIPHER) <UTF8 string>"properties" (OSSL_MAC_PARAM_PROPERTIES) <UTF8 string>The following parameters can be retrieved with EVP_MAC_CTX_get_params():
"size" (OSSL_MAC_PARAM_SIZE) <unsigned integer>EVP_MAC_CTX_get_mac_size(). The length of the "size" parameter is equal to that of an unsigned int."block-size" (OSSL_MAC_PARAM_SIZE) <unsigned integer>EVP_MAC_CTX_get_block_size().
EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), "PARAMETERS" in EVP_MAC(3),
OSSL_PARAM(3)
Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
Generated by phpman v4.9.29 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-21 00:08 @2600:1f28:365:80b0:d8a5:c3c6:bf94:28c0
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format