diff options
author | kokke <spam@rowdy.dk> | 2014-07-12 02:16:45 +0200 |
---|---|---|
committer | kokke <spam@rowdy.dk> | 2014-07-12 02:16:45 +0200 |
commit | ba3271eaee960b9dcbf94f5e3f4934f1ad2009ab (patch) | |
tree | 70861cfdcbe3608b486ddc49fe3b9cc0ac967a06 /test.c | |
parent | Update aes.c (diff) | |
download | tiny-AES-c-ba3271eaee960b9dcbf94f5e3f4934f1ad2009ab.tar tiny-AES-c-ba3271eaee960b9dcbf94f5e3f4934f1ad2009ab.tar.gz tiny-AES-c-ba3271eaee960b9dcbf94f5e3f4934f1ad2009ab.tar.bz2 tiny-AES-c-ba3271eaee960b9dcbf94f5e3f4934f1ad2009ab.tar.lz tiny-AES-c-ba3271eaee960b9dcbf94f5e3f4934f1ad2009ab.tar.xz tiny-AES-c-ba3271eaee960b9dcbf94f5e3f4934f1ad2009ab.tar.zst tiny-AES-c-ba3271eaee960b9dcbf94f5e3f4934f1ad2009ab.zip |
Diffstat (limited to '')
-rw-r--r-- | test.c | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -5,11 +5,13 @@ static void phex(uint8_t* str); static void test_ECB(void); +static void test_decrypt(void); int main(int argc, char** argv) { test_ECB(); + test_decrypt(); return 0; } @@ -54,7 +56,7 @@ static void test_ECB(void) } // prints string as hex -void phex(uint8_t* str) +static void phex(uint8_t* str) { unsigned char i; for(i = 0; i < 16; ++i) @@ -63,3 +65,24 @@ void phex(uint8_t* str) } +static void test_decrypt(void) +{ + uint8_t key[] = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}; + uint8_t in[] = {0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60, 0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97}; + uint8_t out[] = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a}; + uint8_t buffer[16]; + + AES128_ECB_decrypt(in, key, buffer); + + printf("decrypt: "); + + if(0 == strncmp(out, buffer, 16)) + { + printf("SUCCESS!\n"); + } + else + { + printf("FAILURE!\n"); + } +} + |