KMAC (Keccak Message Authentication Code) More...
Go to the source code of this file.
Data Structures | |
struct | KmacContext |
KMAC algorithm context. More... | |
Macros | |
#define | KMAC_PRIVATE_CONTEXT |
Functions | |
error_t | kmacCompute (uint_t strength, const void *key, size_t keyLen, const void *data, size_t dataLen, const char_t *custom, size_t customLen, uint8_t *mac, size_t macLen) |
Compute KMAC message authentication code. More... | |
error_t | kmacInit (KmacContext *context, uint_t strength, const void *key, size_t keyLen, const char_t *custom, size_t customLen) |
Initialize KMAC calculation. More... | |
void | kmacUpdate (KmacContext *context, const void *data, size_t dataLen) |
Update the KMAC context with a portion of the message being hashed. More... | |
error_t | kmacFinal (KmacContext *context, uint8_t *mac, size_t macLen) |
Finish the KMAC calculation. More... | |
void | kmacDeinit (KmacContext *context) |
Release KMAC context. More... | |
void | kmacRightEncode (size_t value, uint8_t *buffer, size_t *length) |
Encode integer as byte string. More... | |
Variables | |
const uint8_t | kmac128Oid [9] |
const uint8_t | kmac256Oid [9] |
Detailed Description
KMAC (Keccak Message Authentication Code)
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneCRYPTO Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file kmac.h.
Macro Definition Documentation
◆ KMAC_PRIVATE_CONTEXT
Function Documentation
◆ kmacCompute()
error_t kmacCompute | ( | uint_t | strength, |
const void * | key, | ||
size_t | keyLen, | ||
const void * | data, | ||
size_t | dataLen, | ||
const char_t * | custom, | ||
size_t | customLen, | ||
uint8_t * | mac, | ||
size_t | macLen | ||
) |
Compute KMAC message authentication code.
- Parameters
-
[in] strength Number of bits of security (128 for KMAC128 and 256 for KMAC256) [in] key Pointer to the secret key (K) [in] keyLen Length of the secret key [in] data Pointer to the input message (X) [in] dataLen Length of the input data [in] custom Customization string (S) [in] customLen Length of the customization string [out] mac Calculated MAC value [in] macLen Expected length of the MAC (L)
- Returns
- Error code
◆ kmacDeinit()
void kmacDeinit | ( | KmacContext * | context | ) |
◆ kmacFinal()
error_t kmacFinal | ( | KmacContext * | context, |
uint8_t * | mac, | ||
size_t | macLen | ||
) |
◆ kmacInit()
error_t kmacInit | ( | KmacContext * | context, |
uint_t | strength, | ||
const void * | key, | ||
size_t | keyLen, | ||
const char_t * | custom, | ||
size_t | customLen | ||
) |
Initialize KMAC calculation.
- Parameters
-
[in] context Pointer to the KMAC context to initialize [in] strength Number of bits of security (128 for KMAC128 and 256 for KMAC256) [in] key Pointer to the secret key (K) [in] keyLen Length of the secret key [in] custom Customization string (S) [in] customLen Length of the customization string
- Returns
- Error code
◆ kmacRightEncode()
void kmacRightEncode | ( | size_t | value, |
uint8_t * | buffer, | ||
size_t * | length | ||
) |
◆ kmacUpdate()
void kmacUpdate | ( | KmacContext * | context, |
const void * | data, | ||
size_t | dataLen | ||
) |