pthreadpool: Fix fork behaviour
[Samba.git] / lib / crypto / aes_test.h
blobad892492dbdaf771256b487c0fad3f3cc89224a8
1 #ifndef LIB_CRYPTO_AES_TEST_H
2 #define LIB_CRYPTO_AES_TEST_H
4 struct aes_mode_testvector {
5 DATA_BLOB K;
6 DATA_BLOB N;
7 DATA_BLOB A;
8 DATA_BLOB P;
9 DATA_BLOB C;
10 DATA_BLOB T;
11 const char *mode;
12 bool aes_cmac_128;
13 bool aes_ccm_128;
14 bool aes_gcm_128;
15 const char *location;
18 #define AES_MODE_TESTVECTOR(_mode, _k, _n, _a, _p, _c, _t) \
19 { \
20 .K = strhex_to_data_blob(tctx, _k), \
21 .N = strhex_to_data_blob(tctx, _n), \
22 .A = strhex_to_data_blob(tctx, _a), \
23 .P = strhex_to_data_blob(tctx, _p), \
24 .C = strhex_to_data_blob(tctx, _c), \
25 .T = strhex_to_data_blob(tctx, _t), \
26 ._mode = true, \
27 .mode = #_mode, \
28 .location = __location__, \
31 #define aes_mode_testvector_debug(tv, P, C, T) \
32 _aes_mode_testvector_debug(tv, P, C, T, __location__)
33 static inline void _aes_mode_testvector_debug(const struct aes_mode_testvector *tv,
34 const DATA_BLOB *P,
35 const DATA_BLOB *C,
36 const DATA_BLOB *T,
37 const char *location)
39 printf("location: %s\n", location);
40 printf("TEST: %s\n", tv->location);
41 printf("MODE: %s\n", tv->mode);
42 printf("K\n");
43 dump_data(0, tv->K.data, tv->K.length);
44 printf("N\n");
45 dump_data(0, tv->N.data, tv->N.length);
46 printf("A\n");
47 dump_data(0, tv->A.data, tv->A.length);
48 printf("P\n");
49 dump_data(0, tv->P.data, tv->P.length);
50 if (P) {
51 printf("PV\n");
52 dump_data(0, P->data, P->length);
54 printf("C\n");
55 dump_data(0, tv->C.data, tv->C.length);
56 if (C) {
57 printf("CV\n");
58 dump_data(0, C->data, C->length);
60 printf("T\n");
61 dump_data(0, tv->T.data, tv->T.length);
62 if (T) {
63 printf("TV\n");
64 dump_data(0, T->data, T->length);
67 #endif /* LIB_CRYPTO_AES_TEST_H */