|
wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
|
FIPS 198-1 HMAC-SHA-256, HMAC-SHA-384 and HMAC-SHA-512. More...
#include "common/bytes/span/span.h"#include "crypto/symmetric/hash/hash/sha256.h"#include "crypto/symmetric/hash/hash/sha384.h"Go to the source code of this file.
Functions | |
| void | hmac_sha256 (wired_span key, wired_span msg, u8 out[SHA256_DIGEST]) |
| Compute HMAC-SHA-256(key, msg). | |
| void | hmac_sha256_truncated (wired_span key, wired_span msg, u8 *out, usz out_len) |
| Compute HMAC-SHA-256(key, msg) truncated to its leftmost out_len bytes (FIPS 198-1 5, "Truncation of HMAC Output": MAC = leftmost Tlen bytes of HMAC(K, text)). | |
| void | hmac_sha384 (wired_span key, wired_span msg, u8 out[SHA384_DIGEST]) |
| Compute HMAC-SHA-384(key, msg) (RFC 2104, FIPS 180-4 SHA-384). | |
| void | hmac_sha512 (wired_span key, wired_span msg, u8 out[SHA512_DIGEST]) |
| Compute HMAC-SHA-512(key, msg) (RFC 2104, FIPS 180-4 SHA-512). | |
FIPS 198-1 HMAC-SHA-256, HMAC-SHA-384 and HMAC-SHA-512.
Outputs are 32-byte, 48-byte and 64-byte MACs respectively.
| void hmac_sha256 | ( | wired_span | key, |
| wired_span | msg, | ||
| u8 | out[SHA256_DIGEST] ) |
Compute HMAC-SHA-256(key, msg).
| key | MAC key (any length; keys longer than one block are hashed) |
| msg | message to authenticate |
| out | receives the 32-byte MAC |
| void hmac_sha256_truncated | ( | wired_span | key, |
| wired_span | msg, | ||
| u8 * | out, | ||
| usz | out_len ) |
Compute HMAC-SHA-256(key, msg) truncated to its leftmost out_len bytes (FIPS 198-1 5, "Truncation of HMAC Output": MAC = leftmost Tlen bytes of HMAC(K, text)).
| key | MAC key (any length; keys longer than one block are hashed) |
| msg | message to authenticate |
| out | receives the truncated MAC |
| out_len | number of leftmost bytes to keep (0..SHA256_DIGEST) |
| void hmac_sha384 | ( | wired_span | key, |
| wired_span | msg, | ||
| u8 | out[SHA384_DIGEST] ) |
Compute HMAC-SHA-384(key, msg) (RFC 2104, FIPS 180-4 SHA-384).
| key | MAC key (any length; keys longer than one block are hashed) |
| msg | message to authenticate |
| out | receives the 48-byte MAC |
| void hmac_sha512 | ( | wired_span | key, |
| wired_span | msg, | ||
| u8 | out[SHA512_DIGEST] ) |
Compute HMAC-SHA-512(key, msg) (RFC 2104, FIPS 180-4 SHA-512).
| key | MAC key (any length; keys longer than one block are hashed) |
| msg | message to authenticate |
| out | receives the 64-byte MAC |