summaryrefslogtreecommitdiffstats
path: root/test.c
diff options
context:
space:
mode:
authorMatteo Brichese <matteo.brichese@wunderbar.com>2017-06-06 22:33:36 +0200
committerMatteo Brichese <matteo.brichese@wunderbar.com>2017-06-06 22:33:36 +0200
commitc1c5fb1974203abf974d6ad359f22dd64b203e45 (patch)
treed9c7994cb0d9c8e04b7c5a362ee9f1dfe8191a29 /test.c
parentEncrypt CBC works (diff)
downloadtiny-AES-c-c1c5fb1974203abf974d6ad359f22dd64b203e45.tar
tiny-AES-c-c1c5fb1974203abf974d6ad359f22dd64b203e45.tar.gz
tiny-AES-c-c1c5fb1974203abf974d6ad359f22dd64b203e45.tar.bz2
tiny-AES-c-c1c5fb1974203abf974d6ad359f22dd64b203e45.tar.lz
tiny-AES-c-c1c5fb1974203abf974d6ad359f22dd64b203e45.tar.xz
tiny-AES-c-c1c5fb1974203abf974d6ad359f22dd64b203e45.tar.zst
tiny-AES-c-c1c5fb1974203abf974d6ad359f22dd64b203e45.zip
Diffstat (limited to 'test.c')
-rw-r--r--test.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/test.c b/test.c
index baf2219..8900e91 100644
--- a/test.c
+++ b/test.c
@@ -20,13 +20,18 @@ static void test_decrypt_cbc(void);
int main(void)
{
+
#ifdef AES128
- printf("\nAES128\n\n");
+ printf("\nTesting AES128\n\n");
#elif defined(AES192)
- printf("\nAES192\n\n");
+ printf("\nTesting AES192\n\n");
#elif defined(AES256)
- printf("\nAES256\n\n");
+ printf("\nTesting AES256\n\n");
+#else
+ printf("You need to specify a symbol between AES128, AES192 or AES256. Exiting");
+ return 0;
#endif
+
test_encrypt_cbc();
test_decrypt_cbc();
test_decrypt_ecb();
@@ -151,12 +156,13 @@ static void test_decrypt_cbc(void)
0x39, 0xf2, 0x33, 0x69, 0xa9, 0xd9, 0xba, 0xcf, 0xa5, 0x30, 0xe2, 0x63, 0x04, 0x23, 0x14, 0x61,
0xb2, 0xeb, 0x05, 0xe2, 0xc3, 0x9b, 0xe9, 0xfc, 0xda, 0x6c, 0x19, 0x07, 0x8c, 0x6a, 0x9d, 0x1b };
#endif
- uint8_t iv[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
+ uint8_t iv[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
uint8_t out[] = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 };
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 };
uint8_t buffer[64];
+ uint8_t buffer2[64];
AES_CBC_decrypt_buffer(buffer, in, 64, key, iv);