|
XenevaOS
|
Lightweight abstraction layer for block ciphers with 128 bit blocks, for use by the GCM and CCM modules. More...


Go to the source code of this file.
Functions | |
| int | mbedtls_block_cipher_setup (mbedtls_block_cipher_context_t *ctx, mbedtls_cipher_id_t cipher_id) |
| Set the block cipher to use with this context. This must be called after mbedtls_block_cipher_init(). | |
| int | mbedtls_block_cipher_setkey (mbedtls_block_cipher_context_t *ctx, const unsigned char *key, unsigned key_bitlen) |
| Set the key into the context. | |
| int | mbedtls_block_cipher_encrypt (mbedtls_block_cipher_context_t *ctx, const unsigned char input[16], unsigned char output[16]) |
| Encrypt one block (16 bytes) with the configured key. | |
| void | mbedtls_block_cipher_free (mbedtls_block_cipher_context_t *ctx) |
| Clear the context. | |
Lightweight abstraction layer for block ciphers with 128 bit blocks, for use by the GCM and CCM modules.
| int mbedtls_block_cipher_encrypt | ( | mbedtls_block_cipher_context_t * | ctx, |
| const unsigned char | input[16], | ||
| unsigned char | output[16] | ||
| ) |
Encrypt one block (16 bytes) with the configured key.
| ctx | The context holding the key. |
| input | The buffer holding the input block. Must be 16 bytes. |
| output | The buffer to which the output block will be written. Must be writable and 16 bytes long. This must either not overlap with input, or be equal. |
c 0 on success.
| MBEDTLS_ERR_CIPHER_INVALID_CONTEXT | if the context was not properly set up before calling this function. |
| Another | negative value if encryption failed. |
| void mbedtls_block_cipher_free | ( | mbedtls_block_cipher_context_t * | ctx | ) |
Clear the context.
| ctx | The context to clear. |
| int mbedtls_block_cipher_setkey | ( | mbedtls_block_cipher_context_t * | ctx, |
| const unsigned char * | key, | ||
| unsigned | key_bitlen | ||
| ) |
Set the key into the context.
| ctx | The context to configure. |
| key | The buffer holding the key material. |
| key_bitlen | The size of the key in bits. |
c 0 on success.
| MBEDTLS_ERR_CIPHER_INVALID_CONTEXT | if the context was not properly set up before calling this function. |
| One | of MBEDTLS_ERR_AES_INVALID_KEY_LENGTH, MBEDTLS_ERR_ARIA_BAD_INPUT_DATA, MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA if key_bitlen is invalid. |
| int mbedtls_block_cipher_setup | ( | mbedtls_block_cipher_context_t * | ctx, |
| mbedtls_cipher_id_t | cipher_id | ||
| ) |
Set the block cipher to use with this context. This must be called after mbedtls_block_cipher_init().
| ctx | The context to set up. |
| cipher_id | The identifier of the cipher to use. This must be either AES, ARIA or Camellia. Warning: this is a mbedtls_cipher_id_t, not a mbedtls_block_cipher_id_t! |
c 0 on success.
| MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA | if cipher_id was invalid. |