aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/testmgr.h')
-rw-r--r--crypto/testmgr.h645
1 files changed, 642 insertions, 3 deletions
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 526f00a9c72f..69316228fc19 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -62,6 +62,7 @@ struct aead_testvec {
62 int np; 62 int np;
63 int anp; 63 int anp;
64 unsigned char fail; 64 unsigned char fail;
65 unsigned char novrfy; /* ccm dec verification failure expected */
65 unsigned char wk; /* weak key flag */ 66 unsigned char wk; /* weak key flag */
66 unsigned char klen; 67 unsigned char klen;
67 unsigned short ilen; 68 unsigned short ilen;
@@ -69,6 +70,18 @@ struct aead_testvec {
69 unsigned short rlen; 70 unsigned short rlen;
70}; 71};
71 72
73struct cprng_testvec {
74 char *key;
75 char *dt;
76 char *v;
77 char *result;
78 unsigned char klen;
79 unsigned short dtlen;
80 unsigned short vlen;
81 unsigned short rlen;
82 unsigned short loops;
83};
84
72static char zeroed_string[48]; 85static char zeroed_string[48];
73 86
74/* 87/*
@@ -2841,12 +2854,16 @@ static struct cipher_testvec cast6_dec_tv_template[] = {
2841#define AES_LRW_DEC_TEST_VECTORS 8 2854#define AES_LRW_DEC_TEST_VECTORS 8
2842#define AES_XTS_ENC_TEST_VECTORS 4 2855#define AES_XTS_ENC_TEST_VECTORS 4
2843#define AES_XTS_DEC_TEST_VECTORS 4 2856#define AES_XTS_DEC_TEST_VECTORS 4
2844#define AES_CTR_ENC_TEST_VECTORS 7 2857#define AES_CTR_ENC_TEST_VECTORS 3
2845#define AES_CTR_DEC_TEST_VECTORS 6 2858#define AES_CTR_DEC_TEST_VECTORS 3
2859#define AES_CTR_3686_ENC_TEST_VECTORS 7
2860#define AES_CTR_3686_DEC_TEST_VECTORS 6
2846#define AES_GCM_ENC_TEST_VECTORS 9 2861#define AES_GCM_ENC_TEST_VECTORS 9
2847#define AES_GCM_DEC_TEST_VECTORS 8 2862#define AES_GCM_DEC_TEST_VECTORS 8
2848#define AES_CCM_ENC_TEST_VECTORS 7 2863#define AES_CCM_ENC_TEST_VECTORS 7
2849#define AES_CCM_DEC_TEST_VECTORS 7 2864#define AES_CCM_DEC_TEST_VECTORS 7
2865#define AES_CCM_4309_ENC_TEST_VECTORS 7
2866#define AES_CCM_4309_DEC_TEST_VECTORS 10
2850 2867
2851static struct cipher_testvec aes_enc_tv_template[] = { 2868static struct cipher_testvec aes_enc_tv_template[] = {
2852 { /* From FIPS-197 */ 2869 { /* From FIPS-197 */
@@ -3983,6 +4000,164 @@ static struct cipher_testvec aes_xts_dec_tv_template[] = {
3983 4000
3984 4001
3985static struct cipher_testvec aes_ctr_enc_tv_template[] = { 4002static struct cipher_testvec aes_ctr_enc_tv_template[] = {
4003 { /* From NIST Special Publication 800-38A, Appendix F.5 */
4004 .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
4005 "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
4006 .klen = 16,
4007 .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4008 "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4009 .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4010 "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4011 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4012 "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4013 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4014 "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4015 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4016 "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4017 .ilen = 64,
4018 .result = "\x87\x4d\x61\x91\xb6\x20\xe3\x26"
4019 "\x1b\xef\x68\x64\x99\x0d\xb6\xce"
4020 "\x98\x06\xf6\x6b\x79\x70\xfd\xff"
4021 "\x86\x17\x18\x7b\xb9\xff\xfd\xff"
4022 "\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e"
4023 "\x5b\x4f\x09\x02\x0d\xb0\x3e\xab"
4024 "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1"
4025 "\x79\x21\x70\xa0\xf3\x00\x9c\xee",
4026 .rlen = 64,
4027 }, {
4028 .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
4029 "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
4030 "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
4031 .klen = 24,
4032 .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4033 "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4034 .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4035 "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4036 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4037 "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4038 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4039 "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4040 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4041 "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4042 .ilen = 64,
4043 .result = "\x1a\xbc\x93\x24\x17\x52\x1c\xa2"
4044 "\x4f\x2b\x04\x59\xfe\x7e\x6e\x0b"
4045 "\x09\x03\x39\xec\x0a\xa6\xfa\xef"
4046 "\xd5\xcc\xc2\xc6\xf4\xce\x8e\x94"
4047 "\x1e\x36\xb2\x6b\xd1\xeb\xc6\x70"
4048 "\xd1\xbd\x1d\x66\x56\x20\xab\xf7"
4049 "\x4f\x78\xa7\xf6\xd2\x98\x09\x58"
4050 "\x5a\x97\xda\xec\x58\xc6\xb0\x50",
4051 .rlen = 64,
4052 }, {
4053 .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
4054 "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
4055 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
4056 "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
4057 .klen = 32,
4058 .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4059 "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4060 .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4061 "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4062 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4063 "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4064 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4065 "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4066 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4067 "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4068 .ilen = 64,
4069 .result = "\x60\x1e\xc3\x13\x77\x57\x89\xa5"
4070 "\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28"
4071 "\xf4\x43\xe3\xca\x4d\x62\xb5\x9a"
4072 "\xca\x84\xe9\x90\xca\xca\xf5\xc5"
4073 "\x2b\x09\x30\xda\xa2\x3d\xe9\x4c"
4074 "\xe8\x70\x17\xba\x2d\x84\x98\x8d"
4075 "\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6"
4076 "\x13\xc2\xdd\x08\x45\x79\x41\xa6",
4077 .rlen = 64,
4078 }
4079};
4080
4081static struct cipher_testvec aes_ctr_dec_tv_template[] = {
4082 { /* From NIST Special Publication 800-38A, Appendix F.5 */
4083 .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
4084 "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
4085 .klen = 16,
4086 .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4087 "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4088 .input = "\x87\x4d\x61\x91\xb6\x20\xe3\x26"
4089 "\x1b\xef\x68\x64\x99\x0d\xb6\xce"
4090 "\x98\x06\xf6\x6b\x79\x70\xfd\xff"
4091 "\x86\x17\x18\x7b\xb9\xff\xfd\xff"
4092 "\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e"
4093 "\x5b\x4f\x09\x02\x0d\xb0\x3e\xab"
4094 "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1"
4095 "\x79\x21\x70\xa0\xf3\x00\x9c\xee",
4096 .ilen = 64,
4097 .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4098 "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4099 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4100 "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4101 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4102 "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4103 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4104 "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4105 .rlen = 64,
4106 }, {
4107 .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
4108 "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
4109 "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
4110 .klen = 24,
4111 .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4112 "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4113 .input = "\x1a\xbc\x93\x24\x17\x52\x1c\xa2"
4114 "\x4f\x2b\x04\x59\xfe\x7e\x6e\x0b"
4115 "\x09\x03\x39\xec\x0a\xa6\xfa\xef"
4116 "\xd5\xcc\xc2\xc6\xf4\xce\x8e\x94"
4117 "\x1e\x36\xb2\x6b\xd1\xeb\xc6\x70"
4118 "\xd1\xbd\x1d\x66\x56\x20\xab\xf7"
4119 "\x4f\x78\xa7\xf6\xd2\x98\x09\x58"
4120 "\x5a\x97\xda\xec\x58\xc6\xb0\x50",
4121 .ilen = 64,
4122 .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4123 "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4124 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4125 "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4126 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4127 "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4128 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4129 "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4130 .rlen = 64,
4131 }, {
4132 .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
4133 "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
4134 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
4135 "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
4136 .klen = 32,
4137 .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4138 "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4139 .input = "\x60\x1e\xc3\x13\x77\x57\x89\xa5"
4140 "\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28"
4141 "\xf4\x43\xe3\xca\x4d\x62\xb5\x9a"
4142 "\xca\x84\xe9\x90\xca\xca\xf5\xc5"
4143 "\x2b\x09\x30\xda\xa2\x3d\xe9\x4c"
4144 "\xe8\x70\x17\xba\x2d\x84\x98\x8d"
4145 "\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6"
4146 "\x13\xc2\xdd\x08\x45\x79\x41\xa6",
4147 .ilen = 64,
4148 .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4149 "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4150 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4151 "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4152 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4153 "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4154 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4155 "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4156 .rlen = 64,
4157 }
4158};
4159
4160static struct cipher_testvec aes_ctr_rfc3686_enc_tv_template[] = {
3986 { /* From RFC 3686 */ 4161 { /* From RFC 3686 */
3987 .key = "\xae\x68\x52\xf8\x12\x10\x67\xcc" 4162 .key = "\xae\x68\x52\xf8\x12\x10\x67\xcc"
3988 "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" 4163 "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e"
@@ -5114,7 +5289,7 @@ static struct cipher_testvec aes_ctr_enc_tv_template[] = {
5114 }, 5289 },
5115}; 5290};
5116 5291
5117static struct cipher_testvec aes_ctr_dec_tv_template[] = { 5292static struct cipher_testvec aes_ctr_rfc3686_dec_tv_template[] = {
5118 { /* From RFC 3686 */ 5293 { /* From RFC 3686 */
5119 .key = "\xae\x68\x52\xf8\x12\x10\x67\xcc" 5294 .key = "\xae\x68\x52\xf8\x12\x10\x67\xcc"
5120 "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" 5295 "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e"
@@ -5825,6 +6000,470 @@ static struct aead_testvec aes_ccm_dec_tv_template[] = {
5825 }, 6000 },
5826}; 6001};
5827 6002
6003/*
6004 * rfc4309 refers to section 8 of rfc3610 for test vectors, but they all
6005 * use a 13-byte nonce, we only support an 11-byte nonce. Similarly, all of
6006 * Special Publication 800-38C's test vectors also use nonce lengths our
6007 * implementation doesn't support. The following are taken from fips cavs
6008 * fax files on hand at Red Hat.
6009 *
6010 * nb: actual key lengths are (klen - 3), the last 3 bytes are actually
6011 * part of the nonce which combine w/the iv, but need to be input this way.
6012 */
6013static struct aead_testvec aes_ccm_rfc4309_enc_tv_template[] = {
6014 {
6015 .key = "\x83\xac\x54\x66\xc2\xeb\xe5\x05"
6016 "\x2e\x01\xd1\xfc\x5d\x82\x66\x2e"
6017 "\x96\xac\x59",
6018 .klen = 19,
6019 .iv = "\x30\x07\xa1\xe2\xa2\xc7\x55\x24",
6020 .alen = 0,
6021 .input = "\x19\xc8\x81\xf6\xe9\x86\xff\x93"
6022 "\x0b\x78\x67\xe5\xbb\xb7\xfc\x6e"
6023 "\x83\x77\xb3\xa6\x0c\x8c\x9f\x9c"
6024 "\x35\x2e\xad\xe0\x62\xf9\x91\xa1",
6025 .ilen = 32,
6026 .result = "\xab\x6f\xe1\x69\x1d\x19\x99\xa8"
6027 "\x92\xa0\xc4\x6f\x7e\xe2\x8b\xb1"
6028 "\x70\xbb\x8c\xa6\x4c\x6e\x97\x8a"
6029 "\x57\x2b\xbe\x5d\x98\xa6\xb1\x32"
6030 "\xda\x24\xea\xd9\xa1\x39\x98\xfd"
6031 "\xa4\xbe\xd9\xf2\x1a\x6d\x22\xa8",
6032 .rlen = 48,
6033 }, {
6034 .key = "\x1e\x2c\x7e\x01\x41\x9a\xef\xc0"
6035 "\x0d\x58\x96\x6e\x5c\xa2\x4b\xd3"
6036 "\x4f\xa3\x19",
6037 .klen = 19,
6038 .iv = "\xd3\x01\x5a\xd8\x30\x60\x15\x56",
6039 .assoc = "\xda\xe6\x28\x9c\x45\x2d\xfd\x63"
6040 "\x5e\xda\x4c\xb6\xe6\xfc\xf9\xb7"
6041 "\x0c\x56\xcb\xe4\xe0\x05\x7a\xe1"
6042 "\x0a\x63\x09\x78\xbc\x2c\x55\xde",
6043 .alen = 32,
6044 .input = "\x87\xa3\x36\xfd\x96\xb3\x93\x78"
6045 "\xa9\x28\x63\xba\x12\xa3\x14\x85"
6046 "\x57\x1e\x06\xc9\x7b\x21\xef\x76"
6047 "\x7f\x38\x7e\x8e\x29\xa4\x3e\x7e",
6048 .ilen = 32,
6049 .result = "\x8a\x1e\x11\xf0\x02\x6b\xe2\x19"
6050 "\xfc\x70\xc4\x6d\x8e\xb7\x99\xab"
6051 "\xc5\x4b\xa2\xac\xd3\xf3\x48\xff"
6052 "\x3b\xb5\xce\x53\xef\xde\xbb\x02"
6053 "\xa9\x86\x15\x6c\x13\xfe\xda\x0a"
6054 "\x22\xb8\x29\x3d\xd8\x39\x9a\x23",
6055 .rlen = 48,
6056 }, {
6057 .key = "\xf4\x6b\xc2\x75\x62\xfe\xb4\xe1"
6058 "\xa3\xf0\xff\xdd\x4e\x4b\x12\x75"
6059 "\x53\x14\x73\x66\x8d\x88\xf6\x80"
6060 "\xa0\x20\x35",
6061 .klen = 27,
6062 .iv = "\x26\xf2\x21\x8d\x50\x20\xda\xe2",
6063 .assoc = "\x5b\x9e\x13\x67\x02\x5e\xef\xc1"
6064 "\x6c\xf9\xd7\x1e\x52\x8f\x7a\x47"
6065 "\xe9\xd4\xcf\x20\x14\x6e\xf0\x2d"
6066 "\xd8\x9e\x2b\x56\x10\x23\x56\xe7",
6067 .alen = 32,
6068 .ilen = 0,
6069 .result = "\x36\xea\x7a\x70\x08\xdc\x6a\xbc"
6070 "\xad\x0c\x7a\x63\xf6\x61\xfd\x9b",
6071 .rlen = 16,
6072 }, {
6073 .key = "\x56\xdf\x5c\x8f\x26\x3f\x0e\x42"
6074 "\xef\x7a\xd3\xce\xfc\x84\x60\x62"
6075 "\xca\xb4\x40\xaf\x5f\xc9\xc9\x01"
6076 "\xd6\x3c\x8c",
6077 .klen = 27,
6078 .iv = "\x86\x84\xb6\xcd\xef\x09\x2e\x94",
6079 .assoc = "\x02\x65\x78\x3c\xe9\x21\x30\x91"
6080 "\xb1\xb9\xda\x76\x9a\x78\x6d\x95"
6081 "\xf2\x88\x32\xa3\xf2\x50\xcb\x4c"
6082 "\xe3\x00\x73\x69\x84\x69\x87\x79",
6083 .alen = 32,
6084 .input = "\x9f\xd2\x02\x4b\x52\x49\x31\x3c"
6085 "\x43\x69\x3a\x2d\x8e\x70\xad\x7e"
6086 "\xe0\xe5\x46\x09\x80\x89\x13\xb2"
6087 "\x8c\x8b\xd9\x3f\x86\xfb\xb5\x6b",
6088 .ilen = 32,
6089 .result = "\x39\xdf\x7c\x3c\x5a\x29\xb9\x62"
6090 "\x5d\x51\xc2\x16\xd8\xbd\x06\x9f"
6091 "\x9b\x6a\x09\x70\xc1\x51\x83\xc2"
6092 "\x66\x88\x1d\x4f\x9a\xda\xe0\x1e"
6093 "\xc7\x79\x11\x58\xe5\x6b\x20\x40"
6094 "\x7a\xea\x46\x42\x8b\xe4\x6f\xe1",
6095 .rlen = 48,
6096 }, {
6097 .key = "\xe0\x8d\x99\x71\x60\xd7\x97\x1a"
6098 "\xbd\x01\x99\xd5\x8a\xdf\x71\x3a"
6099 "\xd3\xdf\x24\x4b\x5e\x3d\x4b\x4e"
6100 "\x30\x7a\xb9\xd8\x53\x0a\x5e\x2b"
6101 "\x1e\x29\x91",
6102 .klen = 35,
6103 .iv = "\xad\x8e\xc1\x53\x0a\xcf\x2d\xbe",
6104 .assoc = "\x19\xb6\x1f\x57\xc4\xf3\xf0\x8b"
6105 "\x78\x2b\x94\x02\x29\x0f\x42\x27"
6106 "\x6b\x75\xcb\x98\x34\x08\x7e\x79"
6107 "\xe4\x3e\x49\x0d\x84\x8b\x22\x87",
6108 .alen = 32,
6109 .input = "\xe1\xd9\xd8\x13\xeb\x3a\x75\x3f"
6110 "\x9d\xbd\x5f\x66\xbe\xdc\xbb\x66"
6111 "\xbf\x17\x99\x62\x4a\x39\x27\x1f"
6112 "\x1d\xdc\x24\xae\x19\x2f\x98\x4c",
6113 .ilen = 32,
6114 .result = "\x19\xb8\x61\x33\x45\x2b\x43\x96"
6115 "\x6f\x51\xd0\x20\x30\x7d\x9b\xc6"
6116 "\x26\x3d\xf8\xc9\x65\x16\xa8\x9f"
6117 "\xf0\x62\x17\x34\xf2\x1e\x8d\x75"
6118 "\x4e\x13\xcc\xc0\xc3\x2a\x54\x2d",
6119 .rlen = 40,
6120 }, {
6121 .key = "\x7c\xc8\x18\x3b\x8d\x99\xe0\x7c"
6122 "\x45\x41\xb8\xbd\x5c\xa7\xc2\x32"
6123 "\x8a\xb8\x02\x59\xa4\xfe\xa9\x2c"
6124 "\x09\x75\x9a\x9b\x3c\x9b\x27\x39"
6125 "\xf9\xd9\x4e",
6126 .klen = 35,
6127 .iv = "\x63\xb5\x3d\x9d\x43\xf6\x1e\x50",
6128 .assoc = "\x57\xf5\x6b\x8b\x57\x5c\x3d\x3b"
6129 "\x13\x02\x01\x0c\x83\x4c\x96\x35"
6130 "\x8e\xd6\x39\xcf\x7d\x14\x9b\x94"
6131 "\xb0\x39\x36\xe6\x8f\x57\xe0\x13",
6132 .alen = 32,
6133 .input = "\x3b\x6c\x29\x36\xb6\xef\x07\xa6"
6134 "\x83\x72\x07\x4f\xcf\xfa\x66\x89"
6135 "\x5f\xca\xb1\xba\xd5\x8f\x2c\x27"
6136 "\x30\xdb\x75\x09\x93\xd4\x65\xe4",
6137 .ilen = 32,
6138 .result = "\xb0\x88\x5a\x33\xaa\xe5\xc7\x1d"
6139 "\x85\x23\xc7\xc6\x2f\xf4\x1e\x3d"
6140 "\xcc\x63\x44\x25\x07\x78\x4f\x9e"
6141 "\x96\xb8\x88\xeb\xbc\x48\x1f\x06"
6142 "\x39\xaf\x39\xac\xd8\x4a\x80\x39"
6143 "\x7b\x72\x8a\xf7",
6144 .rlen = 44,
6145 }, {
6146 .key = "\xab\xd0\xe9\x33\x07\x26\xe5\x83"
6147 "\x8c\x76\x95\xd4\xb6\xdc\xf3\x46"
6148 "\xf9\x8f\xad\xe3\x02\x13\x83\x77"
6149 "\x3f\xb0\xf1\xa1\xa1\x22\x0f\x2b"
6150 "\x24\xa7\x8b",
6151 .klen = 35,
6152 .iv = "\x07\xcb\xcc\x0e\xe6\x33\xbf\xf5",
6153 .assoc = "\xd4\xdb\x30\x1d\x03\xfe\xfd\x5f"
6154 "\x87\xd4\x8c\xb6\xb6\xf1\x7a\x5d"
6155 "\xab\x90\x65\x8d\x8e\xca\x4d\x4f"
6156 "\x16\x0c\x40\x90\x4b\xc7\x36\x73",
6157 .alen = 32,
6158 .input = "\xf5\xc6\x7d\x48\xc1\xb7\xe6\x92"
6159 "\x97\x5a\xca\xc4\xa9\x6d\xf9\x3d"
6160 "\x6c\xde\xbc\xf1\x90\xea\x6a\xb2"
6161 "\x35\x86\x36\xaf\x5c\xfe\x4b\x3a",
6162 .ilen = 32,
6163 .result = "\x83\x6f\x40\x87\x72\xcf\xc1\x13"
6164 "\xef\xbb\x80\x21\x04\x6c\x58\x09"
6165 "\x07\x1b\xfc\xdf\xc0\x3f\x5b\xc7"
6166 "\xe0\x79\xa8\x6e\x71\x7c\x3f\xcf"
6167 "\x5c\xda\xb2\x33\xe5\x13\xe2\x0d"
6168 "\x74\xd1\xef\xb5\x0f\x3a\xb5\xf8",
6169 .rlen = 48,
6170 },
6171};
6172
6173static struct aead_testvec aes_ccm_rfc4309_dec_tv_template[] = {
6174 {
6175 .key = "\xab\x2f\x8a\x74\xb7\x1c\xd2\xb1"
6176 "\xff\x80\x2e\x48\x7d\x82\xf8\xb9"
6177 "\xc6\xfb\x7d",
6178 .klen = 19,
6179 .iv = "\x80\x0d\x13\xab\xd8\xa6\xb2\xd8",
6180 .alen = 0,
6181 .input = "\xd5\xe8\x93\x9f\xc7\x89\x2e\x2b",
6182 .ilen = 8,
6183 .result = "\x00",
6184 .rlen = 0,
6185 .novrfy = 1,
6186 }, {
6187 .key = "\xab\x2f\x8a\x74\xb7\x1c\xd2\xb1"
6188 "\xff\x80\x2e\x48\x7d\x82\xf8\xb9"
6189 "\xaf\x94\x87",
6190 .klen = 19,
6191 .iv = "\x78\x35\x82\x81\x7f\x88\x94\x68",
6192 .alen = 0,
6193 .input = "\x41\x3c\xb8\x87\x73\xcb\xf3\xf3",
6194 .ilen = 8,
6195 .result = "\x00",
6196 .rlen = 0,
6197 }, {
6198 .key = "\x61\x0e\x8c\xae\xe3\x23\xb6\x38"
6199 "\x76\x1c\xf6\x3a\x67\xa3\x9c\xd8"
6200 "\xc6\xfb\x7d",
6201 .klen = 19,
6202 .iv = "\x80\x0d\x13\xab\xd8\xa6\xb2\xd8",
6203 .assoc = "\xf3\x94\x87\x78\x35\x82\x81\x7f"
6204 "\x88\x94\x68\xb1\x78\x6b\x2b\xd6"
6205 "\x04\x1f\x4e\xed\x78\xd5\x33\x66"
6206 "\xd8\x94\x99\x91\x81\x54\x62\x57",
6207 .alen = 32,
6208 .input = "\xf0\x7c\x29\x02\xae\x1c\x2f\x55"
6209 "\xd0\xd1\x3d\x1a\xa3\x6d\xe4\x0a"
6210 "\x86\xb0\x87\x6b\x62\x33\x8c\x34"
6211 "\xce\xab\x57\xcc\x79\x0b\xe0\x6f"
6212 "\x5c\x3e\x48\x1f\x6c\x46\xf7\x51"
6213 "\x8b\x84\x83\x2a\xc1\x05\xb8\xc5",
6214 .ilen = 48,
6215 .result = "\x50\x82\x3e\x07\xe2\x1e\xb6\xfb"
6216 "\x33\xe4\x73\xce\xd2\xfb\x95\x79"
6217 "\xe8\xb4\xb5\x77\x11\x10\x62\x6f"
6218 "\x6a\x82\xd1\x13\xec\xf5\xd0\x48",
6219 .rlen = 32,
6220 .novrfy = 1,
6221 }, {
6222 .key = "\x61\x0e\x8c\xae\xe3\x23\xb6\x38"
6223 "\x76\x1c\xf6\x3a\x67\xa3\x9c\xd8"
6224 "\x05\xe0\xc9",
6225 .klen = 19,
6226 .iv = "\x0f\xed\x34\xea\x97\xd4\x3b\xdf",
6227 .assoc = "\x49\x5c\x50\x1f\x1d\x94\xcc\x81"
6228 "\xba\xb7\xb6\x03\xaf\xa5\xc1\xa1"
6229 "\xd8\x5c\x42\x68\xe0\x6c\xda\x89"
6230 "\x05\xac\x56\xac\x1b\x2a\xd3\x86",
6231 .alen = 32,
6232 .input = "\x39\xbe\x7d\x15\x62\x77\xf3\x3c"
6233 "\xad\x83\x52\x6d\x71\x03\x25\x1c"
6234 "\xed\x81\x3a\x9a\x16\x7d\x19\x80"
6235 "\x72\x04\x72\xd0\xf6\xff\x05\x0f"
6236 "\xb7\x14\x30\x00\x32\x9e\xa0\xa6"
6237 "\x9e\x5a\x18\xa1\xb8\xfe\xdb\xd3",
6238 .ilen = 48,
6239 .result = "\x75\x05\xbe\xc2\xd9\x1e\xde\x60"
6240 "\x47\x3d\x8c\x7d\xbd\xb5\xd9\xb7"
6241 "\xf2\xae\x61\x05\x8f\x82\x24\x3f"
6242 "\x9c\x67\x91\xe1\x38\x4f\xe4\x0c",
6243 .rlen = 32,
6244 }, {
6245 .key = "\x39\xbb\xa7\xbe\x59\x97\x9e\x73"
6246 "\xa2\xbc\x6b\x98\xd7\x75\x7f\xe3"
6247 "\xa4\x48\x93\x39\x26\x71\x4a\xc6"
6248 "\xee\x49\x83",
6249 .klen = 27,
6250 .iv = "\xe9\xa9\xff\xe9\x57\xba\xfd\x9e",
6251 .assoc = "\x44\xa6\x2c\x05\xe9\xe1\x43\xb1"
6252 "\x58\x7c\xf2\x5c\x6d\x39\x0a\x64"
6253 "\xa4\xf0\x13\x05\xd1\x77\x99\x67"
6254 "\x11\xc4\xc6\xdb\x00\x56\x36\x61",
6255 .alen = 32,
6256 .input = "\x71\x99\xfa\xf4\x44\x12\x68\x9b",
6257 .ilen = 8,
6258 .result = "\x00",
6259 .rlen = 0,
6260 }, {
6261 .key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7"
6262 "\x96\xe5\xc5\x68\xaa\x95\x35\xe0"
6263 "\x29\xa0\xba\x9e\x48\x78\xd1\xba"
6264 "\xee\x49\x83",
6265 .klen = 27,
6266 .iv = "\xe9\xa9\xff\xe9\x57\xba\xfd\x9e",
6267 .assoc = "\x44\xa6\x2c\x05\xe9\xe1\x43\xb1"
6268 "\x58\x7c\xf2\x5c\x6d\x39\x0a\x64"
6269 "\xa4\xf0\x13\x05\xd1\x77\x99\x67"
6270 "\x11\xc4\xc6\xdb\x00\x56\x36\x61",
6271 .alen = 32,
6272 .input = "\xfb\xe5\x5d\x34\xbe\xe5\xe8\xe7"
6273 "\x5a\xef\x2f\xbf\x1f\x7f\xd4\xb2"
6274 "\x66\xca\x61\x1e\x96\x7a\x61\xb3"
6275 "\x1c\x16\x45\x52\xba\x04\x9c\x9f"
6276 "\xb1\xd2\x40\xbc\x52\x7c\x6f\xb1",
6277 .ilen = 40,
6278 .result = "\x85\x34\x66\x42\xc8\x92\x0f\x36"
6279 "\x58\xe0\x6b\x91\x3c\x98\x5c\xbb"
6280 "\x0a\x85\xcc\x02\xad\x7a\x96\xe9"
6281 "\x65\x43\xa4\xc3\x0f\xdc\x55\x81",
6282 .rlen = 32,
6283 }, {
6284 .key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7"
6285 "\x96\xe5\xc5\x68\xaa\x95\x35\xe0"
6286 "\x29\xa0\xba\x9e\x48\x78\xd1\xba"
6287 "\xd1\xfc\x57",
6288 .klen = 27,
6289 .iv = "\x9c\xfe\xb8\x9c\xad\x71\xaa\x1f",
6290 .assoc = "\x86\x67\xa5\xa9\x14\x5f\x0d\xc6"
6291 "\xff\x14\xc7\x44\xbf\x6c\x3a\xc3"
6292 "\xff\xb6\x81\xbd\xe2\xd5\x06\xc7"
6293 "\x3c\xa1\x52\x13\x03\x8a\x23\x3a",
6294 .alen = 32,
6295 .input = "\x3f\x66\xb0\x9d\xe5\x4b\x38\x00"
6296 "\xc6\x0e\x6e\xe5\xd6\x98\xa6\x37"
6297 "\x8c\x26\x33\xc6\xb2\xa2\x17\xfa"
6298 "\x64\x19\xc0\x30\xd7\xfc\x14\x6b"
6299 "\xe3\x33\xc2\x04\xb0\x37\xbe\x3f"
6300 "\xa9\xb4\x2d\x68\x03\xa3\x44\xef",
6301 .ilen = 48,
6302 .result = "\x02\x87\x4d\x28\x80\x6e\xb2\xed"
6303 "\x99\x2a\xa8\xca\x04\x25\x45\x90"
6304 "\x1d\xdd\x5a\xd9\xe4\xdb\x9c\x9c"
6305 "\x49\xe9\x01\xfe\xa7\x80\x6d\x6b",
6306 .rlen = 32,
6307 .novrfy = 1,
6308 }, {
6309 .key = "\xa4\x4b\x54\x29\x0a\xb8\x6d\x01"
6310 "\x5b\x80\x2a\xcf\x25\xc4\xb7\x5c"
6311 "\x20\x2c\xad\x30\xc2\x2b\x41\xfb"
6312 "\x0e\x85\xbc\x33\xad\x0f\x2b\xff"
6313 "\xee\x49\x83",
6314 .klen = 35,
6315 .iv = "\xe9\xa9\xff\xe9\x57\xba\xfd\x9e",
6316 .alen = 0,
6317 .input = "\x1f\xb8\x8f\xa3\xdd\x54\x00\xf2",
6318 .ilen = 8,
6319 .result = "\x00",
6320 .rlen = 0,
6321 }, {
6322 .key = "\x39\xbb\xa7\xbe\x59\x97\x9e\x73"
6323 "\xa2\xbc\x6b\x98\xd7\x75\x7f\xe3"
6324 "\xa4\x48\x93\x39\x26\x71\x4a\xc6"
6325 "\xae\x8f\x11\x4c\xc2\x9c\x4a\xbb"
6326 "\x85\x34\x66",
6327 .klen = 35,
6328 .iv = "\x42\xc8\x92\x0f\x36\x58\xe0\x6b",
6329 .alen = 0,
6330 .input = "\x48\x01\x5e\x02\x24\x04\x66\x47"
6331 "\xa1\xea\x6f\xaf\xe8\xfc\xfb\xdd"
6332 "\xa5\xa9\x87\x8d\x84\xee\x2e\x77"
6333 "\xbb\x86\xb9\xf5\x5c\x6c\xff\xf6"
6334 "\x72\xc3\x8e\xf7\x70\xb1\xb2\x07"
6335 "\xbc\xa8\xa3\xbd\x83\x7c\x1d\x2a",
6336 .ilen = 48,
6337 .result = "\xdc\x56\xf2\x71\xb0\xb1\xa0\x6c"
6338 "\xf0\x97\x3a\xfb\x6d\xe7\x32\x99"
6339 "\x3e\xaf\x70\x5e\xb2\x4d\xea\x39"
6340 "\x89\xd4\x75\x7a\x63\xb1\xda\x93",
6341 .rlen = 32,
6342 .novrfy = 1,
6343 }, {
6344 .key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7"
6345 "\x96\xe5\xc5\x68\xaa\x95\x35\xe0"
6346 "\x29\xa0\xba\x9e\x48\x78\xd1\xba"
6347 "\x0d\x1a\x53\x3b\xb5\xe3\xf8\x8b"
6348 "\xcf\x76\x3f",
6349 .klen = 35,
6350 .iv = "\xd9\x95\x75\x8f\x44\x89\x40\x7b",
6351 .assoc = "\x8f\x86\x6c\x4d\x1d\xc5\x39\x88"
6352 "\xc8\xf3\x5c\x52\x10\x63\x6f\x2b"
6353 "\x8a\x2a\xc5\x6f\x30\x23\x58\x7b"
6354 "\xfb\x36\x03\x11\xb4\xd9\xf2\xfe",
6355 .alen = 32,
6356 .input = "\x48\x58\xd6\xf3\xad\x63\x58\xbf"
6357 "\xae\xc7\x5e\xae\x83\x8f\x7b\xe4"
6358 "\x78\x5c\x4c\x67\x71\x89\x94\xbf"
6359 "\x47\xf1\x63\x7e\x1c\x59\xbd\xc5"
6360 "\x7f\x44\x0a\x0c\x01\x18\x07\x92"
6361 "\xe1\xd3\x51\xce\x32\x6d\x0c\x5b",
6362 .ilen = 48,
6363 .result = "\xc2\x54\xc8\xde\x78\x87\x77\x40"
6364 "\x49\x71\xe4\xb7\xe7\xcb\x76\x61"
6365 "\x0a\x41\xb9\xe9\xc0\x76\x54\xab"
6366 "\x04\x49\x3b\x19\x93\x57\x25\x5d",
6367 .rlen = 32,
6368 },
6369};
6370
6371/*
6372 * ANSI X9.31 Continuous Pseudo-Random Number Generator (AES mode)
6373 * test vectors, taken from Appendix B.2.9 and B.2.10:
6374 * http://csrc.nist.gov/groups/STM/cavp/documents/rng/RNGVS.pdf
6375 * Only AES-128 is supported at this time.
6376 */
6377#define ANSI_CPRNG_AES_TEST_VECTORS 6
6378
6379static struct cprng_testvec ansi_cprng_aes_tv_template[] = {
6380 {
6381 .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42"
6382 "\xed\x06\x1c\xab\xb8\xd4\x62\x02",
6383 .klen = 16,
6384 .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62"
6385 "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xf9",
6386 .dtlen = 16,
6387 .v = "\x80\x00\x00\x00\x00\x00\x00\x00"
6388 "\x00\x00\x00\x00\x00\x00\x00\x00",
6389 .vlen = 16,
6390 .result = "\x59\x53\x1e\xd1\x3b\xb0\xc0\x55"
6391 "\x84\x79\x66\x85\xc1\x2f\x76\x41",
6392 .rlen = 16,
6393 .loops = 1,
6394 }, {
6395 .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42"
6396 "\xed\x06\x1c\xab\xb8\xd4\x62\x02",
6397 .klen = 16,
6398 .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62"
6399 "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfa",
6400 .dtlen = 16,
6401 .v = "\xc0\x00\x00\x00\x00\x00\x00\x00"
6402 "\x00\x00\x00\x00\x00\x00\x00\x00",
6403 .vlen = 16,
6404 .result = "\x7c\x22\x2c\xf4\xca\x8f\xa2\x4c"
6405 "\x1c\x9c\xb6\x41\xa9\xf3\x22\x0d",
6406 .rlen = 16,
6407 .loops = 1,
6408 }, {
6409 .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42"
6410 "\xed\x06\x1c\xab\xb8\xd4\x62\x02",
6411 .klen = 16,
6412 .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62"
6413 "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfb",
6414 .dtlen = 16,
6415 .v = "\xe0\x00\x00\x00\x00\x00\x00\x00"
6416 "\x00\x00\x00\x00\x00\x00\x00\x00",
6417 .vlen = 16,
6418 .result = "\x8a\xaa\x00\x39\x66\x67\x5b\xe5"
6419 "\x29\x14\x28\x81\xa9\x4d\x4e\xc7",
6420 .rlen = 16,
6421 .loops = 1,
6422 }, {
6423 .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42"
6424 "\xed\x06\x1c\xab\xb8\xd4\x62\x02",
6425 .klen = 16,
6426 .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62"
6427 "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfc",
6428 .dtlen = 16,
6429 .v = "\xf0\x00\x00\x00\x00\x00\x00\x00"
6430 "\x00\x00\x00\x00\x00\x00\x00\x00",
6431 .vlen = 16,
6432 .result = "\x88\xdd\xa4\x56\x30\x24\x23\xe5"
6433 "\xf6\x9d\xa5\x7e\x7b\x95\xc7\x3a",
6434 .rlen = 16,
6435 .loops = 1,
6436 }, {
6437 .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42"
6438 "\xed\x06\x1c\xab\xb8\xd4\x62\x02",
6439 .klen = 16,
6440 .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62"
6441 "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfd",
6442 .dtlen = 16,
6443 .v = "\xf8\x00\x00\x00\x00\x00\x00\x00"
6444 "\x00\x00\x00\x00\x00\x00\x00\x00",
6445 .vlen = 16,
6446 .result = "\x05\x25\x92\x46\x61\x79\xd2\xcb"
6447 "\x78\xc4\x0b\x14\x0a\x5a\x9a\xc8",
6448 .rlen = 16,
6449 .loops = 1,
6450 }, { /* Monte Carlo Test */
6451 .key = "\x9f\x5b\x51\x20\x0b\xf3\x34\xb5"
6452 "\xd8\x2b\xe8\xc3\x72\x55\xc8\x48",
6453 .klen = 16,
6454 .dt = "\x63\x76\xbb\xe5\x29\x02\xba\x3b"
6455 "\x67\xc9\x25\xfa\x70\x1f\x11\xac",
6456 .dtlen = 16,
6457 .v = "\x57\x2c\x8e\x76\x87\x26\x47\x97"
6458 "\x7e\x74\xfb\xdd\xc4\x95\x01\xd1",
6459 .vlen = 16,
6460 .result = "\x48\xe9\xbd\x0d\x06\xee\x18\xfb"
6461 "\xe4\x57\x90\xd5\xc3\xfc\x9b\x73",
6462 .rlen = 16,
6463 .loops = 10000,
6464 },
6465};
6466
5828/* Cast5 test vectors from RFC 2144 */ 6467/* Cast5 test vectors from RFC 2144 */
5829#define CAST5_ENC_TEST_VECTORS 3 6468#define CAST5_ENC_TEST_VECTORS 3
5830#define CAST5_DEC_TEST_VECTORS 3 6469#define CAST5_DEC_TEST_VECTORS 3