Counter mode of operation for block ciphers. More...
Counter mode of operation for block ciphers.
Definition in file ctr.h.
#include "crypto/ciphers.h"
Include dependency graph for ctr.h:Go to the source code of this file.
| int | cipher_encrypt_ctr (const cipher_t *cipher, uint8_t nonce_counter[16], uint8_t nonce_len, const uint8_t *input, size_t length, uint8_t *output) |
| Encrypt data of arbitrary length in counter mode. More... | |
| int | cipher_decrypt_ctr (const cipher_t *cipher, uint8_t nonce_counter[16], uint8_t nonce_len, const uint8_t *input, size_t length, uint8_t *output) |
| Decrypt data of arbitrary length in counter mode. More... | |
| int cipher_decrypt_ctr | ( | const cipher_t * | cipher, |
| uint8_t | nonce_counter[16], | ||
| uint8_t | nonce_len, | ||
| const uint8_t * | input, | ||
| size_t | length, | ||
| uint8_t * | output | ||
| ) |
Decrypt data of arbitrary length in counter mode.
Encryption and decryption in ctr mode are basically the same.
| cipher | Already initialized cipher struct |
| nonce_counter | A nounce and a counter encoded in 16 octets. The counter will be modified in each block encryption. |
| nonce_len | Length of the nonce in octets. As nounce and counter have to fit in one aligned 16 octet block, maximum length of nonce is limited by input_len: 16 - log_2(input_len) |
| input | pointer to input data to encrypt |
| length | length of the input data |
| output | pointer to allocated memory for encrypted data. It has to be of size data_len. |
| int cipher_encrypt_ctr | ( | const cipher_t * | cipher, |
| uint8_t | nonce_counter[16], | ||
| uint8_t | nonce_len, | ||
| const uint8_t * | input, | ||
| size_t | length, | ||
| uint8_t * | output | ||
| ) |
Encrypt data of arbitrary length in counter mode.
| cipher | Already initialized cipher struct |
| nonce_counter | A nounce and a counter encoded in 16 octets. The counter will be modified in each block encryption. |
| nonce_len | Length of the nonce in octets. As nounce and counter have to fit in one aligned 16 octet block, maximum length of nonce is limited by input_len: 16 - log_2(input_len) |
| input | pointer to input data to encrypt |
| length | length of the input data |
| output | pointer to allocated memory for encrypted data. It has to be of size data_len. |