|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
CHACHA20.
Data Structures | |
| struct | SharkSslChaChaCtx |
| CHACHA20. More... | |
Functions | |
| SHARKSSL_API SHARKSSL_CHACHA_API_STATUS | SharkSslChaChaCtx_constructor (SharkSslChaChaCtx *ctx, const U8 *key, U8 keyLen) |
| Initialize. More... | |
| SHARKSSL_API SHARKSSL_CHACHA_API_STATUS | SharkSslChaChaCtx_setIV (SharkSslChaChaCtx *ctx, const U8 IV[12]) |
| Initialize. More... | |
| SHARKSSL_API SHARKSSL_CHACHA_API_STATUS | SharkSslChaChaCtx_crypt (SharkSslChaChaCtx *ctx, const U8 *input, U8 *output, U32 len) |
| Encrypt or decrypt. More... | |
| SHARKSSL_CHACHA_API_STATUS SharkSslChaChaCtx_constructor | ( | SharkSslChaChaCtx * | ctx, |
| const U8 * | key, | ||
| U8 | keyLen | ||
| ) |
Initialize.
Use caller-owned context storage.
| ctx | Uninitialized data of size sizeof(SharkSslChaChaCtx) |
| key | 16- or 32-byte key; the PSA consumer profile requires 32 bytes |
| keyLen | the key length in bytes (32 in the PSA consumer profile) |
The PSA implementation owns an imported key; call its destructor before reusing that storage.
| SHARKSSL_CHACHA_API_STATUS SharkSslChaChaCtx_crypt | ( | SharkSslChaChaCtx * | ctx, |
| const U8 * | input, | ||
| U8 * | output, | ||
| U32 | len | ||
| ) |
Encrypt or decrypt.
This stream cipher alone does not authenticate messages.
Use an authenticated construction when integrity is required.
| ctx | SharkSslChaChaCtx *; required context with its key and IV initialized. |
| input | const U8 *; input bytes, required when len is nonzero. |
| output | U8 *; output buffer of at least len bytes; exact in-place operation is supported. |
| len | U32; byte count. For continuous processing across calls, use multiples of 64 except for the final call: unused bytes from a partial block are discarded. |
| SHARKSSL_CHACHA_API_STATUS SharkSslChaChaCtx_setIV | ( | SharkSslChaChaCtx * | ctx, |
| const U8 | IV[12] | ||
| ) |
Initialize.
Sets a new 12-byte nonce and resets the stream position.
| ctx | Initialized data of size sizeof(SharkSslChaChaCtx) |
| IV | 12-byte initialization vector (per RFC 7905) |
Never reuse a key/nonce pair to encrypt different messages.