From vaptvupt-codec tag v2.65.3. Output is byte-identical to 2.65.0 (same ratio, wire format v1.6 unchanged) but extreme-mode encode is ~1.6-2x faster (Sprint 132 optimal-parser speedup) and the extreme prepass window allocation is capped at wlog=20 = 8 MiB virtual instead of up to 128 MiB (Sprint 133 memory hygiene). Our AVX2 offset-read decoder guard is now UPSTREAM (dropped from the local patch set); the ANS safe-zone 2*SAFEZONE_MAX_RUN reserve is re-applied on top (still not upstream). make check 16/16, KAT 16/16, cross- version roundtrip with 5.1.0 archives verified.
39 lines
1.2 KiB
C
39 lines
1.2 KiB
C
/*
|
|
* AES-256-SIV (RFC 5297) via OpenSSL EVP
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*
|
|
* Provides nonce-misuse-resistant AEAD via SIV mode (S2V + CTR).
|
|
* Uses OpenSSL's audited implementation. Note: SIV uses a 64-byte key
|
|
* (two 32-byte halves) rather than a 32-byte key.
|
|
*/
|
|
#ifndef ZSDK_AES256_SIV_H
|
|
#define ZSDK_AES256_SIV_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#define ZSDK_AES256_SIV_KEYBYTES 64 /* AES-256-SIV uses double key */
|
|
#define ZSDK_AES256_SIV_NONCEBYTES 16 /* Optional, can be variable */
|
|
#define ZSDK_AES256_SIV_TAGBYTES 16
|
|
|
|
void zsdk_aes256_siv_encrypt(uint8_t *out,
|
|
const uint8_t *plaintext, size_t pt_len,
|
|
const uint8_t *aad, size_t aad_len,
|
|
const uint8_t key[64],
|
|
const uint8_t nonce[16]);
|
|
|
|
int zsdk_aes256_siv_decrypt(uint8_t *out,
|
|
const uint8_t *ciphertext, size_t ct_len,
|
|
const uint8_t *aad, size_t aad_len,
|
|
const uint8_t key[64],
|
|
const uint8_t nonce[16]);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|