mbedtls_cipher_setkey() is only used within mbedTLS.
 
Symbols
loading...
Files
loading...

mbedtls_cipher_setkey() function

This function sets the key to use with the given context.

Syntax

int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx,     const unsigned char *key,     int key_bitlen,     const mbedtls_operation_t operation );
Implemented in cipher.c:209

Arguments

ctx

The generic cipher context. This must be initialized and bound to a cipher information structure.

key

The key to use. This must be a readable buffer of at least \p key_bitlen Bits.

key_bitlen

The key length to use, in Bits.

operation

The operation that the key will be used for: #MBEDTLS_ENCRYPT or #MBEDTLS_DECRYPT.

Return value

\c 0 on success. #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on parameter-verification failure. A cipher-specific error code on failure.

References

LocationReferrerText
cipher.c:209
int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx,
cipher.h:572
int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx,
gcm.c:191mbedtls_gcm_setkey()
if( ( ret = mbedtls_cipher_setkey( &ctx->cipher_ctx, key, keybits,
ssl_tls.c:1048mbedtls_ssl_derive_keys()
if( ( ret = mbedtls_cipher_setkey( &transform->cipher_ctx_enc, key1,
ssl_tls.c:1056mbedtls_ssl_derive_keys()
if( ( ret = mbedtls_cipher_setkey( &transform->cipher_ctx_dec, key2,