BearSSL
|
Class type for combined CTR and CBC-MAC implementations. More...
Data Fields | |
size_t | context_size |
Size (in bytes) of the context structure appropriate for containing subkeys. More... | |
unsigned | block_size |
Size of individual blocks (in bytes). More... | |
unsigned | log_block_size |
Base-2 logarithm of the size of individual blocks, expressed in bytes. More... | |
void(* | init )(const br_block_ctrcbc_class **ctx, const void *key, size_t key_len) |
Initialisation function. More... | |
void(* | encrypt )(const br_block_ctrcbc_class *const *ctx, void *ctr, void *cbcmac, void *data, size_t len) |
Run the CTR encryption + CBC-MAC. More... | |
void(* | decrypt )(const br_block_ctrcbc_class *const *ctx, void *ctr, void *cbcmac, void *data, size_t len) |
Run the CTR decryption + CBC-MAC. More... | |
void(* | ctr )(const br_block_ctrcbc_class *const *ctx, void *ctr, void *data, size_t len) |
Run the CTR encryption/decryption only. More... | |
void(* | mac )(const br_block_ctrcbc_class *const *ctx, void *cbcmac, const void *data, size_t len) |
Run the CBC-MAC only. More... | |
Class type for combined CTR and CBC-MAC implementations.
A br_block_ctrcbc_class
instance points to the functions implementing a specific block cipher, when used in CTR mode for encrypting or decrypting data, along with CBC-MAC.
unsigned br_block_ctrcbc_class::block_size |
Size of individual blocks (in bytes).
size_t br_block_ctrcbc_class::context_size |
Size (in bytes) of the context structure appropriate for containing subkeys.
void(* br_block_ctrcbc_class::ctr) (const br_block_ctrcbc_class *const *ctx, void *ctr, void *data, size_t len) |
Run the CTR encryption/decryption only.
The ctr
parameter points to the counter; its length shall be equal to the block size. It is updated by this function as decryption proceeds.
The data to decrypt is updated "in place". Its length (len
bytes) MUST be a multiple of the block size.
ctx | context structure (already initialised). |
ctr | counter for CTR encryption (initial and final). |
data | data to decrypt. |
len | data length (in bytes). |
void(* br_block_ctrcbc_class::decrypt) (const br_block_ctrcbc_class *const *ctx, void *ctr, void *cbcmac, void *data, size_t len) |
Run the CTR decryption + CBC-MAC.
The ctr
parameter points to the counter; its length shall be equal to the block size. It is updated by this function as decryption proceeds.
The cbcmac
parameter points to the IV for CBC-MAC. The MAC is computed over the encrypted data (i.e. before CTR decryption). Its length shall be equal to the block size. The computed CBC-MAC value is written over the cbcmac
array.
The data to decrypt is updated "in place". Its length (len
bytes) MUST be a multiple of the block size.
ctx | context structure (already initialised). |
ctr | counter for CTR encryption (initial and final). |
cbcmac | IV and output buffer for CBC-MAC. |
data | data to decrypt. |
len | data length (in bytes). |
void(* br_block_ctrcbc_class::encrypt) (const br_block_ctrcbc_class *const *ctx, void *ctr, void *cbcmac, void *data, size_t len) |
Run the CTR encryption + CBC-MAC.
The ctr
parameter points to the counter; its length shall be equal to the block size. It is updated by this function as encryption proceeds.
The cbcmac
parameter points to the IV for CBC-MAC. The MAC is computed over the encrypted data (output of CTR encryption). Its length shall be equal to the block size. The computed CBC-MAC value is written over the cbcmac
array.
The data to encrypt is updated "in place". Its length (len
bytes) MUST be a multiple of the block size.
ctx | context structure (already initialised). |
ctr | counter for CTR encryption (initial and final). |
cbcmac | IV and output buffer for CBC-MAC. |
data | data to encrypt. |
len | data length (in bytes). |
void(* br_block_ctrcbc_class::init) (const br_block_ctrcbc_class **ctx, const void *key, size_t key_len) |
Initialisation function.
This function sets the vtable
field in the context structure. The key length MUST be one of the key lengths supported by the implementation.
ctx | context structure to initialise. |
key | secret key. |
key_len | key length (in bytes). |
unsigned br_block_ctrcbc_class::log_block_size |
Base-2 logarithm of the size of individual blocks, expressed in bytes.
void(* br_block_ctrcbc_class::mac) (const br_block_ctrcbc_class *const *ctx, void *cbcmac, const void *data, size_t len) |
Run the CBC-MAC only.
The cbcmac
parameter points to the IV for CBC-MAC. The MAC is computed over the encrypted data (i.e. before CTR decryption). Its length shall be equal to the block size. The computed CBC-MAC value is written over the cbcmac
array.
The data is unmodified. Its length (len
bytes) MUST be a multiple of the block size.
ctx | context structure (already initialised). |
cbcmac | IV and output buffer for CBC-MAC. |
data | data to decrypt. |
len | data length (in bytes). |