|
|
@@ -1,6 +1,7 @@ |
|
|
|
#include "src/common.h" |
|
|
|
#include "src/pkcs7.h" |
|
|
|
#include "src/enc_modes.h" |
|
|
|
#include "src/base64.h" |
|
|
|
#include <assert.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdlib.h> |
|
|
@@ -76,7 +77,7 @@ TCASE(ecb_encrypt_decrypt_single_block) |
|
|
|
} |
|
|
|
TCASE_E |
|
|
|
|
|
|
|
TCASE(pkcs7_test) |
|
|
|
TCASE(set2_challange9) |
|
|
|
{ |
|
|
|
const uint8_t text1[] = "Text1"; |
|
|
|
uint8_t unpadded[32] = {0}; |
|
|
@@ -103,7 +104,7 @@ TCASE(pkcs7_test) |
|
|
|
} |
|
|
|
TCASE_E |
|
|
|
|
|
|
|
TCASE(cbc_decrypt_test) |
|
|
|
TCASE(set2_challange10) |
|
|
|
{ |
|
|
|
static const uint8_t expected_result[34] = "I'm back and I'm ringin' the bell"; |
|
|
|
CryptoAttribs_t attribs; |
|
|
@@ -370,7 +371,7 @@ Result_t encryption_oracle( const uint8_t* pt, |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
TCASE(encode_oracle_test) |
|
|
|
TCASE(set2_challange11) |
|
|
|
{ |
|
|
|
// let's run it 1000 times |
|
|
|
for(size_t i=0; i<1000; ++i) |
|
|
@@ -459,5 +460,24 @@ TCASE(encrypt_padding_pkcs7) |
|
|
|
::free(attribs_dec.output); |
|
|
|
} |
|
|
|
::free(attribs_enc.output); |
|
|
|
} |
|
|
|
TCASE_E |
|
|
|
|
|
|
|
TCASE(set2_challange12_not_finished) |
|
|
|
{ |
|
|
|
uint8_t CIPHERTEXT[] = "Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg" |
|
|
|
"aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBq" |
|
|
|
"dXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUg" |
|
|
|
"YnkK"; |
|
|
|
|
|
|
|
uint8_t HEX_STRING[sizeof CIPHERTEXT]; |
|
|
|
uint8_t CONCAT_STRING[sizeof(CIPHERTEXT)*2]; |
|
|
|
CryptoAttribs_t EncryptForBS; |
|
|
|
|
|
|
|
Key_t key; |
|
|
|
uint32_t hex_len = 0; |
|
|
|
hex_len = base64_to_hex(CIPHERTEXT, sizeof(CIPHERTEXT), HEX_STRING); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
TCASE_E |