#include "torint.h"
Go to the source code of this file.
Typedefs | |
typedef struct aes_cnt_cipher | aes_cnt_cipher_t |
Functions | |
aes_cnt_cipher_t * | aes_new_cipher (void) |
void | aes_free_cipher (aes_cnt_cipher_t *cipher) |
void | aes_set_key (aes_cnt_cipher_t *cipher, const char *key, int key_bits) |
void | aes_crypt (aes_cnt_cipher_t *cipher, const char *input, size_t len, char *output) |
void | aes_crypt_inplace (aes_cnt_cipher_t *cipher, char *data, size_t len) |
void | aes_set_iv (aes_cnt_cipher_t *cipher, const char *iv) |
void aes_crypt | ( | aes_cnt_cipher_t * | cipher, | |
const char * | input, | |||
size_t | len, | |||
char * | output | |||
) |
Encrypt len bytes from input, storing the result in output. Uses the key in cipher, and advances the counter by len bytes as it encrypts.
References _aes_fill_buf(), aes_cnt_cipher::buf, and aes_cnt_cipher::pos.
Referenced by crypto_cipher_decrypt(), and crypto_cipher_encrypt().
void aes_crypt_inplace | ( | aes_cnt_cipher_t * | cipher, | |
char * | data, | |||
size_t | len | |||
) |
Encrypt len bytes from input, storing the results in place. Uses the key in cipher, and advances the counter by len bytes as it encrypts.
References _aes_fill_buf(), aes_cnt_cipher::buf, and aes_cnt_cipher::pos.
Referenced by crypto_cipher_crypt_inplace().
void aes_free_cipher | ( | aes_cnt_cipher_t * | cipher | ) |
aes_cnt_cipher_t* aes_new_cipher | ( | void | ) |
Return a newly allocated counter-mode AES128 cipher implementation.
Referenced by crypto_new_cipher_env().
void aes_set_iv | ( | aes_cnt_cipher_t * | cipher, | |
const char * | iv | |||
) |
Reset the 128-bit counter of cipher to the 16-bit big-endian value in iv.
References _aes_fill_buf(), aes_cnt_cipher::buf, aes_cnt_cipher::counter0, aes_cnt_cipher::counter1, aes_cnt_cipher::counter2, aes_cnt_cipher::counter3, get_uint32(), and aes_cnt_cipher::pos.
Referenced by crypto_cipher_set_iv().
void aes_set_key | ( | aes_cnt_cipher_t * | cipher, | |
const char * | key, | |||
int | key_bits | |||
) |
Set the key of cipher to key, which is key_bits bits long (must be 128, 192, or 256). Also resets the counter to 0.
References _aes_fill_buf(), aes_cnt_cipher::buf, aes_cnt_cipher::counter0, aes_cnt_cipher::counter1, aes_cnt_cipher::counter2, aes_cnt_cipher::counter3, aes_cnt_cipher::nr, aes_cnt_cipher::pos, rijndaelKeySetupEnc(), aes_cnt_cipher::rk, and tor_assert.
Referenced by crypto_cipher_decrypt_init_cipher(), and crypto_cipher_encrypt_init_cipher().