Skip to content

Commit

Permalink
[Review] Add AES CTS test case
Browse files Browse the repository at this point in the history
Use random plaintext and IV instead of all zeroes.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
  • Loading branch information
jforissier committed Jan 20, 2017
1 parent 6556e95 commit fb99227
Showing 1 changed file with 31 additions and 15 deletions.
46 changes: 31 additions & 15 deletions host/xtest/xtest_4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -2000,13 +2000,29 @@ static const uint8_t ciph_data_aes_cts_vect6_ctx[] = {
0x3b, 0xc1, 0x03, 0xe1, 0xa1, 0x94, 0xbb, 0xd8,
};

/* Test case for https://github.com/OP-TEE/optee_os/issues/1203 */
/*
* Test case for https://github.com/OP-TEE/optee_os/issues/1203
* 80 bytes of data, processed in two steps (32 + 48).
*/

#define ciph_data_aes_cts_issue1203_key ciph_data_aes_cts_vect1_key
#define ciph_data_aes_cts_issue1203_iv ciph_data_aes_cts_vect1_iv

static const uint8_t ciph_data_aes_cts_issue1203_ptx[80] = {
0x00
static const uint8_t ciph_data_aes_cts_issue1203_iv[] = {
0x5b, 0x11, 0x7b, 0xf9, 0x83, 0x6a, 0x01, 0x27,
0x1d, 0x2a, 0xae, 0x0a, 0xd3, 0x27, 0x35, 0x81,
};

static const uint8_t ciph_data_aes_cts_issue1203_ptx[] = {
0x33, 0x2a, 0xf4, 0x8c, 0x18, 0xa1, 0x30, 0x7c,
0xa7, 0x52, 0x76, 0xca, 0xa6, 0x68, 0xad, 0xf6,
0x1e, 0xba, 0xc9, 0x66, 0x66, 0x52, 0x1a, 0xe7,
0x3e, 0xbc, 0xba, 0x60, 0x95, 0x71, 0x04, 0x5e,
0xb4, 0xb7, 0x10, 0xd7, 0x93, 0x6d, 0x5f, 0x9a,
0xb8, 0xbb, 0x6b, 0xb0, 0x6d, 0x47, 0x93, 0x41,
0x29, 0x21, 0xf2, 0x84, 0xf5, 0xb2, 0xf2, 0x6d,
0xbe, 0xe5, 0x8a, 0x2b, 0x58, 0x8d, 0x1b, 0x5e,
0x41, 0x04, 0xba, 0x9e, 0x92, 0xe9, 0x52, 0xb6,
0x8b, 0x1e, 0x36, 0x72, 0x91, 0xe4, 0x56, 0x66,
};

/*
Expand All @@ -2015,17 +2031,17 @@ static const uint8_t ciph_data_aes_cts_issue1203_ptx[80] = {
* format is CS3, the output is the same as plain AES CBC with the last
* two blocks swapped.
*/
static const uint8_t ciph_data_aes_cts_issue1203_ctx[80] = {
0x57, 0x1f, 0x51, 0x08, 0xc5, 0x3f, 0xe9, 0x5a,
0xb5, 0x2d, 0xf7, 0x83, 0xdf, 0x93, 0x3f, 0xa3,
0x30, 0x55, 0xdc, 0x9d, 0x6b, 0x76, 0x24, 0xa5,
0x42, 0x74, 0x8d, 0xe1, 0x97, 0xcb, 0xb6, 0xb1,
0x31, 0x39, 0xb9, 0xaa, 0xfa, 0x30, 0x23, 0x4b,
0xac, 0xc9, 0x2c, 0x7b, 0x72, 0xaa, 0x3a, 0x97,
0x38, 0xe3, 0xcf, 0x38, 0x83, 0xac, 0xd2, 0x6f,
0xb1, 0xf9, 0x1d, 0xec, 0x6f, 0xaa, 0x41, 0xeb,
0x4f, 0xcd, 0xe0, 0x15, 0x7d, 0x79, 0x06, 0x65,
0x7d, 0x8f, 0x4d, 0x1b, 0x06, 0x23, 0xd3, 0xe1,
static const uint8_t ciph_data_aes_cts_issue1203_ctx[] = {
0x6c, 0xfe, 0xef, 0x6a, 0x1c, 0x8f, 0xd3, 0xc3,
0x66, 0xc4, 0xd9, 0x0e, 0xbe, 0x24, 0x17, 0x3f,
0xcd, 0x19, 0xc9, 0xd2, 0x10, 0x3f, 0xcf, 0xdc,
0xe9, 0x05, 0xab, 0xd5, 0x1a, 0x31, 0x41, 0x77,
0x3b, 0xd7, 0x6a, 0x26, 0xae, 0x0d, 0xc9, 0x47,
0x77, 0xd4, 0xa7, 0xd5, 0x73, 0x88, 0x9e, 0xde,
0x72, 0x66, 0xe0, 0xe2, 0x3d, 0x62, 0x91, 0x22,
0xae, 0x11, 0x01, 0x97, 0x22, 0x6a, 0x45, 0xa9,
0xba, 0x56, 0xd2, 0xbc, 0x55, 0x2d, 0x99, 0x4d,
0x3d, 0x22, 0x27, 0x9a, 0xac, 0x66, 0x2f, 0xf5,
};

static const uint8_t ciph_data_des_ecb_nopad_out1[] = {
Expand Down

0 comments on commit fb99227

Please sign in to comment.