mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-05 19:35:48 +03:00
Rename MBEDTLS_CIPHER_BLKSIZE_MAX internally
Replace all occurrences of MBEDTLS_CIPHER_BLKSIZE_MAX by the new name with the same semantics MBEDTLS_CMAC_MAX_BLOCK_SIZE, except when defining or testing the old name. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -68,11 +68,11 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
struct mbedtls_cmac_context_t {
|
struct mbedtls_cmac_context_t {
|
||||||
/** The internal state of the CMAC algorithm. */
|
/** The internal state of the CMAC algorithm. */
|
||||||
unsigned char MBEDTLS_PRIVATE(state)[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char MBEDTLS_PRIVATE(state)[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
|
|
||||||
/** Unprocessed data - either data that was not block aligned and is still
|
/** Unprocessed data - either data that was not block aligned and is still
|
||||||
* pending processing, or the final block. */
|
* pending processing, or the final block. */
|
||||||
unsigned char MBEDTLS_PRIVATE(unprocessed_block)[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char MBEDTLS_PRIVATE(unprocessed_block)[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
|
|
||||||
/** The length of data pending processing. */
|
/** The length of data pending processing. */
|
||||||
size_t MBEDTLS_PRIVATE(unprocessed_len);
|
size_t MBEDTLS_PRIVATE(unprocessed_len);
|
||||||
|
@@ -114,7 +114,7 @@ static int cmac_generate_subkeys(mbedtls_cipher_context_t *ctx,
|
|||||||
unsigned char *K1, unsigned char *K2)
|
unsigned char *K1, unsigned char *K2)
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
unsigned char L[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char L[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
size_t olen, block_size;
|
size_t olen, block_size;
|
||||||
|
|
||||||
mbedtls_platform_zeroize(L, sizeof(L));
|
mbedtls_platform_zeroize(L, sizeof(L));
|
||||||
@@ -152,7 +152,7 @@ exit:
|
|||||||
* We can't use the padding option from the cipher layer, as it only works for
|
* We can't use the padding option from the cipher layer, as it only works for
|
||||||
* CBC and we use ECB mode, and anyway we need to XOR K1 or K2 in addition.
|
* CBC and we use ECB mode, and anyway we need to XOR K1 or K2 in addition.
|
||||||
*/
|
*/
|
||||||
static void cmac_pad(unsigned char padded_block[MBEDTLS_CIPHER_BLKSIZE_MAX],
|
static void cmac_pad(unsigned char padded_block[MBEDTLS_CMAC_MAX_BLOCK_SIZE],
|
||||||
size_t padded_block_len,
|
size_t padded_block_len,
|
||||||
const unsigned char *last_block,
|
const unsigned char *last_block,
|
||||||
size_t last_block_len)
|
size_t last_block_len)
|
||||||
@@ -283,9 +283,9 @@ int mbedtls_cipher_cmac_finish(mbedtls_cipher_context_t *ctx,
|
|||||||
{
|
{
|
||||||
mbedtls_cmac_context_t *cmac_ctx;
|
mbedtls_cmac_context_t *cmac_ctx;
|
||||||
unsigned char *state, *last_block;
|
unsigned char *state, *last_block;
|
||||||
unsigned char K1[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char K1[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
unsigned char K2[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char K2[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
unsigned char M_last[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char M_last[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
size_t olen, block_size;
|
size_t olen, block_size;
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ exit:
|
|||||||
mbedtls_platform_zeroize(cmac_ctx->unprocessed_block,
|
mbedtls_platform_zeroize(cmac_ctx->unprocessed_block,
|
||||||
sizeof(cmac_ctx->unprocessed_block));
|
sizeof(cmac_ctx->unprocessed_block));
|
||||||
|
|
||||||
mbedtls_platform_zeroize(state, MBEDTLS_CIPHER_BLKSIZE_MAX);
|
mbedtls_platform_zeroize(state, MBEDTLS_CMAC_MAX_BLOCK_SIZE);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -746,8 +746,8 @@ static int cmac_test_subkeys(int verbose,
|
|||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
mbedtls_cipher_context_t ctx;
|
mbedtls_cipher_context_t ctx;
|
||||||
const mbedtls_cipher_info_t *cipher_info;
|
const mbedtls_cipher_info_t *cipher_info;
|
||||||
unsigned char K1[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char K1[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
unsigned char K2[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char K2[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
|
|
||||||
cipher_info = mbedtls_cipher_info_from_type(cipher_type);
|
cipher_info = mbedtls_cipher_info_from_type(cipher_type);
|
||||||
if (cipher_info == NULL) {
|
if (cipher_info == NULL) {
|
||||||
@@ -841,7 +841,7 @@ static int cmac_test_wth_cipher(int verbose,
|
|||||||
{
|
{
|
||||||
const mbedtls_cipher_info_t *cipher_info;
|
const mbedtls_cipher_info_t *cipher_info;
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
unsigned char output[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char output[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
|
|
||||||
cipher_info = mbedtls_cipher_info_from_type(cipher_type);
|
cipher_info = mbedtls_cipher_info_from_type(cipher_type);
|
||||||
if (cipher_info == NULL) {
|
if (cipher_info == NULL) {
|
||||||
|
@@ -20,9 +20,9 @@ void mbedtls_cmac_null_args()
|
|||||||
{
|
{
|
||||||
mbedtls_cipher_context_t ctx;
|
mbedtls_cipher_context_t ctx;
|
||||||
const mbedtls_cipher_info_t *cipher_info;
|
const mbedtls_cipher_info_t *cipher_info;
|
||||||
unsigned char test_key[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char test_key[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
unsigned char test_data[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char test_data[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
unsigned char test_output[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char test_output[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
|
|
||||||
mbedtls_cipher_init(&ctx);
|
mbedtls_cipher_init(&ctx);
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ void mbedtls_cmac_multiple_blocks(int cipher_type, data_t *key,
|
|||||||
{
|
{
|
||||||
const mbedtls_cipher_info_t *cipher_info;
|
const mbedtls_cipher_info_t *cipher_info;
|
||||||
mbedtls_cipher_context_t ctx;
|
mbedtls_cipher_context_t ctx;
|
||||||
unsigned char output[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char output[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
|
|
||||||
/* Convert the test parameters to binary data */
|
/* Convert the test parameters to binary data */
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ void mbedtls_cmac_multiple_operations_same_key(int cipher_type,
|
|||||||
{
|
{
|
||||||
const mbedtls_cipher_info_t *cipher_info;
|
const mbedtls_cipher_info_t *cipher_info;
|
||||||
mbedtls_cipher_context_t ctx;
|
mbedtls_cipher_context_t ctx;
|
||||||
unsigned char output[MBEDTLS_CIPHER_BLKSIZE_MAX];
|
unsigned char output[MBEDTLS_CMAC_MAX_BLOCK_SIZE];
|
||||||
|
|
||||||
/* Convert the test parameters to binary data */
|
/* Convert the test parameters to binary data */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user