57#ifndef BSL_FRONTEND_CRYPTO_INTERFACE_H_
58#define BSL_FRONTEND_CRYPTO_INTERFACE_H_
69#define BSL_CRYPTO_AESGCM_AUTH_TAG_LEN (16)
87} BSL_CryptoCipherSHAVariant_e;
93} BSL_CryptoCipherAESVariant_e;
202 const void *init_vec,
int iv_len,
BSL_Data_t content_enc_key);
270int BSL_Crypto_GenKey(uint8_t *key_buffer,
size_t key_length);
Single entry-point include file for all of the BPSec Lib (BSL) frontend API.
Single entry-point include file for all of the "Public" BPSec Lib (BSL) frontend API.
#define BSL_REQUIRE_CHECK
This annotation on a function requires the caller to capture and inspect the return value.
int BSL_AuthCtx_Finalize(BSL_AuthCtx_t *hmac_ctx, void **hmac, size_t *hmac_len)
Finalize HMAC tag.
int BSL_Crypto_GenIV(void *buf, int size)
Generate initialization vector (IV) for AES-GCM for BCBs.
int BSL_AuthCtx_DigestSeq(BSL_AuthCtx_t *hmac_ctx, BSL_SeqReader_t *reader)
Input data to HMAC sign to context.
int BSL_Crypto_AddRegistryKey(uint64_t keyid, const uint8_t *secret, size_t secret_len)
Add a new key to the crypto key registry.
int BSL_Cipher_AddData(BSL_Cipher_t *cipher_ctx, BSL_Data_t plaintext, BSL_Data_t ciphertext)
int BSL_AuthCtx_Deinit(BSL_AuthCtx_t *hmac_ctx)
Deinitialize HMAC context resources.
int BSLB_Crypto_GetRegistryKey(uint64_t keyid, const uint8_t **secret, size_t *secret_len)
Get pointers to an existing key, if present.
BSL_REQUIRE_CHECK int BSL_AuthCtx_DigestBuffer(BSL_AuthCtx_t *hmac_ctx, const void *data, size_t data_len)
Input data to HMAC sign to context.
int BSL_Cipher_Init(BSL_Cipher_t *cipher_ctx, BSL_CipherMode_e enc, BSL_CryptoCipherAESVariant_e aes_var, const void *init_vec, int iv_len, BSL_Data_t content_enc_key)
Initialize crypto context resources and set as encoding or decoding.
BSL_CipherMode_e
Enum def to define cipher contexts as encryption or decryption operations.
@ BSL_CRYPTO_ENCRYPT
We use undefined for zero, in case this value is never explicitly set and is just zero by default.
int BSL_Crypto_WrapKey(BSL_Data_t *wrapped_key, BSL_Data_t cek, size_t content_key_id, size_t aes_variant)
void BSL_CryptoInit(void)
Initialize the crypto subsystem.
int BSL_Cipher_Deinit(BSL_Cipher_t *cipher_ctx)
De-initialize crypto context resources.
struct BSL_AuthCtx_s BSL_AuthCtx_t
Struct def for HMAC operation context.
int BSL_Cipher_FinalizeSeq(BSL_Cipher_t *cipher_ctx, BSL_SeqWriter_t *writer)
Finalize crypto operation.
int BSL_Cipher_AddAAD(BSL_Cipher_t *cipher_ctx, const void *aad, int aad_len)
Add additional authenticated data (AAD) to cipher context.
BSL_REQUIRE_CHECK int BSL_AuthCtx_Init(BSL_AuthCtx_t *hmac_ctx, uint64_t keyid, BSL_CryptoCipherSHAVariant_e sha_var)
Initialize HMAC context resources and set private key and SHA variant.
int BSL_Crypto_UnwrapKey(BSL_Data_t *unwrapped_key_output, BSL_Data_t wrapped_key_plaintext, size_t key_id, size_t aes_variant)
void BSL_CryptoDeinit(void)
Deinitialize the crypto subsystem.
int BSL_Cipher_SetTag(BSL_Cipher_t *cipher_ctx, const void *tag)
Set the tag of the crypto operation.
int BSL_Cipher_GetTag(BSL_Cipher_t *cipher_ctx, void **tag)
Get the tag of the crypto operation.
int BSL_Cipher_AddSeq(BSL_Cipher_t *cipher_ctx, BSL_SeqReader_t *reader, BSL_SeqWriter_t *writer)
Add data to encrypt or decrypt to the context sequentially.
struct BSL_Cipher_s BSL_Cipher_t
Struct def for cipher operation context.
Struct def for HMAC operation context.
size_t block_size
Block size used by backend.
void * libhandle
pointer to library specific data
BSL_CryptoCipherSHAVariant_e SHA_variant
SHA variant of context.
Struct def for cipher operation context.
BSL_CipherMode_e enc
indicates if operation is encryption or decryption
BSL_CryptoCipherAESVariant_e AES_variant
AES variant of context.
size_t block_size
block size of cipher context
void * libhandle
pointer to library specific data
Heap data storage and views.
Definition of a simple flat buffer iterator.
Definition of a simple flat buffer iterator.