|
|
|
|
@@ -10,9 +10,9 @@
|
|
|
|
|
// //
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#define AESBlockEncryptor_DEFAULT_CLASS (&br_aes_ct64_cbcenc_vtable)
|
|
|
|
|
#define AESBlockDecryptor_DEFAULT_CLASS (&br_aes_ct64_cbcdec_vtable)
|
|
|
|
|
#define AESStream_DEFAULT_CLASS (&br_aes_ct64_ctr_vtable)
|
|
|
|
|
#define AESBlockEncryptor_DEFAULT_CLASS (&br_aes_big_cbcenc_vtable)
|
|
|
|
|
#define AESBlockDecryptor_DEFAULT_CLASS (&br_aes_big_cbcdec_vtable)
|
|
|
|
|
#define AESStream_DEFAULT_CLASS (&br_aes_big_ctr_vtable)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: use PKS#7 instead of this garbage
|
|
|
|
|
@@ -30,7 +30,7 @@ typedef struct EncryptedBlockHeader {
|
|
|
|
|
|
|
|
|
|
typedef struct AESBlockEncryptor {
|
|
|
|
|
const br_block_cbcenc_class* enc_class;
|
|
|
|
|
u8 enc_keys[sizeof(br_aes_ct64_cbcenc_keys)];
|
|
|
|
|
u8 enc_keys[sizeof(br_aes_big_cbcenc_keys)];
|
|
|
|
|
u8 buf[__AES_BUFFER_SIZE];
|
|
|
|
|
u8 iv[__AES_BLOCK_IV_SIZE];
|
|
|
|
|
br_hmac_drbg_context rng_ctx;
|
|
|
|
|
@@ -54,7 +54,7 @@ Result(u32) AESBlockEncryptor_encrypt(AESBlockEncryptor* ptr, Array(u8) src, Arr
|
|
|
|
|
|
|
|
|
|
typedef struct AESBlockDecryptor {
|
|
|
|
|
const br_block_cbcdec_class* dec_class;
|
|
|
|
|
u8 dec_keys[sizeof(br_aes_ct64_cbcdec_keys)];
|
|
|
|
|
u8 dec_keys[sizeof(br_aes_big_cbcdec_keys)];
|
|
|
|
|
u8 buf[__AES_BUFFER_SIZE];
|
|
|
|
|
u8 iv[__AES_BLOCK_IV_SIZE];
|
|
|
|
|
} AESBlockDecryptor;
|
|
|
|
|
@@ -77,7 +77,7 @@ Result(u32) AESBlockDecryptor_decrypt(AESBlockDecryptor* ptr, Array(u8) src, Arr
|
|
|
|
|
|
|
|
|
|
typedef struct AESStreamEncryptor {
|
|
|
|
|
const br_block_ctr_class* ctr_class;
|
|
|
|
|
u8 ctr_keys[sizeof(br_aes_ct64_ctr_keys)];
|
|
|
|
|
u8 ctr_keys[sizeof(br_aes_big_ctr_keys)];
|
|
|
|
|
u8 buf[__AES_BUFFER_SIZE];
|
|
|
|
|
u8 iv[__AES_STREAM_IV_SIZE];
|
|
|
|
|
u32 block_counter;
|
|
|
|
|
@@ -102,7 +102,7 @@ Result(u32) AESStreamEncryptor_encrypt(AESStreamEncryptor* ptr, Array(u8) src, A
|
|
|
|
|
|
|
|
|
|
typedef struct AESStreamDecryptor {
|
|
|
|
|
const br_block_ctr_class* ctr_class;
|
|
|
|
|
u8 ctr_keys[sizeof(br_aes_ct64_ctr_keys)];
|
|
|
|
|
u8 ctr_keys[sizeof(br_aes_big_ctr_keys)];
|
|
|
|
|
u8 buf[__AES_BUFFER_SIZE];
|
|
|
|
|
u8 iv[__AES_STREAM_IV_SIZE];
|
|
|
|
|
u32 block_counter;
|
|
|
|
|
|