Skip to content

Commit 1a4da1e

Browse files
committed
[#436] WIP: Wycheproof Impl
1 parent 272113f commit 1a4da1e

File tree

6 files changed

+3798
-1
lines changed

6 files changed

+3798
-1
lines changed

Diff for: include/crypto.h

+3
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ extern uint8_t badFECF;
359359
extern uint32_t crc32Table[CRC32TBL_SIZE];
360360
extern uint16_t crc16Table[CRC16TBL_SIZE];
361361

362+
extern wycheproof_json_object test;
363+
extern wycheproof_blk_json_object tests[256];
364+
362365
// GF(2^4) field and logarithm tables
363366
static const uint8_t gf_exp[30] = {1, 2, 4, 8, 3, 6, 12, 11, 5, 10, 7, 14, 15, 13, 9,
364367
1, 2, 4, 8, 3, 6, 12, 11, 5, 10, 7, 14, 15, 13, 9};

Diff for: include/crypto_structs.h

+19
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@ typedef struct
4949
} __attribute__((packed)) crypto_gvcid_t;
5050
#define CRYPTO_GVCID_SIZE (sizeof(crypto_gvcid_t))
5151

52+
typedef struct
53+
{
54+
int tcId;
55+
char *key[64];
56+
char *iv[32];
57+
char *aad[128];
58+
char *msg[256];
59+
char *ct[256];
60+
char *tag[64];
61+
char *result[16];
62+
} wycheproof_json_object;
63+
#define CRYPTO_WYCHEPROOF_SIZE (sizeof(wycheproof_json_object))
64+
65+
typedef struct
66+
{
67+
wycheproof_json_object *blk[256];
68+
} wycheproof_blk_json_object;
69+
#define CRYPTO_WYCHEPROOF_BLK_SIZE (sizeof(wycheproof_blk_json_object))
70+
5271
/*
5372
** Security Association
5473
* https://public.ccsds.org/Pubs/355x0b2.pdf

Diff for: test/CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ add_test(NAME UT_TM_APPLY
5252
add_test(NAME UT_TM_PROCESS
5353
COMMAND ${PROJECT_BINARY_DIR}/bin/ut_tm_process
5454
WORKING_DIRECTORY ${PROJECT_TEST_DIR})
55+
56+
add_test(NAME AES_GCM
57+
COMMAND ${PROJECT_BINARY_DIR}/bin/aes_gcm
58+
WORKING_DIRECTORY ${PROJECT_TEST_DIR})
59+
5560
if(CRYPTO_EPROC)
5661
add_test(NAME UT_EP_MC
5762
COMMAND ${PROJECT_BINARY_DIR}/bin/ut_ep_mc
@@ -130,6 +135,7 @@ endif()
130135

131136
include_directories(include)
132137
include_directories(../include)
138+
include_directories(../include/wycheproof)
133139

134140
# if(TEST_ENC)
135141
# set(Python3_FIND_STRATEGY VERSION)
@@ -140,7 +146,7 @@ include_directories(../include)
140146
# endif()
141147
# endif()
142148

143-
file( GLOB UNIT_FILES unit/*.c)
149+
file( GLOB UNIT_FILES unit/*.c unit/wycheproof/*.c)
144150
foreach(SOURCE_PATH ${UNIT_FILES})
145151
get_filename_component(EXECUTABLE_NAME ${SOURCE_PATH} NAME_WE)
146152

Diff for: test/include/wycheproof/aes_gcm.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef WYCHEPROOF_UT_AES_GCM_H
2+
#define WYCHEPROOF_UT_AES_GCM_H
3+
4+
#ifdef __cplusplus
5+
extern "C"
6+
{
7+
#endif
8+
9+
#include "crypto.h"
10+
#include "shared_util.h"
11+
#include "utest.h"
12+
#include <stdio.h>
13+
14+
#include <stdarg.h>
15+
#include <stddef.h>
16+
#include <stdint.h>
17+
#include <stdlib.h>
18+
#include <string.h>
19+
#include "../../../src/crypto/kmc/jsmn.h"
20+
21+
#ifdef __cplusplus
22+
} /* Close scope of 'extern "C"' declaration which encloses file. */
23+
#endif
24+
25+
#endif // WYCHEPROOF_UT_AES_GCM_H

0 commit comments

Comments
 (0)