Skip to content

Commit 2c0dea9

Browse files
committed
Addressed reviewer's comment
1 parent acf2858 commit 2c0dea9

4 files changed

Lines changed: 202 additions & 399 deletions

File tree

tests/testdata.h

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,115 @@ static const int sizeof_dh_2048_exp = sizeof(dh_2048_exp);
422422
#endif
423423

424424
#ifndef NO_AES
425+
static const unsigned char aes_gcm_key[16] = {
426+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
427+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
428+
};
429+
static const unsigned char aes_gcm_iv[12] = {
430+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
431+
0x00, 0x00, 0x00, 0x00
432+
};
433+
static const unsigned char aes_gcm_plain[16] = {
434+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
435+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
436+
};
437+
static const unsigned char aes_gcm_aad[0] = { };
438+
static const unsigned char aes_gcm_cipher[16] = {
439+
0x03, 0x88, 0xDA, 0xCE, 0x60, 0xB6, 0xA3, 0x92,
440+
0xF3, 0x28, 0xC2, 0xB9, 0x71, 0xB2, 0xFE, 0x78
441+
};
442+
static const unsigned char aes_gcm_tag[16] = {
443+
0xAB, 0x6E, 0x47, 0xD4, 0x2C, 0xEC, 0x13, 0xBD,
444+
0xF5, 0x3A, 0x67, 0xB2, 0x12, 0x57, 0xBD, 0xDF
445+
};
446+
447+
static const unsigned char aes_cbc_key[16] = {
448+
0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
449+
0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
450+
};
451+
static const unsigned char aes_cbc_iv[16] = {
452+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
453+
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
454+
};
455+
static const unsigned char aes_cbc_plain[16] = {
456+
0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
457+
0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A
458+
};
459+
static const unsigned char aes_cbc_cipher[16] = {
460+
0x76, 0x49, 0xAB, 0xAC, 0x81, 0x19, 0xB2, 0x46,
461+
0xCE, 0xE9, 0x8E, 0x9B, 0x12, 0xE9, 0x19, 0x7D
462+
};
463+
464+
static const unsigned char aes_cbc256_key[32] = {
465+
0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE,
466+
0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81,
467+
0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7,
468+
0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4
469+
};
470+
static const unsigned char aes_cbc256_iv[16] = {
471+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
472+
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
473+
};
474+
static const unsigned char aes_cbc256_cipher[16] = {
475+
0xF5, 0x8C, 0x4C, 0x04, 0xD6, 0xE5, 0xF1, 0xBA,
476+
0x77, 0x9E, 0xAB, 0xFB, 0x5F, 0x7B, 0xFB, 0xD6
477+
};
478+
479+
static const unsigned char aes_ctr_key[16] = {
480+
0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
481+
0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
482+
};
483+
static const unsigned char aes_ctr_iv[16] = {
484+
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
485+
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
486+
};
487+
static const unsigned char aes_ctr_plain[16] = {
488+
0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
489+
0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A
490+
};
491+
static const unsigned char aes_ctr_cipher[16] = {
492+
0x87, 0x4D, 0x61, 0x91, 0xB6, 0x20, 0xE3, 0x26,
493+
0x1B, 0xEF, 0x68, 0x64, 0x99, 0x0D, 0xB6, 0xCE
494+
};
495+
496+
static const unsigned char aes_ctr256_key[32] = {
497+
0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE,
498+
0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81,
499+
0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7,
500+
0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4
501+
};
502+
static const unsigned char aes_ctr256_iv[16] = {
503+
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
504+
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
505+
};
506+
static const unsigned char aes_ctr256_cipher[16] = {
507+
0x60, 0x1E, 0xC3, 0x13, 0x77, 0x57, 0x89, 0xA5,
508+
0xB7, 0xA7, 0xF5, 0x04, 0xBB, 0xF3, 0xD2, 0x28
509+
};
510+
511+
static const unsigned char aes_xts_key[32] = {
512+
0x39, 0x25, 0x79, 0x05, 0xDF, 0xCC, 0x77, 0x76,
513+
0x6C, 0x87, 0x0A, 0x80, 0x6A, 0x60, 0xE3, 0xC0,
514+
0x93, 0xD1, 0x2A, 0xCF, 0xCB, 0x51, 0x42, 0xFA,
515+
0x09, 0x69, 0x89, 0x62, 0x5B, 0x60, 0xDB, 0x16
516+
};
517+
static const unsigned char aes_xts_tweak[16] = {
518+
0x5C, 0xF7, 0x9D, 0xB6, 0xC5, 0xCD, 0x99, 0x1A,
519+
0x1C, 0x78, 0x81, 0x42, 0x24, 0x95, 0x1E, 0x84
520+
};
521+
static const unsigned char aes_xts_plain[32] = {
522+
0xBD, 0xC5, 0x46, 0x8F, 0xBC, 0x8D, 0x50, 0xA1,
523+
0x0D, 0x1C, 0x85, 0x7F, 0x79, 0x1C, 0x5C, 0xBA,
524+
0xB3, 0x81, 0x0D, 0x0D, 0x73, 0xCF, 0x8F, 0x20,
525+
0x46, 0xB1, 0xD1, 0x9E, 0x7D, 0x5D, 0x8A, 0x56
526+
};
527+
static const unsigned char aes_xts_cipher[32] = {
528+
0xD6, 0xBE, 0x04, 0x6D, 0x41, 0xF2, 0x3B, 0x5E,
529+
0xD7, 0x0B, 0x6B, 0x3D, 0x5C, 0x8E, 0x66, 0x23,
530+
0x2B, 0xE6, 0xB8, 0x07, 0xD4, 0xDC, 0xC6, 0x0E,
531+
0xFF, 0x8D, 0xBC, 0x1D, 0x9F, 0x7F, 0xC8, 0x22
532+
};
533+
425534
static unsigned char aes_128_key[] = {
426535
0xf7, 0x88, 0x9e, 0x9a, 0x5f, 0xe2, 0xaa, 0xca,
427536
0xba, 0x14, 0x8a, 0xd3, 0xd1, 0x2d, 0x39, 0xe0,
@@ -472,6 +581,61 @@ static unsigned char aes_128_cts_exp[] = {
472581
#endif
473582
#endif
474583

584+
static const unsigned char hmac_key[20] = {
585+
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
586+
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
587+
0x0B, 0x0B, 0x0B, 0x0B
588+
};
589+
static const unsigned char hmac_msg[] = {
590+
'H', 'i', ' ', 'T', 'h', 'e', 'r', 'e'
591+
};
592+
static const unsigned char hmac_digest[32] = {
593+
0xB0, 0x34, 0x4C, 0x61, 0xD8, 0xDB, 0x38, 0x53,
594+
0x5C, 0xA8, 0xAF, 0xCE, 0xAF, 0x0B, 0xF1, 0x2B,
595+
0x88, 0x1D, 0xC2, 0x00, 0xC9, 0x83, 0x3D, 0xA7,
596+
0x26, 0xE9, 0x37, 0x6C, 0x2E, 0x32, 0xCF, 0xF7
597+
};
598+
599+
static const unsigned char sha_test_msg[] = { 'a', 'b', 'c' };
600+
static const unsigned char sha224_expected[] = {
601+
0x23, 0x09, 0x7D, 0x22, 0x34, 0x05, 0xD8, 0x22,
602+
0x86, 0x42, 0xA4, 0x77, 0xBD, 0xA2, 0x55, 0xB3,
603+
0x2A, 0xAD, 0xBC, 0xE4, 0xBD, 0xA0, 0xB3, 0xF7,
604+
0xE3, 0x6C, 0x9D, 0xA7
605+
};
606+
static const unsigned char sha256_expected[] = {
607+
0xBA, 0x78, 0x16, 0xBF, 0x8F, 0x01, 0xCF, 0xEA,
608+
0x41, 0x41, 0x40, 0xDE, 0x5D, 0xAE, 0x22, 0x23,
609+
0xB0, 0x03, 0x61, 0xA3, 0x96, 0x17, 0x7A, 0x9C,
610+
0xB4, 0x10, 0xFF, 0x61, 0xF2, 0x00, 0x15, 0xAD
611+
};
612+
static const unsigned char sha384_expected[] = {
613+
0xCB, 0x00, 0x75, 0x3F, 0x45, 0xA3, 0x5E, 0x8B,
614+
0xB5, 0xA0, 0x3D, 0x69, 0x9A, 0xC6, 0x50, 0x07,
615+
0x27, 0x2C, 0x32, 0xAB, 0x0E, 0xDE, 0xD1, 0x63,
616+
0x1A, 0x8B, 0x60, 0x5A, 0x43, 0xFF, 0x5B, 0xED,
617+
0x80, 0x86, 0x07, 0x2B, 0xA1, 0xE7, 0xCC, 0x23,
618+
0x58, 0xBA, 0xEC, 0xA1, 0x34, 0xC8, 0x25, 0xA7
619+
};
620+
static const unsigned char sha512_expected[] = {
621+
0xDD, 0xAF, 0x35, 0xA1, 0x93, 0x61, 0x7A, 0xBA,
622+
0xCC, 0x41, 0x73, 0x49, 0xAE, 0x20, 0x41, 0x31,
623+
0x12, 0xE6, 0xFA, 0x4E, 0x89, 0xA9, 0x7E, 0xA2,
624+
0x0A, 0x9E, 0xEE, 0xE6, 0x4B, 0x55, 0xD3, 0x9A,
625+
0x21, 0x92, 0x99, 0x2A, 0x27, 0x4F, 0xC1, 0xA8,
626+
0x36, 0xBA, 0x3C, 0x23, 0xA3, 0xFE, 0xEB, 0xBD,
627+
0x45, 0x4D, 0x44, 0x23, 0x64, 0x3C, 0xE8, 0x0E,
628+
0x2A, 0x9A, 0xC9, 0x4F, 0xA5, 0x4C, 0xA4, 0x9F
629+
};
630+
#ifdef WOLFSSL_SHA3
631+
static const unsigned char sha3_256_expected[] = {
632+
0x3A, 0x98, 0x5D, 0xA7, 0x4F, 0xE2, 0x25, 0xB2,
633+
0x04, 0x5C, 0x17, 0x2D, 0x6B, 0xD3, 0x90, 0xBD,
634+
0x85, 0x5F, 0x08, 0x6E, 0x3E, 0x9D, 0x52, 0x5B,
635+
0x46, 0xBF, 0xE2, 0x45, 0x11, 0x43, 0x15, 0x32
636+
};
637+
#endif /* WOLFSSL_SHA3 */
638+
475639

476640
#ifndef WOLFPKCS11_NO_ENV
477641
#include <stdio.h>

tests/wolfssl-interoperability/pkcs11_interop.c

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,39 @@
4646

4747
#include <wolfpkcs11/pkcs11.h>
4848

49-
#include "test_vectors.h"
49+
#include "tests/testdata.h"
50+
51+
#ifndef HAVE_ECC
52+
#define HAVE_ECC
53+
#define INTEROP_DEFINED_ECC 1
54+
#endif
55+
#include <wolfssl/certs_test.h>
56+
#ifdef INTEROP_DEFINED_ECC
57+
#undef HAVE_ECC
58+
#undef INTEROP_DEFINED_ECC
59+
#endif
60+
61+
#define rsa_2048_priv_der client_key_der_2048
62+
#define rsa_2048_priv_der_len sizeof_client_key_der_2048
63+
#define rsa_2048_pub_der client_keypub_der_2048
64+
#define rsa_2048_pub_der_len sizeof_client_keypub_der_2048
65+
66+
#ifdef USE_CERT_BUFFERS_3072
67+
#define rsa_3072_priv_der client_key_der_3072
68+
#define rsa_3072_priv_der_len sizeof_client_key_der_3072
69+
#define rsa_3072_pub_der client_keypub_der_3072
70+
#define rsa_3072_pub_der_len sizeof_client_keypub_der_3072
71+
#endif
72+
73+
#ifdef USE_CERT_BUFFERS_4096
74+
#define rsa_4096_priv_der client_key_der_4096
75+
#define rsa_4096_priv_der_len sizeof_client_key_der_4096
76+
#define rsa_4096_pub_der client_keypub_der_4096
77+
#define rsa_4096_pub_der_len sizeof_client_keypub_der_4096
78+
#endif
79+
80+
#define ecc384_priv_der ca_ecc_key_der_384
81+
#define ecc384_priv_der_len sizeof_ca_ecc_key_der_384
5082

5183
#ifndef ARRAY_SIZE
5284
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

0 commit comments

Comments
 (0)