SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration

Detailed Description

AES.

Data Structures

struct  SharkSslAesCtx
 AES. More...
 

Typedefs

typedef struct SharkSslAesCtx SharkSslAesCtx
 AES. More...
 

Functions

SHARKSSL_API SHARKSSL_AES_API_STATUS SharkSslAesCtx_constructor (SharkSslAesCtx *ctx, SharkSslAesCtx_Type type, const U8 *key, U8 keyLen)
 Initialize. More...
 
SHARKSSL_API SHARKSSL_AES_API_STATUS SharkSslAesCtx_decrypt (SharkSslAesCtx *ctx, const U8 input[16], U8 output[16])
 Decrypt. More...
 
SHARKSSL_API SHARKSSL_AES_API_STATUS SharkSslAesCtx_encrypt (SharkSslAesCtx *ctx, U8 input[16], U8 output[16])
 Encrypt. More...
 
SHARKSSL_API SHARKSSL_AES_API_STATUS SharkSslAesCtx_cbc_encrypt (SharkSslAesCtx *ctx, U8 vect[16], const U8 *input, U8 *output, U32 len)
 Encrypt. More...
 
SHARKSSL_API SHARKSSL_AES_API_STATUS SharkSslAesCtx_cbc_decrypt (SharkSslAesCtx *ctx, U8 vect[16], const U8 *input, U8 *output, U32 len)
 Decrypt. More...
 

Typedef Documentation

◆ SharkSslAesCtx

AES.

Function Documentation

◆ SharkSslAesCtx_cbc_decrypt()

SHARKSSL_AES_API_STATUS SharkSslAesCtx_cbc_decrypt ( SharkSslAesCtx *  ctx,
U8  vect[16],
const U8 *  input,
U8 *  output,
U32  len 
)

Decrypt.

Parameters
ctxSharkSslAesCtx *; required context constructed for decryption.
vectU8[16]; required writable IV, updated to the final ciphertext block for continuation.
inputconst U8 *; input bytes; required when len is nonzero.
outputU8 *; output buffer with at least len bytes; exact in-place operation is supported.
lenU32; byte count, a multiple of 16. This API does not add or remove padding.
Returns
Native build: void, with no return value. With SHARKSSL_PSA_CONSUMER_STANDALONE_AES=1: int, 0 on success and -1 on invalid arguments or provider failure.

◆ SharkSslAesCtx_cbc_encrypt()

SHARKSSL_AES_API_STATUS SharkSslAesCtx_cbc_encrypt ( SharkSslAesCtx *  ctx,
U8  vect[16],
const U8 *  input,
U8 *  output,
U32  len 
)

Encrypt.

Parameters
ctxSharkSslAesCtx *; required context constructed for encryption.
vectU8[16]; required writable IV, updated to the final ciphertext block for continuation.
inputconst U8 *; input bytes; required when len is nonzero.
outputU8 *; output buffer with at least len bytes; exact in-place operation is supported.
lenU32; byte count, a multiple of 16. This API does not add or remove padding.
Returns
Native build: void, with no return value. With SHARKSSL_PSA_CONSUMER_STANDALONE_AES=1: int, 0 on success and -1 on invalid arguments or provider failure.

◆ SharkSslAesCtx_constructor()

SHARKSSL_AES_API_STATUS SharkSslAesCtx_constructor ( SharkSslAesCtx *  ctx,
SharkSslAesCtx_Type  type,
const U8 *  key,
U8  keyLen 
)

Initialize.

The caller owns the context.

Parameters
ctxUninitialized data of size sizeof(SharkSslAesCtx)
typeencrypt/decrypt
keythe encryption/decryption key
keyLen'key' length

The key length is in bytes: 16, 24, or 32, subject to the enabled algorithms/backend. Clear the context with its destructor after use.

Returns
Native build: void, with no return value. With SHARKSSL_PSA_CONSUMER_STANDALONE_AES=1: int, 0 on success and -1 on invalid arguments or provider failure.

◆ SharkSslAesCtx_decrypt()

SHARKSSL_AES_API_STATUS SharkSslAesCtx_decrypt ( SharkSslAesCtx *  ctx,
const U8  input[16],
U8  output[16] 
)

Decrypt.

Parameters
ctxSharkSslAesCtx *; required context constructed for decryption.
inputconst U8[16]; one complete input block.
outputU8[16]; required output block; exact in-place operation is supported.
Returns
Native build: void, with no return value. With SHARKSSL_PSA_CONSUMER_STANDALONE_AES=1: int, 0 on success and -1 on invalid arguments or provider failure.

◆ SharkSslAesCtx_encrypt()

SHARKSSL_AES_API_STATUS SharkSslAesCtx_encrypt ( SharkSslAesCtx *  ctx,
U8  input[16],
U8  output[16] 
)

Encrypt.

Parameters
ctxSharkSslAesCtx *; required context constructed for encryption.
inputU8[16]; one complete input block.
outputU8[16]; required output block; exact in-place operation is supported.
Returns
Native build: void, with no return value. With SHARKSSL_PSA_CONSUMER_STANDALONE_AES=1: int, 0 on success and -1 on invalid arguments or provider failure.