mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-24 21:46:50 +00:00
Reduce stack usage for AES OFB tests
Reduced the size of allocated buffers to the minimum for OFB tests.
This commit is contained in:
parent
968646c079
commit
e416bf93d2
|
@ -294,24 +294,29 @@ void aes_encrypt_ofb( int fragment_size, char *hex_key_string,
|
||||||
char *hex_iv_string, char *hex_src_string,
|
char *hex_iv_string, char *hex_src_string,
|
||||||
char *hex_dst_string )
|
char *hex_dst_string )
|
||||||
{
|
{
|
||||||
unsigned char key_str[100];
|
unsigned char key_str[32];
|
||||||
unsigned char iv_str[100];
|
unsigned char iv_str[16];
|
||||||
unsigned char src_str[200];
|
unsigned char src_str[64];
|
||||||
unsigned char dst_str[200];
|
unsigned char dst_str[64];
|
||||||
unsigned char output[200];
|
unsigned char output[32];
|
||||||
mbedtls_aes_context ctx;
|
mbedtls_aes_context ctx;
|
||||||
size_t iv_offset = 0;
|
size_t iv_offset = 0;
|
||||||
int in_buffer_len;
|
int in_buffer_len;
|
||||||
unsigned char* src_str_next;
|
unsigned char* src_str_next;
|
||||||
int key_len;
|
int key_len;
|
||||||
|
|
||||||
memset(key_str, 0x00, 100);
|
memset(key_str, 0x00, 32);
|
||||||
memset(iv_str, 0x00, 100);
|
memset(iv_str, 0x00, 16);
|
||||||
memset(src_str, 0x00, 200);
|
memset(src_str, 0x00, 64);
|
||||||
memset(dst_str, 0x00, 200);
|
memset(dst_str, 0x00, 64);
|
||||||
memset(output, 0x00, 200);
|
memset(output, 0x00, 32);
|
||||||
mbedtls_aes_init( &ctx );
|
mbedtls_aes_init( &ctx );
|
||||||
|
|
||||||
|
TEST_ASSERT( strlen( hex_key_string ) <= ( 32 * 2 ) );
|
||||||
|
TEST_ASSERT( strlen( hex_iv_string ) <= ( 16 * 2 ) );
|
||||||
|
TEST_ASSERT( strlen( hex_src_string ) <= ( 64 * 2 ) );
|
||||||
|
TEST_ASSERT( strlen( hex_dst_string ) <= ( 64 * 2 ) );
|
||||||
|
|
||||||
key_len = unhexify( key_str, hex_key_string );
|
key_len = unhexify( key_str, hex_key_string );
|
||||||
unhexify( iv_str, hex_iv_string );
|
unhexify( iv_str, hex_iv_string );
|
||||||
in_buffer_len = unhexify( src_str, hex_src_string );
|
in_buffer_len = unhexify( src_str, hex_src_string );
|
||||||
|
|
Loading…
Reference in a new issue