|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
Byte-oriented native SHA3-256, SHA3-512, SHAKE128 and SHAKE256 operations.
See SharkSslKeccak.h for lifecycle, rate selection and output limits. For its role in ML-KEM and ML-DSA, see Post-quantum cryptography.
Files | |
| file | SharkSslKeccak.h |
| Byte-oriented SHA-3 and SHAKE sponge interface. | |
Data Structures | |
| struct | SharkSslKeccak |
| Caller-owned sponge storage; treat all members as implementation details. More... | |
Typedefs | |
| typedef struct SharkSslKeccak | SharkSslKeccak |
| Caller-owned sponge storage; treat all members as implementation details. More... | |
Enumerations | |
| enum | { SHARKSSL_KECCAK_RATE_SHAKE128 = 168 , SHARKSSL_KECCAK_RATE_SHAKE256 = 136 , SHARKSSL_KECCAK_RATE_SHA3_256 = 136 , SHARKSSL_KECCAK_RATE_SHA3_512 = 72 , SHARKSSL_KECCAK_SUFFIX_SHA3 = 0x06 , SHARKSSL_KECCAK_SUFFIX_SHAKE = 0x1f } |
| Rate and domain-separation constants for the supported sponge algorithms. More... | |
Functions | |
| void | SharkSslKeccak_init (SharkSslKeccak *o, unsigned rate) |
| Initialize or reset a FIPS 202 sponge for the selected algorithm. More... | |
| void | SharkSslKeccak_absorb (SharkSslKeccak *o, const uint8_t *data, size_t len) |
| Append message bytes before finalization. More... | |
| void | SharkSslKeccak_finalize (SharkSslKeccak *o, uint8_t suffix) |
| Apply padding and switch from message input to output. More... | |
| void | SharkSslKeccak_squeeze (SharkSslKeccak *o, uint8_t *out, size_t len) |
| Read output bytes, continuing where the preceding call stopped. More... | |
| void | SharkSslKeccak_clear (SharkSslKeccak *o) |
| Erase the complete context and leave it inactive. More... | |
| typedef struct SharkSslKeccak SharkSslKeccak |
Caller-owned sponge storage; treat all members as implementation details.
| anonymous enum |
Rate and domain-separation constants for the supported sponge algorithms.
| void SharkSslKeccak_absorb | ( | SharkSslKeccak * | o, |
| const uint8_t * | data, | ||
| size_t | len | ||
| ) |
Append message bytes before finalization.
Calls on an inactive or finalized context do nothing.
| o | SharkSslKeccak *; required initialized context. |
| data | const uint8_t *; borrowed input, not overlapping o; NULL only if len is 0. |
| len | size_t; input length in bytes; 0 is allowed. |
| void SharkSslKeccak_clear | ( | SharkSslKeccak * | o | ) |
Erase the complete context and leave it inactive.
May be called at any phase, including on an already cleared context.
| o | SharkSslKeccak *; required writable context. |
| void SharkSslKeccak_finalize | ( | SharkSslKeccak * | o, |
| uint8_t | suffix | ||
| ) |
Apply padding and switch from message input to output.
Repeated finalization, an inactive context, or an unsupported suffix does nothing.
| o | SharkSslKeccak *; required initialized context. |
| suffix | uint8_t; SHARKSSL_KECCAK_SUFFIX_SHA3 for SHA-3, or SHARKSSL_KECCAK_SUFFIX_SHAKE for SHAKE. Must match the selected algorithm. |
| void SharkSslKeccak_init | ( | SharkSslKeccak * | o, |
| unsigned | rate | ||
| ) |
Initialize or reset a FIPS 202 sponge for the selected algorithm.
Clears any previous state. An unsupported rate leaves the object inactive.
| o | SharkSslKeccak *; required writable context; no prior initialization needed. |
| rate | unsigned; rate in bytes: SHARKSSL_KECCAK_RATE_SHAKE128, SHARKSSL_KECCAK_RATE_SHAKE256, SHARKSSL_KECCAK_RATE_SHA3_256, or SHARKSSL_KECCAK_RATE_SHA3_512. There is no default. |
| void SharkSslKeccak_squeeze | ( | SharkSslKeccak * | o, |
| uint8_t * | out, | ||
| size_t | len | ||
| ) |
Read output bytes, continuing where the preceding call stopped.
Before finalization or on an inactive context, this leaves out untouched. The caller limits total SHA-3 output to its fixed digest size.
| o | SharkSslKeccak *; required initialized and finalized context. |
| out | uint8_t *; caller-owned writable buffer of at least len bytes, not overlapping o; NULL only if len is 0. |
| len | size_t; requested output length in bytes; 0 is allowed. |