self_test_data.inc 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494
  1. /*
  2. * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. /* Macros to build Self test data */
  10. #define ITM(x) x, sizeof(x)
  11. #define ITM_STR(x) x, (sizeof(x) - 1)
  12. #define ST_KAT_PARAM_END() { "", 0, NULL, 0 }
  13. #define ST_KAT_PARAM_BIGNUM(name, data) \
  14. { name, OSSL_PARAM_UNSIGNED_INTEGER, ITM(data) }
  15. #define ST_KAT_PARAM_OCTET(name, data) \
  16. { name, OSSL_PARAM_OCTET_STRING, ITM(data) }
  17. #define ST_KAT_PARAM_UTF8STRING(name, data) \
  18. { name, OSSL_PARAM_UTF8_STRING, ITM_STR(data) }
  19. #define ST_KAT_PARAM_INT(name, i) \
  20. { name, OSSL_PARAM_INTEGER, &i, sizeof(i) }
  21. /* used to store raw parameters for keys and algorithms */
  22. typedef struct st_kat_param_st {
  23. const char *name; /* an OSSL_PARAM name */
  24. size_t type; /* the type associated with the data */
  25. const void *data; /* unsigned char [], or char [] depending on the type */
  26. size_t data_len; /* the length of the data */
  27. } ST_KAT_PARAM;
  28. typedef struct st_kat_st {
  29. const char *desc;
  30. const char *algorithm;
  31. const unsigned char *pt;
  32. size_t pt_len;
  33. const unsigned char *expected;
  34. size_t expected_len;
  35. } ST_KAT;
  36. typedef ST_KAT ST_KAT_DIGEST;
  37. typedef struct st_kat_cipher_st {
  38. ST_KAT base;
  39. const unsigned char *key;
  40. size_t key_len;
  41. const unsigned char *iv;
  42. size_t iv_len;
  43. const unsigned char *aad;
  44. size_t aad_len;
  45. const unsigned char *tag;
  46. size_t tag_len;
  47. } ST_KAT_CIPHER;
  48. typedef struct st_kat_kdf_st {
  49. const char *desc;
  50. const char *algorithm;
  51. const ST_KAT_PARAM *params;
  52. const unsigned char *expected;
  53. size_t expected_len;
  54. } ST_KAT_KDF;
  55. typedef struct st_kat_drbg_st {
  56. const char *desc;
  57. const char *algorithm;
  58. const char *param_name;
  59. char *param_value;
  60. const unsigned char *entropyin;
  61. size_t entropyinlen;
  62. const unsigned char *nonce;
  63. size_t noncelen;
  64. const unsigned char *persstr;
  65. size_t persstrlen;
  66. const unsigned char *entropyinpr1;
  67. size_t entropyinpr1len;
  68. const unsigned char *entropyinpr2;
  69. size_t entropyinpr2len;
  70. const unsigned char *entropyaddin1;
  71. size_t entropyaddin1len;
  72. const unsigned char *entropyaddin2;
  73. size_t entropyaddin2len;
  74. const unsigned char *expected;
  75. size_t expectedlen;
  76. } ST_KAT_DRBG;
  77. typedef struct st_kat_kas_st {
  78. const char *desc;
  79. const char *algorithm;
  80. const ST_KAT_PARAM *key_group;
  81. const ST_KAT_PARAM *key_host_data;
  82. const ST_KAT_PARAM *key_peer_data;
  83. const unsigned char *expected;
  84. size_t expected_len;
  85. } ST_KAT_KAS;
  86. typedef struct st_kat_sign_st {
  87. const char *desc;
  88. const char *algorithm;
  89. const char *mdalgorithm;
  90. const ST_KAT_PARAM *key;
  91. const unsigned char *sig_expected; /* Set to NULL if this value changes */
  92. size_t sig_expected_len;
  93. } ST_KAT_SIGN;
  94. typedef struct st_kat_asym_cipher_st {
  95. const char *desc;
  96. const char *algorithm;
  97. int encrypt;
  98. const ST_KAT_PARAM *key;
  99. const ST_KAT_PARAM *postinit;
  100. const unsigned char *in;
  101. size_t in_len;
  102. const unsigned char *expected;
  103. size_t expected_len;
  104. } ST_KAT_ASYM_CIPHER;
  105. /*- DIGEST TEST DATA */
  106. static const unsigned char sha1_pt[] = "abc";
  107. static const unsigned char sha1_digest[] = {
  108. 0xA9, 0x99, 0x3E, 0x36, 0x47, 0x06, 0x81, 0x6A, 0xBA, 0x3E, 0x25, 0x71,
  109. 0x78, 0x50, 0xC2, 0x6C, 0x9C, 0xD0, 0xD8, 0x9D
  110. };
  111. static const unsigned char sha512_pt[] = "abc";
  112. static const unsigned char sha512_digest[] = {
  113. 0xDD, 0xAF, 0x35, 0xA1, 0x93, 0x61, 0x7A, 0xBA, 0xCC, 0x41, 0x73, 0x49,
  114. 0xAE, 0x20, 0x41, 0x31, 0x12, 0xE6, 0xFA, 0x4E, 0x89, 0xA9, 0x7E, 0xA2,
  115. 0x0A, 0x9E, 0xEE, 0xE6, 0x4B, 0x55, 0xD3, 0x9A, 0x21, 0x92, 0x99, 0x2A,
  116. 0x27, 0x4F, 0xC1, 0xA8, 0x36, 0xBA, 0x3C, 0x23, 0xA3, 0xFE, 0xEB, 0xBD,
  117. 0x45, 0x4D, 0x44, 0x23, 0x64, 0x3C, 0xE8, 0x0E, 0x2A, 0x9A, 0xC9, 0x4F,
  118. 0xA5, 0x4C, 0xA4, 0x9F
  119. };
  120. static const unsigned char sha3_256_pt[] = { 0xe7, 0x37, 0x21, 0x05 };
  121. static const unsigned char sha3_256_digest[] = {
  122. 0x3a, 0x42, 0xb6, 0x8a, 0xb0, 0x79, 0xf2, 0x8c, 0x4c, 0xa3, 0xc7, 0x52,
  123. 0x29, 0x6f, 0x27, 0x90, 0x06, 0xc4, 0xfe, 0x78, 0xb1, 0xeb, 0x79, 0xd9,
  124. 0x89, 0x77, 0x7f, 0x05, 0x1e, 0x40, 0x46, 0xae
  125. };
  126. static const ST_KAT_DIGEST st_kat_digest_tests[] =
  127. {
  128. {
  129. OSSL_SELF_TEST_DESC_MD_SHA1,
  130. "SHA1",
  131. ITM_STR(sha1_pt),
  132. ITM(sha1_digest),
  133. },
  134. {
  135. OSSL_SELF_TEST_DESC_MD_SHA2,
  136. "SHA512",
  137. ITM_STR(sha512_pt),
  138. ITM(sha512_digest),
  139. },
  140. {
  141. OSSL_SELF_TEST_DESC_MD_SHA3,
  142. "SHA3-256",
  143. ITM(sha3_256_pt),
  144. ITM(sha3_256_digest),
  145. },
  146. };
  147. /*- CIPHER TEST DATA */
  148. /* DES3 test data */
  149. static const unsigned char des_ede3_cbc_pt[] = {
  150. 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
  151. 0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A,
  152. 0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C,
  153. 0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51
  154. };
  155. static const unsigned char des_ede3_cbc_key[] = {
  156. 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
  157. 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01,
  158. 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23
  159. };
  160. static const unsigned char des_ede3_cbc_iv[] = {
  161. 0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17
  162. };
  163. static const unsigned char des_ede3_cbc_ct[] = {
  164. 0x20, 0x79, 0xC3, 0xD5, 0x3A, 0xA7, 0x63, 0xE1,
  165. 0x93, 0xB7, 0x9E, 0x25, 0x69, 0xAB, 0x52, 0x62,
  166. 0x51, 0x65, 0x70, 0x48, 0x1F, 0x25, 0xB5, 0x0F,
  167. 0x73, 0xC0, 0xBD, 0xA8, 0x5C, 0x8E, 0x0D, 0xA7
  168. };
  169. /* AES-256 GCM test data */
  170. static const unsigned char aes_256_gcm_key[] = {
  171. 0x92, 0xe1, 0x1d, 0xcd, 0xaa, 0x86, 0x6f, 0x5c,
  172. 0xe7, 0x90, 0xfd, 0x24, 0x50, 0x1f, 0x92, 0x50,
  173. 0x9a, 0xac, 0xf4, 0xcb, 0x8b, 0x13, 0x39, 0xd5,
  174. 0x0c, 0x9c, 0x12, 0x40, 0x93, 0x5d, 0xd0, 0x8b
  175. };
  176. static const unsigned char aes_256_gcm_iv[] = {
  177. 0xac, 0x93, 0xa1, 0xa6, 0x14, 0x52, 0x99, 0xbd,
  178. 0xe9, 0x02, 0xf2, 0x1a
  179. };
  180. static const unsigned char aes_256_gcm_pt[] = {
  181. 0x2d, 0x71, 0xbc, 0xfa, 0x91, 0x4e, 0x4a, 0xc0,
  182. 0x45, 0xb2, 0xaa, 0x60, 0x95, 0x5f, 0xad, 0x24
  183. };
  184. static const unsigned char aes_256_gcm_aad[] = {
  185. 0x1e, 0x08, 0x89, 0x01, 0x6f, 0x67, 0x60, 0x1c,
  186. 0x8e, 0xbe, 0xa4, 0x94, 0x3b, 0xc2, 0x3a, 0xd6
  187. };
  188. static const unsigned char aes_256_gcm_ct[] = {
  189. 0x89, 0x95, 0xae, 0x2e, 0x6d, 0xf3, 0xdb, 0xf9,
  190. 0x6f, 0xac, 0x7b, 0x71, 0x37, 0xba, 0xe6, 0x7f
  191. };
  192. static const unsigned char aes_256_gcm_tag[] = {
  193. 0xec, 0xa5, 0xaa, 0x77, 0xd5, 0x1d, 0x4a, 0x0a,
  194. 0x14, 0xd9, 0xc5, 0x1e, 0x1d, 0xa4, 0x74, 0xab
  195. };
  196. static const ST_KAT_CIPHER st_kat_cipher_tests[] = {
  197. #ifndef OPENSSL_NO_DES
  198. {
  199. {
  200. OSSL_SELF_TEST_DESC_CIPHER_TDES,
  201. "DES-EDE3-CBC",
  202. ITM(des_ede3_cbc_pt),
  203. ITM(des_ede3_cbc_ct)
  204. },
  205. ITM(des_ede3_cbc_key),
  206. ITM(des_ede3_cbc_iv),
  207. },
  208. #endif
  209. {
  210. {
  211. OSSL_SELF_TEST_DESC_CIPHER_AES_GCM,
  212. "AES-256-GCM",
  213. ITM(aes_256_gcm_pt),
  214. ITM(aes_256_gcm_ct),
  215. },
  216. ITM(aes_256_gcm_key),
  217. ITM(aes_256_gcm_iv),
  218. ITM(aes_256_gcm_aad),
  219. ITM(aes_256_gcm_tag)
  220. }
  221. };
  222. static const char hkdf_digest[] = "SHA256";
  223. static const unsigned char hkdf_secret[] = { 's', 'e', 'c', 'r', 'e', 't' };
  224. static const unsigned char hkdf_salt[] = { 's', 'a', 'l', 't' };
  225. static const unsigned char hkdf_info[] = { 'l', 'a', 'b', 'e', 'l' };
  226. static const ST_KAT_PARAM hkdf_params[] = {
  227. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_DIGEST, hkdf_digest),
  228. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_KEY, hkdf_secret),
  229. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_SALT, hkdf_salt),
  230. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_INFO, hkdf_info),
  231. ST_KAT_PARAM_END()
  232. };
  233. static const unsigned char hkdf_expected[] = {
  234. 0x2a, 0xc4, 0x36, 0x9f, 0x52, 0x59, 0x96, 0xf8,
  235. 0xde, 0x13
  236. };
  237. static const char sskdf_digest[] = "SHA224";
  238. static const unsigned char sskdf_secret[] = {
  239. 0x6d, 0xbd, 0xc2, 0x3f, 0x04, 0x54, 0x88, 0xe4,
  240. 0x06, 0x27, 0x57, 0xb0, 0x6b, 0x9e, 0xba, 0xe1,
  241. 0x83, 0xfc, 0x5a, 0x59, 0x46, 0xd8, 0x0d, 0xb9,
  242. 0x3f, 0xec, 0x6f, 0x62, 0xec, 0x07, 0xe3, 0x72,
  243. 0x7f, 0x01, 0x26, 0xae, 0xd1, 0x2c, 0xe4, 0xb2,
  244. 0x62, 0xf4, 0x7d, 0x48, 0xd5, 0x42, 0x87, 0xf8,
  245. 0x1d, 0x47, 0x4c, 0x7c, 0x3b, 0x18, 0x50, 0xe9
  246. };
  247. static const unsigned char sskdf_otherinfo[] = {
  248. 0xa1, 0xb2, 0xc3, 0xd4, 0xe5, 0x43, 0x41, 0x56,
  249. 0x53, 0x69, 0x64, 0x3c, 0x83, 0x2e, 0x98, 0x49,
  250. 0xdc, 0xdb, 0xa7, 0x1e, 0x9a, 0x31, 0x39, 0xe6,
  251. 0x06, 0xe0, 0x95, 0xde, 0x3c, 0x26, 0x4a, 0x66,
  252. 0xe9, 0x8a, 0x16, 0x58, 0x54, 0xcd, 0x07, 0x98,
  253. 0x9b, 0x1e, 0xe0, 0xec, 0x3f, 0x8d, 0xbe
  254. };
  255. static const unsigned char sskdf_expected[] = {
  256. 0xa4, 0x62, 0xde, 0x16, 0xa8, 0x9d, 0xe8, 0x46,
  257. 0x6e, 0xf5, 0x46, 0x0b, 0x47, 0xb8
  258. };
  259. static const ST_KAT_PARAM sskdf_params[] = {
  260. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_DIGEST, sskdf_digest),
  261. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_KEY, sskdf_secret),
  262. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_INFO, sskdf_otherinfo),
  263. ST_KAT_PARAM_END()
  264. };
  265. static const char x942kdf_digest[] = "SHA1";
  266. static const char x942kdf_cekalg[] = "AES-128-WRAP";
  267. static const unsigned char x942kdf_secret[] = {
  268. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  269. 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  270. 0x10, 0x11, 0x12, 0x13
  271. };
  272. static const unsigned char x942kdf_expected[] = {
  273. 0xd6, 0xd6, 0xb0, 0x94, 0xc1, 0x02, 0x7a, 0x7d,
  274. 0xe6, 0xe3, 0x11, 0x72, 0x94, 0xa3, 0x53, 0x64
  275. };
  276. static const ST_KAT_PARAM x942kdf_params[] = {
  277. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_DIGEST, x942kdf_digest),
  278. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_CEK_ALG, x942kdf_cekalg),
  279. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_KEY, x942kdf_secret),
  280. ST_KAT_PARAM_END()
  281. };
  282. static const char x963kdf_digest[] = "SHA256";
  283. static const unsigned char x963kdf_otherinfo[] = {
  284. 0x75, 0xee, 0xf8, 0x1a, 0xa3, 0x04, 0x1e, 0x33,
  285. 0xb8, 0x09, 0x71, 0x20, 0x3d, 0x2c, 0x0c, 0x52
  286. };
  287. static const unsigned char x963kdf_secret[] = {
  288. 0x22, 0x51, 0x8b, 0x10, 0xe7, 0x0f, 0x2a, 0x3f,
  289. 0x24, 0x38, 0x10, 0xae, 0x32, 0x54, 0x13, 0x9e,
  290. 0xfb, 0xee, 0x04, 0xaa, 0x57, 0xc7, 0xaf, 0x7d
  291. };
  292. static const unsigned char x963kdf_expected[] = {
  293. 0xc4, 0x98, 0xaf, 0x77, 0x16, 0x1c, 0xc5, 0x9f,
  294. 0x29, 0x62, 0xb9, 0xa7, 0x13, 0xe2, 0xb2, 0x15,
  295. 0x15, 0x2d, 0x13, 0x97, 0x66, 0xce, 0x34, 0xa7,
  296. 0x76, 0xdf, 0x11, 0x86, 0x6a, 0x69, 0xbf, 0x2e
  297. };
  298. static const ST_KAT_PARAM x963kdf_params[] = {
  299. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_DIGEST, x963kdf_digest),
  300. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_KEY, x963kdf_secret),
  301. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_INFO, x963kdf_otherinfo),
  302. ST_KAT_PARAM_END()
  303. };
  304. static const char pbkdf2_digest[] = "SHA256";
  305. static const unsigned char pbkdf2_password[] = {
  306. 0x70, 0x61, 0x73, 0x73, 0x00, 0x77, 0x6f, 0x72,
  307. 0x64
  308. };
  309. static const unsigned char pbkdf2_salt[] = {
  310. 0x73, 0x61, 0x00, 0x6c, 0x74
  311. };
  312. static const unsigned char pbkdf2_expected[] = {
  313. 0x89, 0xb6, 0x9d, 0x05, 0x16, 0xf8, 0x29, 0x89,
  314. 0x3c, 0x69, 0x62, 0x26, 0x65, 0x0a, 0x86, 0x87,
  315. };
  316. static int pbkdf2_iterations = 4096;
  317. static int pbkdf2_pkcs5 = 1;
  318. static const ST_KAT_PARAM pbkdf2_params[] = {
  319. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_DIGEST, pbkdf2_digest),
  320. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_PASSWORD, pbkdf2_password),
  321. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_SALT, pbkdf2_salt),
  322. ST_KAT_PARAM_INT(OSSL_KDF_PARAM_ITER, pbkdf2_iterations),
  323. ST_KAT_PARAM_INT(OSSL_KDF_PARAM_PKCS5, pbkdf2_pkcs5),
  324. ST_KAT_PARAM_END()
  325. };
  326. static const char sshkdf_digest[] = "SHA1";
  327. static int sshkdf_type = EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV;
  328. static const unsigned char sshkdf_key[] = {
  329. 0x00, 0x00, 0x00, 0x80, 0x55, 0xba, 0xe9, 0x31,
  330. 0xc0, 0x7f, 0xd8, 0x24, 0xbf, 0x10, 0xad, 0xd1,
  331. 0x90, 0x2b, 0x6f, 0xbc, 0x7c, 0x66, 0x53, 0x47,
  332. 0x38, 0x34, 0x98, 0xa6, 0x86, 0x92, 0x9f, 0xf5,
  333. 0xa2, 0x5f, 0x8e, 0x40, 0xcb, 0x66, 0x45, 0xea,
  334. 0x81, 0x4f, 0xb1, 0xa5, 0xe0, 0xa1, 0x1f, 0x85,
  335. 0x2f, 0x86, 0x25, 0x56, 0x41, 0xe5, 0xed, 0x98,
  336. 0x6e, 0x83, 0xa7, 0x8b, 0xc8, 0x26, 0x94, 0x80,
  337. 0xea, 0xc0, 0xb0, 0xdf, 0xd7, 0x70, 0xca, 0xb9,
  338. 0x2e, 0x7a, 0x28, 0xdd, 0x87, 0xff, 0x45, 0x24,
  339. 0x66, 0xd6, 0xae, 0x86, 0x7c, 0xea, 0xd6, 0x3b,
  340. 0x36, 0x6b, 0x1c, 0x28, 0x6e, 0x6c, 0x48, 0x11,
  341. 0xa9, 0xf1, 0x4c, 0x27, 0xae, 0xa1, 0x4c, 0x51,
  342. 0x71, 0xd4, 0x9b, 0x78, 0xc0, 0x6e, 0x37, 0x35,
  343. 0xd3, 0x6e, 0x6a, 0x3b, 0xe3, 0x21, 0xdd, 0x5f,
  344. 0xc8, 0x23, 0x08, 0xf3, 0x4e, 0xe1, 0xcb, 0x17,
  345. 0xfb, 0xa9, 0x4a, 0x59,
  346. };
  347. static const unsigned char sshkdf_xcghash[] = {
  348. 0xa4, 0xeb, 0xd4, 0x59, 0x34, 0xf5, 0x67, 0x92,
  349. 0xb5, 0x11, 0x2d, 0xcd, 0x75, 0xa1, 0x07, 0x5f,
  350. 0xdc, 0x88, 0x92, 0x45,
  351. };
  352. static const unsigned char sshkdf_session_id[] = {
  353. 0xa4, 0xeb, 0xd4, 0x59, 0x34, 0xf5, 0x67, 0x92,
  354. 0xb5, 0x11, 0x2d, 0xcd, 0x75, 0xa1, 0x07, 0x5f,
  355. 0xdc, 0x88, 0x92, 0x45,
  356. };
  357. static const unsigned char sshkdf_expected[] = {
  358. 0xe2, 0xf6, 0x27, 0xc0, 0xb4, 0x3f, 0x1a, 0xc1,
  359. };
  360. static const ST_KAT_PARAM sshkdf_params[] = {
  361. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_DIGEST, sshkdf_digest),
  362. ST_KAT_PARAM_INT(OSSL_KDF_PARAM_SSHKDF_TYPE, sshkdf_type),
  363. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_KEY, sshkdf_key),
  364. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_SSHKDF_XCGHASH, sshkdf_xcghash),
  365. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_SSHKDF_SESSION_ID, sshkdf_session_id),
  366. ST_KAT_PARAM_END()
  367. };
  368. static const char tls12prf_digest[] = "SHA256";
  369. static const unsigned char tls12prf_secret[] = {
  370. 0x20, 0x2c, 0x88, 0xc0, 0x0f, 0x84, 0xa1, 0x7a,
  371. 0x20, 0x02, 0x70, 0x79, 0x60, 0x47, 0x87, 0x46,
  372. 0x11, 0x76, 0x45, 0x55, 0x39, 0xe7, 0x05, 0xbe,
  373. 0x73, 0x08, 0x90, 0x60, 0x2c, 0x28, 0x9a, 0x50,
  374. 0x01, 0xe3, 0x4e, 0xeb, 0x3a, 0x04, 0x3e, 0x5d,
  375. 0x52, 0xa6, 0x5e, 0x66, 0x12, 0x51, 0x88, 0xbf,
  376. };
  377. static const unsigned char tls12prf_seed[] = {
  378. 'k', 'e', 'y', ' ', 'e', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n',
  379. 0xae, 0x6c, 0x80, 0x6f, 0x8a, 0xd4, 0xd8, 0x07,
  380. 0x84, 0x54, 0x9d, 0xff, 0x28, 0xa4, 0xb5, 0x8f,
  381. 0xd8, 0x37, 0x68, 0x1a, 0x51, 0xd9, 0x28, 0xc3,
  382. 0xe3, 0x0e, 0xe5, 0xff, 0x14, 0xf3, 0x98, 0x68,
  383. 0x62, 0xe1, 0xfd, 0x91, 0xf2, 0x3f, 0x55, 0x8a,
  384. 0x60, 0x5f, 0x28, 0x47, 0x8c, 0x58, 0xcf, 0x72,
  385. 0x63, 0x7b, 0x89, 0x78, 0x4d, 0x95, 0x9d, 0xf7,
  386. 0xe9, 0x46, 0xd3, 0xf0, 0x7b, 0xd1, 0xb6, 0x16,
  387. };
  388. static const unsigned char tls12prf_expected[] = {
  389. 0xd0, 0x61, 0x39, 0x88, 0x9f, 0xff, 0xac, 0x1e,
  390. 0x3a, 0x71, 0x86, 0x5f, 0x50, 0x4a, 0xa5, 0xd0,
  391. 0xd2, 0xa2, 0xe8, 0x95, 0x06, 0xc6, 0xf2, 0x27,
  392. 0x9b, 0x67, 0x0c, 0x3e, 0x1b, 0x74, 0xf5, 0x31,
  393. 0x01, 0x6a, 0x25, 0x30, 0xc5, 0x1a, 0x3a, 0x0f,
  394. 0x7e, 0x1d, 0x65, 0x90, 0xd0, 0xf0, 0x56, 0x6b,
  395. 0x2f, 0x38, 0x7f, 0x8d, 0x11, 0xfd, 0x4f, 0x73,
  396. 0x1c, 0xdd, 0x57, 0x2d, 0x2e, 0xae, 0x92, 0x7f,
  397. 0x6f, 0x2f, 0x81, 0x41, 0x0b, 0x25, 0xe6, 0x96,
  398. 0x0b, 0xe6, 0x89, 0x85, 0xad, 0xd6, 0xc3, 0x84,
  399. 0x45, 0xad, 0x9f, 0x8c, 0x64, 0xbf, 0x80, 0x68,
  400. 0xbf, 0x9a, 0x66, 0x79, 0x48, 0x5d, 0x96, 0x6f,
  401. 0x1a, 0xd6, 0xf6, 0x8b, 0x43, 0x49, 0x5b, 0x10,
  402. 0xa6, 0x83, 0x75, 0x5e, 0xa2, 0xb8, 0x58, 0xd7,
  403. 0x0c, 0xca, 0xc7, 0xec, 0x8b, 0x05, 0x3c, 0x6b,
  404. 0xd4, 0x1c, 0xa2, 0x99, 0xd4, 0xe5, 0x19, 0x28,
  405. };
  406. static const ST_KAT_PARAM tls12prf_params[] = {
  407. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_DIGEST, tls12prf_digest),
  408. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_SECRET, tls12prf_secret),
  409. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_SEED, tls12prf_seed),
  410. ST_KAT_PARAM_END()
  411. };
  412. static const char kbkdf_digest[] = "SHA256";
  413. static const char kbkdf_mac[] = "HMAC";
  414. static const unsigned char kbkdf_salt[] = { 'p', 'r', 'f' };
  415. static const unsigned char kbkdf_prfinput[] = { 't', 'e', 's', 't' };
  416. static unsigned char kbkdf_key[] = {
  417. 0x37, 0x05, 0xD9, 0x60, 0x80, 0xC1, 0x77, 0x28,
  418. 0xA0, 0xE8, 0x00, 0xEA, 0xB6, 0xE0, 0xD2, 0x3C,
  419. };
  420. static unsigned char kbkdf_expected[] = {
  421. 0x9D, 0x18, 0x86, 0x16, 0xF6, 0x38, 0x52, 0xFE,
  422. 0x86, 0x91, 0x5B, 0xB8, 0x40, 0xB4, 0xA8, 0x86,
  423. 0xFF, 0x3E, 0x6B, 0xB0, 0xF8, 0x19, 0xB4, 0x9B,
  424. 0x89, 0x33, 0x93, 0xD3, 0x93, 0x85, 0x42, 0x95,
  425. };
  426. static const ST_KAT_PARAM kbkdf_params[] = {
  427. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_DIGEST, kbkdf_digest),
  428. ST_KAT_PARAM_UTF8STRING(OSSL_KDF_PARAM_MAC, kbkdf_mac),
  429. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_KEY, kbkdf_key),
  430. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_SALT, kbkdf_salt),
  431. ST_KAT_PARAM_OCTET(OSSL_KDF_PARAM_INFO, kbkdf_prfinput),
  432. ST_KAT_PARAM_END()
  433. };
  434. static const ST_KAT_KDF st_kat_kdf_tests[] =
  435. {
  436. {
  437. OSSL_SELF_TEST_DESC_KDF_TLS12_PRF,
  438. OSSL_KDF_NAME_TLS1_PRF,
  439. tls12prf_params,
  440. ITM(tls12prf_expected)
  441. },
  442. {
  443. OSSL_SELF_TEST_DESC_KDF_PBKDF2,
  444. OSSL_KDF_NAME_PBKDF2,
  445. pbkdf2_params,
  446. ITM(pbkdf2_expected)
  447. },
  448. {
  449. OSSL_SELF_TEST_DESC_KDF_SSHKDF,
  450. OSSL_KDF_NAME_SSHKDF,
  451. sshkdf_params,
  452. ITM(sshkdf_expected)
  453. },
  454. {
  455. OSSL_SELF_TEST_DESC_KDF_KBKDF,
  456. OSSL_KDF_NAME_KBKDF,
  457. kbkdf_params,
  458. ITM(kbkdf_expected)
  459. },
  460. {
  461. OSSL_SELF_TEST_DESC_KDF_HKDF,
  462. OSSL_KDF_NAME_HKDF,
  463. hkdf_params,
  464. ITM(hkdf_expected)
  465. },
  466. {
  467. OSSL_SELF_TEST_DESC_KDF_SSKDF,
  468. OSSL_KDF_NAME_SSKDF,
  469. sskdf_params,
  470. ITM(sskdf_expected)
  471. },
  472. {
  473. OSSL_SELF_TEST_DESC_KDF_X963KDF,
  474. OSSL_KDF_NAME_X963KDF,
  475. x963kdf_params,
  476. ITM(x963kdf_expected)
  477. },
  478. {
  479. OSSL_SELF_TEST_DESC_KDF_X942KDF,
  480. OSSL_KDF_NAME_X942KDF_ASN1,
  481. x942kdf_params,
  482. ITM(x942kdf_expected)
  483. },
  484. };
  485. /*-
  486. * DRBG test vectors are a small subset of
  487. * https://csrc.nist.rip/groups/STM/cavp/documents/drbg/drbgtestvectors.zip
  488. * Using the folder drbgvectors_pr_true
  489. * Generated for CAVS 14.3.
  490. */
  491. /*
  492. * Hash_DRBG.rsp
  493. *
  494. * [SHA-256]
  495. * [PredictionResistance = True]
  496. * [EntropyInputLen = 256]
  497. * [NonceLen = 128]
  498. * [PersonalizationStringLen = 256]
  499. * [AdditionalInputLen = 256]
  500. * [ReturnedBitsLen = 1024]
  501. *
  502. * COUNT = 14
  503. */
  504. static const unsigned char drbg_hash_sha256_pr_entropyin[] = {
  505. 0x06, 0x6d, 0xc8, 0xce, 0x75, 0xb2, 0x89, 0x66, 0xa6, 0x85, 0x16, 0x3f,
  506. 0xe2, 0xa4, 0xd4, 0x27, 0xfb, 0xdb, 0x61, 0x66, 0x50, 0x61, 0x6b, 0xa2,
  507. 0x82, 0xfc, 0x33, 0x2b, 0x4e, 0x6f, 0x12, 0x20
  508. };
  509. static const unsigned char drbg_hash_sha256_pr_nonce[] = {
  510. 0x55, 0x9f, 0x7c, 0x64, 0x89, 0x70, 0x83, 0xec, 0x2d, 0x73, 0x70, 0xd9,
  511. 0xf0, 0xe5, 0x07, 0x1f
  512. };
  513. static const unsigned char drbg_hash_sha256_pr_persstr[] = {
  514. 0x88, 0x6f, 0x54, 0x9a, 0xad, 0x1a, 0xc6, 0x3d, 0x18, 0xcb, 0xcc, 0x66,
  515. 0x85, 0xda, 0xa2, 0xc2, 0xf7, 0x9e, 0xb0, 0x89, 0x4c, 0xb4, 0xae, 0xf1,
  516. 0xac, 0x54, 0x4f, 0xce, 0x57, 0xf1, 0x5e, 0x11
  517. };
  518. static const unsigned char drbg_hash_sha256_pr_entropyinpr0[] = {
  519. 0xff, 0x80, 0xb7, 0xd2, 0x6a, 0x05, 0xbc, 0x8a, 0x7a, 0xbe, 0x53, 0x28,
  520. 0x6b, 0x0e, 0xeb, 0x73, 0x3b, 0x71, 0x5a, 0x20, 0x5b, 0xfa, 0x4f, 0xf6,
  521. 0x37, 0x03, 0xde, 0xad, 0xb6, 0xea, 0x0e, 0xf4
  522. };
  523. static const unsigned char drbg_hash_sha256_pr_entropyinpr1[] = {
  524. 0xc7, 0x38, 0x32, 0x53, 0x46, 0x81, 0xed, 0xe3, 0x7e, 0x03, 0x84, 0x6d,
  525. 0x3c, 0x84, 0x17, 0x67, 0x29, 0x7d, 0x24, 0x6c, 0x68, 0x92, 0x41, 0xd2,
  526. 0xe7, 0x75, 0xbe, 0x7e, 0xc9, 0x96, 0x29, 0x3d
  527. };
  528. static const unsigned char drbg_hash_sha256_pr_addin0[] = {
  529. 0xb7, 0x21, 0x5f, 0x14, 0xac, 0x7b, 0xaf, 0xd0, 0xa9, 0x17, 0x72, 0xba,
  530. 0x22, 0xf7, 0x19, 0xaf, 0xbd, 0x20, 0xb3, 0x11, 0x63, 0x6c, 0x2b, 0x1e,
  531. 0x83, 0xe4, 0xa8, 0x23, 0x35, 0x3f, 0xc6, 0xea
  532. };
  533. static const unsigned char drbg_hash_sha256_pr_addin1[] = {
  534. 0xce, 0xd3, 0x1f, 0x7e, 0x0d, 0xae, 0x5b, 0xb5, 0xc0, 0x43, 0xe2, 0x46,
  535. 0xb2, 0x94, 0x73, 0xe2, 0xfd, 0x39, 0x51, 0x2e, 0xad, 0x45, 0x69, 0xee,
  536. 0xe3, 0xe3, 0x80, 0x33, 0x14, 0xab, 0xa7, 0xa3
  537. };
  538. static const unsigned char drbg_hash_sha256_pr_expected[] = {
  539. 0x60, 0xc2, 0x34, 0xcf, 0xaf, 0xb4, 0x68, 0x03, 0x3b, 0xf1, 0x95, 0xe5,
  540. 0x78, 0xce, 0x26, 0x6e, 0x14, 0x65, 0x32, 0x6a, 0x96, 0xa9, 0xe0, 0x3f,
  541. 0x8b, 0x89, 0x36, 0x70, 0xef, 0x62, 0x75, 0x4d, 0x5e, 0x80, 0xd5, 0x53,
  542. 0xa1, 0xf8, 0x49, 0x50, 0x20, 0x8b, 0x93, 0x43, 0x07, 0x9f, 0x2e, 0xf8,
  543. 0x56, 0xe9, 0xc5, 0x70, 0x61, 0x85, 0x97, 0xb5, 0xdc, 0x82, 0xa2, 0xda,
  544. 0xea, 0xa3, 0xfd, 0x9b, 0x2f, 0xd2, 0xa0, 0xd7, 0x1b, 0xc6, 0x29, 0x35,
  545. 0xcc, 0xb8, 0x3d, 0xa0, 0x67, 0x98, 0x05, 0xa0, 0xe3, 0x1e, 0xfe, 0xe4,
  546. 0xf0, 0xe5, 0x13, 0xb0, 0x83, 0x17, 0xfa, 0xca, 0x93, 0x5e, 0x38, 0x29,
  547. 0x48, 0xd2, 0x72, 0xdb, 0x76, 0x3e, 0x6d, 0xf3, 0x25, 0x10, 0xff, 0x1b,
  548. 0x99, 0xff, 0xf8, 0xc6, 0x0e, 0xb0, 0xdd, 0x29, 0x2e, 0xbc, 0xbb, 0xc8,
  549. 0x0a, 0x01, 0x6e, 0xd3, 0xb0, 0x0e, 0x4e, 0xab
  550. };
  551. /*
  552. * CTR_DRBG.rsp
  553. *
  554. * [AES-128 use df]
  555. * [PredictionResistance = True]
  556. * [EntropyInputLen = 128]
  557. * [NonceLen = 64]
  558. * [PersonalizationStringLen = 128]
  559. * [AdditionalInputLen = 128]
  560. * [ReturnedBitsLen = 512]
  561. *
  562. * COUNT = 0
  563. */
  564. static const unsigned char drbg_ctr_aes128_pr_df_entropyin[] = {
  565. 0x92, 0x89, 0x8f, 0x31, 0xfa, 0x1c, 0xff, 0x6d, 0x18, 0x2f, 0x26, 0x06,
  566. 0x43, 0xdf, 0xf8, 0x18
  567. };
  568. static const unsigned char drbg_ctr_aes128_pr_df_nonce[] = {
  569. 0xc2, 0xa4, 0xd9, 0x72, 0xc3, 0xb9, 0xb6, 0x97
  570. };
  571. static const unsigned char drbg_ctr_aes128_pr_df_persstr[] = {
  572. 0xea, 0x65, 0xee, 0x60, 0x26, 0x4e, 0x7e, 0xb6, 0x0e, 0x82, 0x68, 0xc4,
  573. 0x37, 0x3c, 0x5c, 0x0b
  574. };
  575. static const unsigned char drbg_ctr_aes128_pr_df_entropyinpr0[] = {
  576. 0x20, 0x72, 0x8a, 0x06, 0xf8, 0x6f, 0x8d, 0xd4, 0x41, 0xe2, 0x72, 0xb7,
  577. 0xc4, 0x2c, 0xe8, 0x10
  578. };
  579. static const unsigned char drbg_ctr_aes128_pr_df_entropyinpr1[] = {
  580. 0x3d, 0xb0, 0xf0, 0x94, 0xf3, 0x05, 0x50, 0x33, 0x17, 0x86, 0x3e, 0x22,
  581. 0x08, 0xf7, 0xa5, 0x01
  582. };
  583. static const unsigned char drbg_ctr_aes128_pr_df_addin0[] = {
  584. 0x1a, 0x40, 0xfa, 0xe3, 0xcc, 0x6c, 0x7c, 0xa0, 0xf8, 0xda, 0xba, 0x59,
  585. 0x23, 0x6d, 0xad, 0x1d
  586. };
  587. static const unsigned char drbg_ctr_aes128_pr_df_addin1[] = {
  588. 0x9f, 0x72, 0x76, 0x6c, 0xc7, 0x46, 0xe5, 0xed, 0x2e, 0x53, 0x20, 0x12,
  589. 0xbc, 0x59, 0x31, 0x8c
  590. };
  591. static const unsigned char drbg_ctr_aes128_pr_df_expected[] = {
  592. 0x5a, 0x35, 0x39, 0x87, 0x0f, 0x4d, 0x22, 0xa4, 0x09, 0x24, 0xee, 0x71,
  593. 0xc9, 0x6f, 0xac, 0x72, 0x0a, 0xd6, 0xf0, 0x88, 0x82, 0xd0, 0x83, 0x28,
  594. 0x73, 0xec, 0x3f, 0x93, 0xd8, 0xab, 0x45, 0x23, 0xf0, 0x7e, 0xac, 0x45,
  595. 0x14, 0x5e, 0x93, 0x9f, 0xb1, 0xd6, 0x76, 0x43, 0x3d, 0xb6, 0xe8, 0x08,
  596. 0x88, 0xf6, 0xda, 0x89, 0x08, 0x77, 0x42, 0xfe, 0x1a, 0xf4, 0x3f, 0xc4,
  597. 0x23, 0xc5, 0x1f, 0x68
  598. };
  599. /*
  600. * HMAC_DRBG.rsp
  601. *
  602. * [SHA-1]
  603. * [PredictionResistance = True]
  604. * [EntropyInputLen = 128]
  605. * [NonceLen = 64]
  606. * [PersonalizationStringLen = 128]
  607. * [AdditionalInputLen = 128]
  608. * [ReturnedBitsLen = 640]
  609. *
  610. * COUNT = 0
  611. */
  612. static const unsigned char drbg_hmac_sha1_pr_entropyin[] = {
  613. 0x68, 0x0f, 0xac, 0xe9, 0x0d, 0x7b, 0xca, 0x21, 0xd4, 0xa0, 0xed, 0xb7,
  614. 0x79, 0x9e, 0xe5, 0xd8
  615. };
  616. static const unsigned char drbg_hmac_sha1_pr_nonce[] = {
  617. 0xb7, 0xbe, 0x9e, 0xed, 0xdd, 0x0e, 0x3b, 0x4b
  618. };
  619. static const unsigned char drbg_hmac_sha1_pr_persstr[] = {
  620. 0xf5, 0x8c, 0x40, 0xae, 0x70, 0xf7, 0xa5, 0x56, 0x48, 0xa9, 0x31, 0xa0,
  621. 0xa9, 0x31, 0x3d, 0xd7
  622. };
  623. static const unsigned char drbg_hmac_sha1_pr_entropyinpr0[] = {
  624. 0x7c, 0xaf, 0xe2, 0x31, 0x63, 0x0a, 0xa9, 0x5a, 0x74, 0x2c, 0x4e, 0x5f,
  625. 0x5f, 0x22, 0xc6, 0xa4
  626. };
  627. static const unsigned char drbg_hmac_sha1_pr_entropyinpr1[] = {
  628. 0x1c, 0x0d, 0x77, 0x92, 0x89, 0x88, 0x27, 0x94, 0x8a, 0x58, 0x9f, 0x82,
  629. 0x2d, 0x1a, 0xf7, 0xa6
  630. };
  631. static const unsigned char drbg_hmac_sha1_pr_addin0[] = {
  632. 0xdc, 0x36, 0x63, 0xf0, 0x62, 0x78, 0x9c, 0xd1, 0x5c, 0xbb, 0x20, 0xc3,
  633. 0xc1, 0x8c, 0xd9, 0xd7
  634. };
  635. static const unsigned char drbg_hmac_sha1_pr_addin1[] = {
  636. 0xfe, 0x85, 0xb0, 0xab, 0x14, 0xc6, 0x96, 0xe6, 0x9c, 0x24, 0xe7, 0xb5,
  637. 0xa1, 0x37, 0x12, 0x0c
  638. };
  639. static const unsigned char drbg_hmac_sha1_pr_expected[] = {
  640. 0x68, 0x00, 0x4b, 0x3a, 0x28, 0xf7, 0xf0, 0x1c, 0xf9, 0xe9, 0xb5, 0x71,
  641. 0x20, 0x79, 0xef, 0x80, 0x87, 0x1b, 0x08, 0xb9, 0xa9, 0x1b, 0xcd, 0x2b,
  642. 0x9f, 0x09, 0x4d, 0xa4, 0x84, 0x80, 0xb3, 0x4c, 0xaf, 0xd5, 0x59, 0x6b,
  643. 0x0c, 0x0a, 0x48, 0xe1, 0x48, 0xda, 0xbc, 0x6f, 0x77, 0xb8, 0xff, 0xaf,
  644. 0x18, 0x70, 0x28, 0xe1, 0x04, 0x13, 0x7a, 0x4f, 0xeb, 0x1c, 0x72, 0xb0,
  645. 0xc4, 0x4f, 0xe8, 0xb1, 0xaf, 0xab, 0xa5, 0xbc, 0xfd, 0x86, 0x67, 0xf2,
  646. 0xf5, 0x5b, 0x46, 0x06, 0x63, 0x2e, 0x3c, 0xbc
  647. };
  648. static const ST_KAT_DRBG st_kat_drbg_tests[] =
  649. {
  650. {
  651. OSSL_SELF_TEST_DESC_DRBG_HASH,
  652. "HASH-DRBG", "digest", "SHA256",
  653. ITM(drbg_hash_sha256_pr_entropyin),
  654. ITM(drbg_hash_sha256_pr_nonce),
  655. ITM(drbg_hash_sha256_pr_persstr),
  656. ITM(drbg_hash_sha256_pr_entropyinpr0),
  657. ITM(drbg_hash_sha256_pr_entropyinpr1),
  658. ITM(drbg_hash_sha256_pr_addin0),
  659. ITM(drbg_hash_sha256_pr_addin1),
  660. ITM(drbg_hash_sha256_pr_expected)
  661. },
  662. {
  663. OSSL_SELF_TEST_DESC_DRBG_CTR,
  664. "CTR-DRBG", "cipher", "AES-128-CTR",
  665. ITM(drbg_ctr_aes128_pr_df_entropyin),
  666. ITM(drbg_ctr_aes128_pr_df_nonce),
  667. ITM(drbg_ctr_aes128_pr_df_persstr),
  668. ITM(drbg_ctr_aes128_pr_df_entropyinpr0),
  669. ITM(drbg_ctr_aes128_pr_df_entropyinpr1),
  670. ITM(drbg_ctr_aes128_pr_df_addin0),
  671. ITM(drbg_ctr_aes128_pr_df_addin1),
  672. ITM(drbg_ctr_aes128_pr_df_expected)
  673. },
  674. {
  675. OSSL_SELF_TEST_DESC_DRBG_HMAC,
  676. "HMAC-DRBG", "digest", "SHA1",
  677. ITM(drbg_hmac_sha1_pr_entropyin),
  678. ITM(drbg_hmac_sha1_pr_nonce),
  679. ITM(drbg_hmac_sha1_pr_persstr),
  680. ITM(drbg_hmac_sha1_pr_entropyinpr0),
  681. ITM(drbg_hmac_sha1_pr_entropyinpr1),
  682. ITM(drbg_hmac_sha1_pr_addin0),
  683. ITM(drbg_hmac_sha1_pr_addin1),
  684. ITM(drbg_hmac_sha1_pr_expected)
  685. }
  686. };
  687. /* KEY EXCHANGE TEST DATA */
  688. #ifndef OPENSSL_NO_DH
  689. /* DH KAT */
  690. static const unsigned char dh_p[] = {
  691. 0xdc, 0xca, 0x15, 0x11, 0xb2, 0x31, 0x32, 0x25,
  692. 0xf5, 0x21, 0x16, 0xe1, 0x54, 0x27, 0x89, 0xe0,
  693. 0x01, 0xf0, 0x42, 0x5b, 0xcc, 0xc7, 0xf3, 0x66,
  694. 0xf7, 0x40, 0x64, 0x07, 0xf1, 0xc9, 0xfa, 0x8b,
  695. 0xe6, 0x10, 0xf1, 0x77, 0x8b, 0xb1, 0x70, 0xbe,
  696. 0x39, 0xdb, 0xb7, 0x6f, 0x85, 0xbf, 0x24, 0xce,
  697. 0x68, 0x80, 0xad, 0xb7, 0x62, 0x9f, 0x7c, 0x6d,
  698. 0x01, 0x5e, 0x61, 0xd4, 0x3f, 0xa3, 0xee, 0x4d,
  699. 0xe1, 0x85, 0xf2, 0xcf, 0xd0, 0x41, 0xff, 0xde,
  700. 0x9d, 0x41, 0x84, 0x07, 0xe1, 0x51, 0x38, 0xbb,
  701. 0x02, 0x1d, 0xae, 0xb3, 0x5f, 0x76, 0x2d, 0x17,
  702. 0x82, 0xac, 0xc6, 0x58, 0xd3, 0x2b, 0xd4, 0xb0,
  703. 0x23, 0x2c, 0x92, 0x7d, 0xd3, 0x8f, 0xa0, 0x97,
  704. 0xb3, 0xd1, 0x85, 0x9f, 0xa8, 0xac, 0xaf, 0xb9,
  705. 0x8f, 0x06, 0x66, 0x08, 0xfc, 0x64, 0x4e, 0xc7,
  706. 0xdd, 0xb6, 0xf0, 0x85, 0x99, 0xf9, 0x2a, 0xc1,
  707. 0xb5, 0x98, 0x25, 0xda, 0x84, 0x32, 0x07, 0x7d,
  708. 0xef, 0x69, 0x56, 0x46, 0x06, 0x3c, 0x20, 0x82,
  709. 0x3c, 0x95, 0x07, 0xab, 0x6f, 0x01, 0x76, 0xd4,
  710. 0x73, 0x0d, 0x99, 0x0d, 0xbb, 0xe6, 0x36, 0x1c,
  711. 0xd8, 0xb2, 0xb9, 0x4d, 0x3d, 0x2f, 0x32, 0x9b,
  712. 0x82, 0x09, 0x9b, 0xd6, 0x61, 0xf4, 0x29, 0x50,
  713. 0xf4, 0x03, 0xdf, 0x3e, 0xde, 0x62, 0xa3, 0x31,
  714. 0x88, 0xb0, 0x27, 0x98, 0xba, 0x82, 0x3f, 0x44,
  715. 0xb9, 0x46, 0xfe, 0x9d, 0xf6, 0x77, 0xa0, 0xc5,
  716. 0xa1, 0x23, 0x8e, 0xaa, 0x97, 0xb7, 0x0f, 0x80,
  717. 0xda, 0x8c, 0xac, 0x88, 0xe0, 0x92, 0xb1, 0x12,
  718. 0x70, 0x60, 0xff, 0xbf, 0x45, 0x57, 0x99, 0x94,
  719. 0x01, 0x1d, 0xc2, 0xfa, 0xa5, 0xe7, 0xf6, 0xc7,
  720. 0x62, 0x45, 0xe1, 0xcc, 0x31, 0x22, 0x31, 0xc1,
  721. 0x7d, 0x1c, 0xa6, 0xb1, 0x90, 0x07, 0xef, 0x0d,
  722. 0xb9, 0x9f, 0x9c, 0xb6, 0x0e, 0x1d, 0x5f, 0x69
  723. };
  724. static const unsigned char dh_q[] = {
  725. 0x89, 0x8b, 0x22, 0x67, 0x17, 0xef, 0x03, 0x9e,
  726. 0x60, 0x3e, 0x82, 0xe5, 0xc7, 0xaf, 0xe4, 0x83,
  727. 0x74, 0xac, 0x5f, 0x62, 0x5c, 0x54, 0xf1, 0xea,
  728. 0x11, 0xac, 0xb5, 0x7d
  729. };
  730. static const unsigned char dh_g[] = {
  731. 0x5e, 0xf7, 0xb8, 0x8f, 0x2d, 0xf6, 0x01, 0x39,
  732. 0x35, 0x1d, 0xfb, 0xfe, 0x12, 0x66, 0x80, 0x5f,
  733. 0xdf, 0x35, 0x6c, 0xdf, 0xd1, 0x3a, 0x4d, 0xa0,
  734. 0x05, 0x0c, 0x7e, 0xde, 0x24, 0x6d, 0xf5, 0x9f,
  735. 0x6a, 0xbf, 0x96, 0xad, 0xe5, 0xf2, 0xb2, 0x8f,
  736. 0xfe, 0x88, 0xd6, 0xbc, 0xe7, 0xf7, 0x89, 0x4a,
  737. 0x3d, 0x53, 0x5f, 0xc8, 0x21, 0x26, 0xdd, 0xd4,
  738. 0x24, 0x87, 0x2e, 0x16, 0xb8, 0x38, 0xdf, 0x8c,
  739. 0x51, 0xe9, 0x01, 0x6f, 0x88, 0x9c, 0x7c, 0x20,
  740. 0x3e, 0x98, 0xa8, 0xb6, 0x31, 0xf9, 0xc7, 0x25,
  741. 0x63, 0xd3, 0x8a, 0x49, 0x58, 0x9a, 0x07, 0x53,
  742. 0xd3, 0x58, 0xe7, 0x83, 0x31, 0x8c, 0xef, 0xd9,
  743. 0x67, 0x7c, 0x7b, 0x2d, 0xbb, 0x77, 0xd6, 0xdc,
  744. 0xe2, 0xa1, 0x96, 0x37, 0x95, 0xca, 0x64, 0xb9,
  745. 0x2d, 0x1c, 0x9a, 0xac, 0x6d, 0x0e, 0x8d, 0x43,
  746. 0x1d, 0xe5, 0xe5, 0x00, 0x60, 0xdf, 0xf7, 0x86,
  747. 0x89, 0xc9, 0xec, 0xa1, 0xc1, 0x24, 0x8c, 0x16,
  748. 0xed, 0x09, 0xc7, 0xad, 0x41, 0x2a, 0x17, 0x40,
  749. 0x6d, 0x2b, 0x52, 0x5a, 0xa1, 0xca, 0xbb, 0x23,
  750. 0x7b, 0x97, 0x34, 0xec, 0x7b, 0x8c, 0xe3, 0xfa,
  751. 0xe0, 0x2f, 0x29, 0xc5, 0xef, 0xed, 0x30, 0xd6,
  752. 0x91, 0x87, 0xda, 0x10, 0x9c, 0x2c, 0x9f, 0xe2,
  753. 0xaa, 0xdb, 0xb0, 0xc2, 0x2a, 0xf5, 0x4c, 0x61,
  754. 0x66, 0x55, 0x00, 0x0c, 0x43, 0x1c, 0x6b, 0x4a,
  755. 0x37, 0x97, 0x63, 0xb0, 0xa9, 0x16, 0x58, 0xef,
  756. 0xc8, 0x4e, 0x8b, 0x06, 0x35, 0x8c, 0x8b, 0x4f,
  757. 0x21, 0x37, 0x10, 0xfd, 0x10, 0x17, 0x2c, 0xf3,
  758. 0x9b, 0x83, 0x0c, 0x2d, 0xd8, 0x4a, 0x0c, 0x8a,
  759. 0xb8, 0x25, 0x16, 0xec, 0xab, 0x99, 0x5f, 0xa4,
  760. 0x21, 0x5e, 0x02, 0x3e, 0x4e, 0xcf, 0x80, 0x74,
  761. 0xc3, 0x9d, 0x6c, 0x88, 0xb7, 0x0d, 0x1e, 0xe4,
  762. 0xe9, 0x6f, 0xdc, 0x20, 0xea, 0x11, 0x5c, 0x32
  763. };
  764. static const unsigned char dh_priv[] = {
  765. 0x14, 0x33, 0xe0, 0xb5, 0xa9, 0x17, 0xb6, 0x0a,
  766. 0x30, 0x23, 0xf2, 0xf8, 0xaa, 0x2c, 0x2d, 0x70,
  767. 0xd2, 0x96, 0x8a, 0xba, 0x9a, 0xea, 0xc8, 0x15,
  768. 0x40, 0xb8, 0xfc, 0xe6
  769. };
  770. static const unsigned char dh_pub[] = {
  771. 0x95, 0xdd, 0x33, 0x8d, 0x29, 0xe5, 0x71, 0x04,
  772. 0x92, 0xb9, 0x18, 0x31, 0x7b, 0x72, 0xa3, 0x69,
  773. 0x36, 0xe1, 0x95, 0x1a, 0x2e, 0xe5, 0xa5, 0x59,
  774. 0x16, 0x99, 0xc0, 0x48, 0x6d, 0x0d, 0x4f, 0x9b,
  775. 0xdd, 0x6d, 0x5a, 0x3f, 0x6b, 0x98, 0x89, 0x0c,
  776. 0x62, 0xb3, 0x76, 0x52, 0xd3, 0x6e, 0x71, 0x21,
  777. 0x11, 0xe6, 0x8a, 0x73, 0x55, 0x37, 0x25, 0x06,
  778. 0x99, 0xef, 0xe3, 0x30, 0x53, 0x73, 0x91, 0xfb,
  779. 0xc2, 0xc5, 0x48, 0xbc, 0x5a, 0xc3, 0xe5, 0xb2,
  780. 0x33, 0x86, 0xc3, 0xee, 0xf5, 0xeb, 0x43, 0xc0,
  781. 0x99, 0xd7, 0x0a, 0x52, 0x02, 0x68, 0x7e, 0x83,
  782. 0x96, 0x42, 0x48, 0xfc, 0xa9, 0x1f, 0x40, 0x90,
  783. 0x8e, 0x8f, 0xb3, 0x31, 0x93, 0x15, 0xf6, 0xd2,
  784. 0x60, 0x6d, 0x7f, 0x7c, 0xd5, 0x2c, 0xc6, 0xe7,
  785. 0xc5, 0x84, 0x3a, 0xfb, 0x22, 0x51, 0x9c, 0xf0,
  786. 0xf0, 0xf9, 0xd3, 0xa0, 0xa4, 0xe8, 0xc8, 0x88,
  787. 0x99, 0xef, 0xed, 0xe7, 0x36, 0x43, 0x51, 0xfb,
  788. 0x6a, 0x36, 0x3e, 0xe7, 0x17, 0xe5, 0x44, 0x5a,
  789. 0xda, 0xb4, 0xc9, 0x31, 0xa6, 0x48, 0x39, 0x97,
  790. 0xb8, 0x7d, 0xad, 0x83, 0x67, 0x7e, 0x4d, 0x1d,
  791. 0x3a, 0x77, 0x75, 0xe0, 0xf6, 0xd0, 0x0f, 0xdf,
  792. 0x73, 0xc7, 0xad, 0x80, 0x1e, 0x66, 0x5a, 0x0e,
  793. 0x5a, 0x79, 0x6d, 0x0a, 0x03, 0x80, 0xa1, 0x9f,
  794. 0xa1, 0x82, 0xef, 0xc8, 0xa0, 0x4f, 0x5e, 0x4d,
  795. 0xb9, 0x0d, 0x1a, 0x86, 0x37, 0xf9, 0x5d, 0xb1,
  796. 0x64, 0x36, 0xbd, 0xc8, 0xf3, 0xfc, 0x09, 0x6c,
  797. 0x4f, 0xf7, 0xf2, 0x34, 0xbe, 0x8f, 0xef, 0x47,
  798. 0x9a, 0xc4, 0xb0, 0xdc, 0x4b, 0x77, 0x26, 0x3e,
  799. 0x07, 0xd9, 0x95, 0x9d, 0xe0, 0xf1, 0xbf, 0x3f,
  800. 0x0a, 0xe3, 0xd9, 0xd5, 0x0e, 0x4b, 0x89, 0xc9,
  801. 0x9e, 0x3e, 0xa1, 0x21, 0x73, 0x43, 0xdd, 0x8c,
  802. 0x65, 0x81, 0xac, 0xc4, 0x95, 0x9c, 0x91, 0xd3
  803. };
  804. static const unsigned char dh_peer_pub[] = {
  805. 0x1f, 0xc1, 0xda, 0x34, 0x1d, 0x1a, 0x84, 0x6a,
  806. 0x96, 0xb7, 0xbe, 0x24, 0x34, 0x0f, 0x87, 0x7d,
  807. 0xd0, 0x10, 0xaa, 0x03, 0x56, 0xd5, 0xad, 0x58,
  808. 0xaa, 0xe9, 0xc7, 0xb0, 0x8f, 0x74, 0x9a, 0x32,
  809. 0x23, 0x51, 0x10, 0xb5, 0xd8, 0x8e, 0xb5, 0xdb,
  810. 0xfa, 0x97, 0x8d, 0x27, 0xec, 0xc5, 0x30, 0xf0,
  811. 0x2d, 0x31, 0x14, 0x00, 0x5b, 0x64, 0xb1, 0xc0,
  812. 0xe0, 0x24, 0xcb, 0x8a, 0xe2, 0x16, 0x98, 0xbc,
  813. 0xa9, 0xe6, 0x0d, 0x42, 0x80, 0x86, 0x22, 0xf1,
  814. 0x81, 0xc5, 0x6e, 0x1d, 0xe7, 0xa9, 0x6e, 0x6e,
  815. 0xfe, 0xe9, 0xd6, 0x65, 0x67, 0xe9, 0x1b, 0x97,
  816. 0x70, 0x42, 0xc7, 0xe3, 0xd0, 0x44, 0x8f, 0x05,
  817. 0xfb, 0x77, 0xf5, 0x22, 0xb9, 0xbf, 0xc8, 0xd3,
  818. 0x3c, 0xc3, 0xc3, 0x1e, 0xd3, 0xb3, 0x1f, 0x0f,
  819. 0xec, 0xb6, 0xdb, 0x4f, 0x6e, 0xa3, 0x11, 0xe7,
  820. 0x7a, 0xfd, 0xbc, 0xd4, 0x7a, 0xee, 0x1b, 0xb1,
  821. 0x50, 0xf2, 0x16, 0x87, 0x35, 0x78, 0xfb, 0x96,
  822. 0x46, 0x8e, 0x8f, 0x9f, 0x3d, 0xe8, 0xef, 0xbf,
  823. 0xce, 0x75, 0x62, 0x4b, 0x1d, 0xf0, 0x53, 0x22,
  824. 0xa3, 0x4f, 0x14, 0x63, 0xe8, 0x39, 0xe8, 0x98,
  825. 0x4c, 0x4a, 0xd0, 0xa9, 0x6e, 0x1a, 0xc8, 0x42,
  826. 0xe5, 0x31, 0x8c, 0xc2, 0x3c, 0x06, 0x2a, 0x8c,
  827. 0xa1, 0x71, 0xb8, 0xd5, 0x75, 0x98, 0x0d, 0xde,
  828. 0x7f, 0xc5, 0x6f, 0x15, 0x36, 0x52, 0x38, 0x20,
  829. 0xd4, 0x31, 0x92, 0xbf, 0xd5, 0x1e, 0x8e, 0x22,
  830. 0x89, 0x78, 0xac, 0xa5, 0xb9, 0x44, 0x72, 0xf3,
  831. 0x39, 0xca, 0xeb, 0x99, 0x31, 0xb4, 0x2b, 0xe3,
  832. 0x01, 0x26, 0x8b, 0xc9, 0x97, 0x89, 0xc9, 0xb2,
  833. 0x55, 0x71, 0xc3, 0xc0, 0xe4, 0xcb, 0x3f, 0x00,
  834. 0x7f, 0x1a, 0x51, 0x1c, 0xbb, 0x53, 0xc8, 0x51,
  835. 0x9c, 0xdd, 0x13, 0x02, 0xab, 0xca, 0x6c, 0x0f,
  836. 0x34, 0xf9, 0x67, 0x39, 0xf1, 0x7f, 0xf4, 0x8b
  837. };
  838. static const unsigned char dh_secret_expected[] = {
  839. 0x08, 0xff, 0x33, 0xbb, 0x2e, 0xcf, 0xf4, 0x9a,
  840. 0x7d, 0x4a, 0x79, 0x12, 0xae, 0xb1, 0xbb, 0x6a,
  841. 0xb5, 0x11, 0x64, 0x1b, 0x4a, 0x76, 0x77, 0x0c,
  842. 0x8c, 0xc1, 0xbc, 0xc2, 0x33, 0x34, 0x3d, 0xfe,
  843. 0x70, 0x0d, 0x11, 0x81, 0x3d, 0x2c, 0x9e, 0xd2,
  844. 0x3b, 0x21, 0x1c, 0xa9, 0xe8, 0x78, 0x69, 0x21,
  845. 0xed, 0xca, 0x28, 0x3c, 0x68, 0xb1, 0x61, 0x53,
  846. 0xfa, 0x01, 0xe9, 0x1a, 0xb8, 0x2c, 0x90, 0xdd,
  847. 0xab, 0x4a, 0x95, 0x81, 0x67, 0x70, 0xa9, 0x87,
  848. 0x10, 0xe1, 0x4c, 0x92, 0xab, 0x83, 0xb6, 0xe4,
  849. 0x6e, 0x1e, 0x42, 0x6e, 0xe8, 0x52, 0x43, 0x0d,
  850. 0x61, 0x87, 0xda, 0xa3, 0x72, 0x0a, 0x6b, 0xcd,
  851. 0x73, 0x23, 0x5c, 0x6b, 0x0f, 0x94, 0x1f, 0x33,
  852. 0x64, 0xf5, 0x04, 0x20, 0x55, 0x1a, 0x4b, 0xfe,
  853. 0xaf, 0xe2, 0xbc, 0x43, 0x85, 0x05, 0xa5, 0x9a,
  854. 0x4a, 0x40, 0xda, 0xca, 0x7a, 0x89, 0x5a, 0x73,
  855. 0xdb, 0x57, 0x5c, 0x74, 0xc1, 0x3a, 0x23, 0xad,
  856. 0x88, 0x32, 0x95, 0x7d, 0x58, 0x2d, 0x38, 0xf0,
  857. 0xa6, 0x16, 0x5f, 0xb0, 0xd7, 0xe9, 0xb8, 0x79,
  858. 0x9e, 0x42, 0xfd, 0x32, 0x20, 0xe3, 0x32, 0xe9,
  859. 0x81, 0x85, 0xa0, 0xc9, 0x42, 0x97, 0x57, 0xb2,
  860. 0xd0, 0xd0, 0x2c, 0x17, 0xdb, 0xaa, 0x1f, 0xf6,
  861. 0xed, 0x93, 0xd7, 0xe7, 0x3e, 0x24, 0x1e, 0xae,
  862. 0xd9, 0x0c, 0xaf, 0x39, 0x4d, 0x2b, 0xc6, 0x57,
  863. 0x0f, 0x18, 0xc8, 0x1f, 0x2b, 0xe5, 0xd0, 0x1a,
  864. 0x2c, 0xa9, 0x9f, 0xf1, 0x42, 0xb5, 0xd9, 0x63,
  865. 0xf9, 0xf5, 0x00, 0x32, 0x5e, 0x75, 0x56, 0xf9,
  866. 0x58, 0x49, 0xb3, 0xff, 0xc7, 0x47, 0x94, 0x86,
  867. 0xbe, 0x1d, 0x45, 0x96, 0xa3, 0x10, 0x6b, 0xd5,
  868. 0xcb, 0x4f, 0x61, 0xc5, 0x7e, 0xc5, 0xf1, 0x00,
  869. 0xfb, 0x7a, 0x0c, 0x82, 0xa1, 0x0b, 0x82, 0x52,
  870. 0x6a, 0x97, 0xd1, 0xd9, 0x7d, 0x98, 0xea, 0xf6
  871. };
  872. static const ST_KAT_PARAM dh_group[] = {
  873. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_FFC_P, dh_p),
  874. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_FFC_Q, dh_q),
  875. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_FFC_G, dh_g),
  876. ST_KAT_PARAM_END()
  877. };
  878. /* The host's private key */
  879. static const ST_KAT_PARAM dh_host_key[] = {
  880. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_PUB_KEY, dh_pub),
  881. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_PRIV_KEY, dh_priv),
  882. ST_KAT_PARAM_END()
  883. };
  884. /* The peer's public key */
  885. static const ST_KAT_PARAM dh_peer_key[] = {
  886. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_PUB_KEY, dh_peer_pub),
  887. ST_KAT_PARAM_END()
  888. };
  889. #endif /* OPENSSL_NO_DH */
  890. #ifndef OPENSSL_NO_EC
  891. static const char ecdh_curve_name[] = "prime256v1";
  892. static const unsigned char ecdh_privd[] = {
  893. 0x33, 0xd0, 0x43, 0x83, 0xa9, 0x89, 0x56, 0x03,
  894. 0xd2, 0xd7, 0xfe, 0x6b, 0x01, 0x6f, 0xe4, 0x59,
  895. 0xcc, 0x0d, 0x9a, 0x24, 0x6c, 0x86, 0x1b, 0x2e,
  896. 0xdc, 0x4b, 0x4d, 0x35, 0x43, 0xe1, 0x1b, 0xad
  897. };
  898. static const unsigned char ecdh_pub[] = {
  899. 0x04,
  900. 0x1b, 0x93, 0x67, 0x55, 0x1c, 0x55, 0x9f, 0x63,
  901. 0xd1, 0x22, 0xa4, 0xd8, 0xd1, 0x0a, 0x60, 0x6d,
  902. 0x02, 0xa5, 0x77, 0x57, 0xc8, 0xa3, 0x47, 0x73,
  903. 0x3a, 0x6a, 0x08, 0x28, 0x39, 0xbd, 0xc9, 0xd2,
  904. 0x80, 0xec, 0xe9, 0xa7, 0x08, 0x29, 0x71, 0x2f,
  905. 0xc9, 0x56, 0x82, 0xee, 0x9a, 0x85, 0x0f, 0x6d,
  906. 0x7f, 0x59, 0x5f, 0x8c, 0xd1, 0x96, 0x0b, 0xdf,
  907. 0x29, 0x3e, 0x49, 0x07, 0x88, 0x3f, 0x9a, 0x29
  908. };
  909. static const unsigned char ecdh_peer_pub[] = {
  910. 0x04,
  911. 0x1f, 0x72, 0xbd, 0x2a, 0x3e, 0xeb, 0x6c, 0x76,
  912. 0xe5, 0x5d, 0x69, 0x75, 0x24, 0xbf, 0x2f, 0x5b,
  913. 0x96, 0xb2, 0x91, 0x62, 0x06, 0x35, 0xcc, 0xb2,
  914. 0x4b, 0x31, 0x1b, 0x0c, 0x6f, 0x06, 0x9f, 0x86,
  915. 0xcf, 0xc8, 0xac, 0xd5, 0x4f, 0x4d, 0x77, 0xf3,
  916. 0x70, 0x4a, 0x8f, 0x04, 0x9a, 0xb1, 0x03, 0xc7,
  917. 0xeb, 0xd5, 0x94, 0x78, 0x61, 0xab, 0x78, 0x0c,
  918. 0x4a, 0x2d, 0x6b, 0xf3, 0x2f, 0x2e, 0x4a, 0xbc
  919. };
  920. static const ST_KAT_PARAM ecdh_group[] = {
  921. ST_KAT_PARAM_UTF8STRING(OSSL_PKEY_PARAM_GROUP_NAME, ecdh_curve_name),
  922. ST_KAT_PARAM_END()
  923. };
  924. static const ST_KAT_PARAM ecdh_host_key[] = {
  925. ST_KAT_PARAM_OCTET(OSSL_PKEY_PARAM_PUB_KEY, ecdh_pub),
  926. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_PRIV_KEY, ecdh_privd),
  927. ST_KAT_PARAM_END()
  928. };
  929. static const ST_KAT_PARAM ecdh_peer_key[] = {
  930. ST_KAT_PARAM_OCTET(OSSL_PKEY_PARAM_PUB_KEY, ecdh_peer_pub),
  931. ST_KAT_PARAM_END()
  932. };
  933. static const unsigned char ecdh_secret_expected[] = {
  934. 0x45, 0x2a, 0x2f, 0x0d, 0x24, 0xe6, 0x8d, 0xd0,
  935. 0xda, 0x59, 0x7b, 0x0c, 0xec, 0x9b, 0x4c, 0x38,
  936. 0x41, 0xdd, 0xce, 0xb3, 0xcc, 0xf1, 0x90, 0x8e,
  937. 0x30, 0xdb, 0x5b, 0x5f, 0x97, 0xea, 0xe0, 0xc2
  938. };
  939. #endif /* OPENSSL_NO_EC */
  940. #if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_EC)
  941. static const ST_KAT_KAS st_kat_kas_tests[] =
  942. {
  943. # ifndef OPENSSL_NO_DH
  944. {
  945. OSSL_SELF_TEST_DESC_KA_DH,
  946. "DH",
  947. dh_group,
  948. dh_host_key,
  949. dh_peer_key,
  950. ITM(dh_secret_expected)
  951. },
  952. # endif /* OPENSSL_NO_DH */
  953. # ifndef OPENSSL_NO_EC
  954. {
  955. OSSL_SELF_TEST_DESC_KA_ECDH,
  956. "EC",
  957. ecdh_group,
  958. ecdh_host_key,
  959. ecdh_peer_key,
  960. ITM(ecdh_secret_expected)
  961. },
  962. # endif /* OPENSSL_NO_EC */
  963. };
  964. #endif /* !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_EC) */
  965. /* RSA key data */
  966. static const unsigned char rsa_n[] = {
  967. 0xDB, 0x10, 0x1A, 0xC2, 0xA3, 0xF1, 0xDC, 0xFF,
  968. 0x13, 0x6B, 0xED, 0x44, 0xDF, 0xF0, 0x02, 0x6D,
  969. 0x13, 0xC7, 0x88, 0xDA, 0x70, 0x6B, 0x54, 0xF1,
  970. 0xE8, 0x27, 0xDC, 0xC3, 0x0F, 0x99, 0x6A, 0xFA,
  971. 0xC6, 0x67, 0xFF, 0x1D, 0x1E, 0x3C, 0x1D, 0xC1,
  972. 0xB5, 0x5F, 0x6C, 0xC0, 0xB2, 0x07, 0x3A, 0x6D,
  973. 0x41, 0xE4, 0x25, 0x99, 0xAC, 0xFC, 0xD2, 0x0F,
  974. 0x02, 0xD3, 0xD1, 0x54, 0x06, 0x1A, 0x51, 0x77,
  975. 0xBD, 0xB6, 0xBF, 0xEA, 0xA7, 0x5C, 0x06, 0xA9,
  976. 0x5D, 0x69, 0x84, 0x45, 0xD7, 0xF5, 0x05, 0xBA,
  977. 0x47, 0xF0, 0x1B, 0xD7, 0x2B, 0x24, 0xEC, 0xCB,
  978. 0x9B, 0x1B, 0x10, 0x8D, 0x81, 0xA0, 0xBE, 0xB1,
  979. 0x8C, 0x33, 0xE4, 0x36, 0xB8, 0x43, 0xEB, 0x19,
  980. 0x2A, 0x81, 0x8D, 0xDE, 0x81, 0x0A, 0x99, 0x48,
  981. 0xB6, 0xF6, 0xBC, 0xCD, 0x49, 0x34, 0x3A, 0x8F,
  982. 0x26, 0x94, 0xE3, 0x28, 0x82, 0x1A, 0x7C, 0x8F,
  983. 0x59, 0x9F, 0x45, 0xE8, 0x5D, 0x1A, 0x45, 0x76,
  984. 0x04, 0x56, 0x05, 0xA1, 0xD0, 0x1B, 0x8C, 0x77,
  985. 0x6D, 0xAF, 0x53, 0xFA, 0x71, 0xE2, 0x67, 0xE0,
  986. 0x9A, 0xFE, 0x03, 0xA9, 0x85, 0xD2, 0xC9, 0xAA,
  987. 0xBA, 0x2A, 0xBC, 0xF4, 0xA0, 0x08, 0xF5, 0x13,
  988. 0x98, 0x13, 0x5D, 0xF0, 0xD9, 0x33, 0x34, 0x2A,
  989. 0x61, 0xC3, 0x89, 0x55, 0xF0, 0xAE, 0x1A, 0x9C,
  990. 0x22, 0xEE, 0x19, 0x05, 0x8D, 0x32, 0xFE, 0xEC,
  991. 0x9C, 0x84, 0xBA, 0xB7, 0xF9, 0x6C, 0x3A, 0x4F,
  992. 0x07, 0xFC, 0x45, 0xEB, 0x12, 0xE5, 0x7B, 0xFD,
  993. 0x55, 0xE6, 0x29, 0x69, 0xD1, 0xC2, 0xE8, 0xB9,
  994. 0x78, 0x59, 0xF6, 0x79, 0x10, 0xC6, 0x4E, 0xEB,
  995. 0x6A, 0x5E, 0xB9, 0x9A, 0xC7, 0xC4, 0x5B, 0x63,
  996. 0xDA, 0xA3, 0x3F, 0x5E, 0x92, 0x7A, 0x81, 0x5E,
  997. 0xD6, 0xB0, 0xE2, 0x62, 0x8F, 0x74, 0x26, 0xC2,
  998. 0x0C, 0xD3, 0x9A, 0x17, 0x47, 0xE6, 0x8E, 0xAB
  999. };
  1000. static const unsigned char rsa_e[] = { 0x01, 0x00, 0x01 };
  1001. static const unsigned char rsa_d[] = {
  1002. 0x52, 0x41, 0xF4, 0xDA, 0x7B, 0xB7, 0x59, 0x55,
  1003. 0xCA, 0xD4, 0x2F, 0x0F, 0x3A, 0xCB, 0xA4, 0x0D,
  1004. 0x93, 0x6C, 0xCC, 0x9D, 0xC1, 0xB2, 0xFB, 0xFD,
  1005. 0xAE, 0x40, 0x31, 0xAC, 0x69, 0x52, 0x21, 0x92,
  1006. 0xB3, 0x27, 0xDF, 0xEA, 0xEE, 0x2C, 0x82, 0xBB,
  1007. 0xF7, 0x40, 0x32, 0xD5, 0x14, 0xC4, 0x94, 0x12,
  1008. 0xEC, 0xB8, 0x1F, 0xCA, 0x59, 0xE3, 0xC1, 0x78,
  1009. 0xF3, 0x85, 0xD8, 0x47, 0xA5, 0xD7, 0x02, 0x1A,
  1010. 0x65, 0x79, 0x97, 0x0D, 0x24, 0xF4, 0xF0, 0x67,
  1011. 0x6E, 0x75, 0x2D, 0xBF, 0x10, 0x3D, 0xA8, 0x7D,
  1012. 0xEF, 0x7F, 0x60, 0xE4, 0xE6, 0x05, 0x82, 0x89,
  1013. 0x5D, 0xDF, 0xC6, 0xD2, 0x6C, 0x07, 0x91, 0x33,
  1014. 0x98, 0x42, 0xF0, 0x02, 0x00, 0x25, 0x38, 0xC5,
  1015. 0x85, 0x69, 0x8A, 0x7D, 0x2F, 0x95, 0x6C, 0x43,
  1016. 0x9A, 0xB8, 0x81, 0xE2, 0xD0, 0x07, 0x35, 0xAA,
  1017. 0x05, 0x41, 0xC9, 0x1E, 0xAF, 0xE4, 0x04, 0x3B,
  1018. 0x19, 0xB8, 0x73, 0xA2, 0xAC, 0x4B, 0x1E, 0x66,
  1019. 0x48, 0xD8, 0x72, 0x1F, 0xAC, 0xF6, 0xCB, 0xBC,
  1020. 0x90, 0x09, 0xCA, 0xEC, 0x0C, 0xDC, 0xF9, 0x2C,
  1021. 0xD7, 0xEB, 0xAE, 0xA3, 0xA4, 0x47, 0xD7, 0x33,
  1022. 0x2F, 0x8A, 0xCA, 0xBC, 0x5E, 0xF0, 0x77, 0xE4,
  1023. 0x97, 0x98, 0x97, 0xC7, 0x10, 0x91, 0x7D, 0x2A,
  1024. 0xA6, 0xFF, 0x46, 0x83, 0x97, 0xDE, 0xE9, 0xE2,
  1025. 0x17, 0x03, 0x06, 0x14, 0xE2, 0xD7, 0xB1, 0x1D,
  1026. 0x77, 0xAF, 0x51, 0x27, 0x5B, 0x5E, 0x69, 0xB8,
  1027. 0x81, 0xE6, 0x11, 0xC5, 0x43, 0x23, 0x81, 0x04,
  1028. 0x62, 0xFF, 0xE9, 0x46, 0xB8, 0xD8, 0x44, 0xDB,
  1029. 0xA5, 0xCC, 0x31, 0x54, 0x34, 0xCE, 0x3E, 0x82,
  1030. 0xD6, 0xBF, 0x7A, 0x0B, 0x64, 0x21, 0x6D, 0x88,
  1031. 0x7E, 0x5B, 0x45, 0x12, 0x1E, 0x63, 0x8D, 0x49,
  1032. 0xA7, 0x1D, 0xD9, 0x1E, 0x06, 0xCD, 0xE8, 0xBA,
  1033. 0x2C, 0x8C, 0x69, 0x32, 0xEA, 0xBE, 0x60, 0x71
  1034. };
  1035. static const unsigned char rsa_p[] = {
  1036. 0xFA, 0xAC, 0xE1, 0x37, 0x5E, 0x32, 0x11, 0x34,
  1037. 0xC6, 0x72, 0x58, 0x2D, 0x91, 0x06, 0x3E, 0x77,
  1038. 0xE7, 0x11, 0x21, 0xCD, 0x4A, 0xF8, 0xA4, 0x3F,
  1039. 0x0F, 0xEF, 0x31, 0xE3, 0xF3, 0x55, 0xA0, 0xB9,
  1040. 0xAC, 0xB6, 0xCB, 0xBB, 0x41, 0xD0, 0x32, 0x81,
  1041. 0x9A, 0x8F, 0x7A, 0x99, 0x30, 0x77, 0x6C, 0x68,
  1042. 0x27, 0xE2, 0x96, 0xB5, 0x72, 0xC9, 0xC3, 0xD4,
  1043. 0x42, 0xAA, 0xAA, 0xCA, 0x95, 0x8F, 0xFF, 0xC9,
  1044. 0x9B, 0x52, 0x34, 0x30, 0x1D, 0xCF, 0xFE, 0xCF,
  1045. 0x3C, 0x56, 0x68, 0x6E, 0xEF, 0xE7, 0x6C, 0xD7,
  1046. 0xFB, 0x99, 0xF5, 0x4A, 0xA5, 0x21, 0x1F, 0x2B,
  1047. 0xEA, 0x93, 0xE8, 0x98, 0x26, 0xC4, 0x6E, 0x42,
  1048. 0x21, 0x5E, 0xA0, 0xA1, 0x2A, 0x58, 0x35, 0xBB,
  1049. 0x10, 0xE7, 0xBA, 0x27, 0x0A, 0x3B, 0xB3, 0xAF,
  1050. 0xE2, 0x75, 0x36, 0x04, 0xAC, 0x56, 0xA0, 0xAB,
  1051. 0x52, 0xDE, 0xCE, 0xDD, 0x2C, 0x28, 0x77, 0x03
  1052. };
  1053. static const unsigned char rsa_q[] = {
  1054. 0xDF, 0xB7, 0x52, 0xB6, 0xD7, 0xC0, 0xE2, 0x96,
  1055. 0xE7, 0xC9, 0xFE, 0x5D, 0x71, 0x5A, 0xC4, 0x40,
  1056. 0x96, 0x2F, 0xE5, 0x87, 0xEA, 0xF3, 0xA5, 0x77,
  1057. 0x11, 0x67, 0x3C, 0x8D, 0x56, 0x08, 0xA7, 0xB5,
  1058. 0x67, 0xFA, 0x37, 0xA8, 0xB8, 0xCF, 0x61, 0xE8,
  1059. 0x63, 0xD8, 0x38, 0x06, 0x21, 0x2B, 0x92, 0x09,
  1060. 0xA6, 0x39, 0x3A, 0xEA, 0xA8, 0xB4, 0x45, 0x4B,
  1061. 0x36, 0x10, 0x4C, 0xE4, 0x00, 0x66, 0x71, 0x65,
  1062. 0xF8, 0x0B, 0x94, 0x59, 0x4F, 0x8C, 0xFD, 0xD5,
  1063. 0x34, 0xA2, 0xE7, 0x62, 0x84, 0x0A, 0xA7, 0xBB,
  1064. 0xDB, 0xD9, 0x8A, 0xCD, 0x05, 0xE1, 0xCC, 0x57,
  1065. 0x7B, 0xF1, 0xF1, 0x1F, 0x11, 0x9D, 0xBA, 0x3E,
  1066. 0x45, 0x18, 0x99, 0x1B, 0x41, 0x64, 0x43, 0xEE,
  1067. 0x97, 0x5D, 0x77, 0x13, 0x5B, 0x74, 0x69, 0x73,
  1068. 0x87, 0x95, 0x05, 0x07, 0xBE, 0x45, 0x07, 0x17,
  1069. 0x7E, 0x4A, 0x69, 0x22, 0xF3, 0xDB, 0x05, 0x39
  1070. };
  1071. static const unsigned char rsa_dp[] = {
  1072. 0x5E, 0xD8, 0xDC, 0xDA, 0x53, 0x44, 0xC4, 0x67,
  1073. 0xE0, 0x92, 0x51, 0x34, 0xE4, 0x83, 0xA5, 0x4D,
  1074. 0x3E, 0xDB, 0xA7, 0x9B, 0x82, 0xBB, 0x73, 0x81,
  1075. 0xFC, 0xE8, 0x77, 0x4B, 0x15, 0xBE, 0x17, 0x73,
  1076. 0x49, 0x9B, 0x5C, 0x98, 0xBC, 0xBD, 0x26, 0xEF,
  1077. 0x0C, 0xE9, 0x2E, 0xED, 0x19, 0x7E, 0x86, 0x41,
  1078. 0x1E, 0x9E, 0x48, 0x81, 0xDD, 0x2D, 0xE4, 0x6F,
  1079. 0xC2, 0xCD, 0xCA, 0x93, 0x9E, 0x65, 0x7E, 0xD5,
  1080. 0xEC, 0x73, 0xFD, 0x15, 0x1B, 0xA2, 0xA0, 0x7A,
  1081. 0x0F, 0x0D, 0x6E, 0xB4, 0x53, 0x07, 0x90, 0x92,
  1082. 0x64, 0x3B, 0x8B, 0xA9, 0x33, 0xB3, 0xC5, 0x94,
  1083. 0x9B, 0x4C, 0x5D, 0x9C, 0x7C, 0x46, 0xA4, 0xA5,
  1084. 0x56, 0xF4, 0xF3, 0xF8, 0x27, 0x0A, 0x7B, 0x42,
  1085. 0x0D, 0x92, 0x70, 0x47, 0xE7, 0x42, 0x51, 0xA9,
  1086. 0xC2, 0x18, 0xB1, 0x58, 0xB1, 0x50, 0x91, 0xB8,
  1087. 0x61, 0x41, 0xB6, 0xA9, 0xCE, 0xD4, 0x7C, 0xBB
  1088. };
  1089. static const unsigned char rsa_dq[] = {
  1090. 0x54, 0x09, 0x1F, 0x0F, 0x03, 0xD8, 0xB6, 0xC5,
  1091. 0x0C, 0xE8, 0xB9, 0x9E, 0x0C, 0x38, 0x96, 0x43,
  1092. 0xD4, 0xA6, 0xC5, 0x47, 0xDB, 0x20, 0x0E, 0xE5,
  1093. 0xBD, 0x29, 0xD4, 0x7B, 0x1A, 0xF8, 0x41, 0x57,
  1094. 0x49, 0x69, 0x9A, 0x82, 0xCC, 0x79, 0x4A, 0x43,
  1095. 0xEB, 0x4D, 0x8B, 0x2D, 0xF2, 0x43, 0xD5, 0xA5,
  1096. 0xBE, 0x44, 0xFD, 0x36, 0xAC, 0x8C, 0x9B, 0x02,
  1097. 0xF7, 0x9A, 0x03, 0xE8, 0x19, 0xA6, 0x61, 0xAE,
  1098. 0x76, 0x10, 0x93, 0x77, 0x41, 0x04, 0xAB, 0x4C,
  1099. 0xED, 0x6A, 0xCC, 0x14, 0x1B, 0x99, 0x8D, 0x0C,
  1100. 0x6A, 0x37, 0x3B, 0x86, 0x6C, 0x51, 0x37, 0x5B,
  1101. 0x1D, 0x79, 0xF2, 0xA3, 0x43, 0x10, 0xC6, 0xA7,
  1102. 0x21, 0x79, 0x6D, 0xF9, 0xE9, 0x04, 0x6A, 0xE8,
  1103. 0x32, 0xFF, 0xAE, 0xFD, 0x1C, 0x7B, 0x8C, 0x29,
  1104. 0x13, 0xA3, 0x0C, 0xB2, 0xAD, 0xEC, 0x6C, 0x0F,
  1105. 0x8D, 0x27, 0x12, 0x7B, 0x48, 0xB2, 0xDB, 0x31
  1106. };
  1107. static const unsigned char rsa_qInv[] = {
  1108. 0x8D, 0x1B, 0x05, 0xCA, 0x24, 0x1F, 0x0C, 0x53,
  1109. 0x19, 0x52, 0x74, 0x63, 0x21, 0xFA, 0x78, 0x46,
  1110. 0x79, 0xAF, 0x5C, 0xDE, 0x30, 0xA4, 0x6C, 0x20,
  1111. 0x38, 0xE6, 0x97, 0x39, 0xB8, 0x7A, 0x70, 0x0D,
  1112. 0x8B, 0x6C, 0x6D, 0x13, 0x74, 0xD5, 0x1C, 0xDE,
  1113. 0xA9, 0xF4, 0x60, 0x37, 0xFE, 0x68, 0x77, 0x5E,
  1114. 0x0B, 0x4E, 0x5E, 0x03, 0x31, 0x30, 0xDF, 0xD6,
  1115. 0xAE, 0x85, 0xD0, 0x81, 0xBB, 0x61, 0xC7, 0xB1,
  1116. 0x04, 0x5A, 0xC4, 0x6D, 0x56, 0x1C, 0xD9, 0x64,
  1117. 0xE7, 0x85, 0x7F, 0x88, 0x91, 0xC9, 0x60, 0x28,
  1118. 0x05, 0xE2, 0xC6, 0x24, 0x8F, 0xDD, 0x61, 0x64,
  1119. 0xD8, 0x09, 0xDE, 0x7E, 0xD3, 0x4A, 0x61, 0x1A,
  1120. 0xD3, 0x73, 0x58, 0x4B, 0xD8, 0xA0, 0x54, 0x25,
  1121. 0x48, 0x83, 0x6F, 0x82, 0x6C, 0xAF, 0x36, 0x51,
  1122. 0x2A, 0x5D, 0x14, 0x2F, 0x41, 0x25, 0x00, 0xDD,
  1123. 0xF8, 0xF3, 0x95, 0xFE, 0x31, 0x25, 0x50, 0x12
  1124. };
  1125. static const ST_KAT_PARAM rsa_crt_key[] = {
  1126. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_N, rsa_n),
  1127. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_E, rsa_e),
  1128. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_D, rsa_d),
  1129. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_FACTOR, rsa_p),
  1130. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_FACTOR, rsa_q),
  1131. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_EXPONENT, rsa_dp),
  1132. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_EXPONENT, rsa_dq),
  1133. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_COEFFICIENT, rsa_qInv),
  1134. ST_KAT_PARAM_END()
  1135. };
  1136. static const ST_KAT_PARAM rsa_pub_key[] = {
  1137. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_N, rsa_n),
  1138. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_E, rsa_e),
  1139. ST_KAT_PARAM_END()
  1140. };
  1141. static const ST_KAT_PARAM rsa_priv_key[] = {
  1142. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_N, rsa_n),
  1143. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_E, rsa_e),
  1144. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_RSA_D, rsa_d),
  1145. ST_KAT_PARAM_END()
  1146. };
  1147. static const ST_KAT_PARAM rsa_enc_params[] = {
  1148. ST_KAT_PARAM_UTF8STRING(OSSL_ASYM_CIPHER_PARAM_PAD_MODE,
  1149. OSSL_PKEY_RSA_PAD_MODE_NONE),
  1150. ST_KAT_PARAM_END()
  1151. };
  1152. static const unsigned char rsa_expected_sig[256] = {
  1153. 0xad, 0xbe, 0x2a, 0xaf, 0x16, 0x85, 0xc5, 0x00,
  1154. 0x91, 0x3e, 0xd0, 0x49, 0xfb, 0x3a, 0x81, 0xb9,
  1155. 0x6c, 0x28, 0xbc, 0xbf, 0xea, 0x96, 0x5f, 0xe4,
  1156. 0x9f, 0x99, 0xf7, 0x18, 0x8c, 0xec, 0x60, 0x28,
  1157. 0xeb, 0x29, 0x02, 0x49, 0xfc, 0xda, 0xd7, 0x78,
  1158. 0x68, 0xf8, 0xe1, 0xe9, 0x4d, 0x20, 0x6d, 0x32,
  1159. 0xa6, 0xde, 0xfc, 0xe4, 0xda, 0xcc, 0x6c, 0x75,
  1160. 0x36, 0x6b, 0xff, 0x5a, 0xac, 0x01, 0xa8, 0xc2,
  1161. 0xa9, 0xe6, 0x8b, 0x18, 0x3e, 0xec, 0xea, 0x4c,
  1162. 0x4a, 0x9e, 0x00, 0x09, 0xd1, 0x8a, 0x69, 0x1b,
  1163. 0x8b, 0xd9, 0xad, 0x37, 0xe5, 0x7c, 0xff, 0x7d,
  1164. 0x59, 0x56, 0x3e, 0xa0, 0xc6, 0x32, 0xd8, 0x35,
  1165. 0x2f, 0xff, 0xfb, 0x05, 0x02, 0xcd, 0xd7, 0x19,
  1166. 0xb9, 0x00, 0x86, 0x2a, 0xcf, 0xaa, 0x78, 0x16,
  1167. 0x4b, 0xf1, 0xa7, 0x59, 0xef, 0x7d, 0xe8, 0x74,
  1168. 0x23, 0x5c, 0xb2, 0xd4, 0x8a, 0x99, 0xa5, 0xbc,
  1169. 0xfa, 0x63, 0xd8, 0xf7, 0xbd, 0xc6, 0x00, 0x13,
  1170. 0x06, 0x02, 0x9a, 0xd4, 0xa7, 0xb4, 0x3d, 0x61,
  1171. 0xab, 0xf1, 0xc2, 0x95, 0x59, 0x9b, 0x3d, 0x67,
  1172. 0x1f, 0xde, 0x57, 0xb6, 0xb6, 0x9f, 0xb0, 0x87,
  1173. 0xd6, 0x51, 0xd5, 0x3e, 0x00, 0xe2, 0xc9, 0xa0,
  1174. 0x03, 0x66, 0xbc, 0x01, 0xb3, 0x8e, 0xfa, 0xf1,
  1175. 0x15, 0xeb, 0x26, 0xf1, 0x5d, 0x81, 0x90, 0xb4,
  1176. 0x1c, 0x00, 0x7c, 0x83, 0x4a, 0xa5, 0xde, 0x64,
  1177. 0xae, 0xea, 0x6c, 0x43, 0xc3, 0x20, 0x77, 0x77,
  1178. 0x42, 0x12, 0x24, 0xf5, 0xe3, 0x70, 0xdd, 0x59,
  1179. 0x48, 0x9c, 0xef, 0xd4, 0x8a, 0x3c, 0x29, 0x6a,
  1180. 0x0c, 0x9c, 0xf2, 0x13, 0xa4, 0x1c, 0x2f, 0x49,
  1181. 0xcd, 0xb4, 0xaa, 0x28, 0x40, 0x34, 0xc6, 0x75,
  1182. 0xba, 0x30, 0xe6, 0xd8, 0x5b, 0x2f, 0x08, 0xd0,
  1183. 0x29, 0xa5, 0x39, 0xfb, 0x6e, 0x3b, 0x0f, 0x52,
  1184. 0x2c, 0x68, 0xf0, 0x37, 0xa9, 0xd2, 0x56, 0xd6
  1185. };
  1186. static const unsigned char rsa_asym_plaintext_encrypt[256] = {
  1187. 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
  1188. 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
  1189. };
  1190. static const unsigned char rsa_asym_expected_encrypt[256] = {
  1191. 0x54, 0xac, 0x23, 0x96, 0x1d, 0x82, 0x5d, 0x8b,
  1192. 0x8f, 0x36, 0x33, 0xd0, 0xf4, 0x02, 0xa2, 0x61,
  1193. 0xb1, 0x13, 0xd4, 0x4a, 0x46, 0x06, 0x37, 0x3c,
  1194. 0xbf, 0x40, 0x05, 0x3c, 0xc6, 0x3b, 0x64, 0xdc,
  1195. 0x22, 0x22, 0xaf, 0x36, 0x79, 0x62, 0x45, 0xf0,
  1196. 0x97, 0x82, 0x22, 0x44, 0x86, 0x4a, 0x7c, 0xfa,
  1197. 0xac, 0x03, 0x21, 0x84, 0x3f, 0x31, 0xad, 0x2a,
  1198. 0xa4, 0x6e, 0x7a, 0xc5, 0x93, 0xf3, 0x0f, 0xfc,
  1199. 0xf1, 0x62, 0xce, 0x82, 0x12, 0x45, 0xc9, 0x35,
  1200. 0xb0, 0x7a, 0xcd, 0x99, 0x8c, 0x91, 0x6b, 0x5a,
  1201. 0xd3, 0x46, 0xdb, 0xf9, 0x9e, 0x52, 0x49, 0xbd,
  1202. 0x1e, 0xe8, 0xda, 0xac, 0x61, 0x47, 0xc2, 0xda,
  1203. 0xfc, 0x1e, 0xfb, 0x74, 0xd7, 0xd6, 0xc1, 0x18,
  1204. 0x86, 0x3e, 0x20, 0x9c, 0x7a, 0xe1, 0x04, 0xb7,
  1205. 0x38, 0x43, 0xb1, 0x4e, 0xa0, 0xd8, 0xc1, 0x39,
  1206. 0x4d, 0xe1, 0xd3, 0xb0, 0xb3, 0xf1, 0x82, 0x87,
  1207. 0x1f, 0x74, 0xb5, 0x69, 0xfd, 0x33, 0xd6, 0x21,
  1208. 0x7c, 0x61, 0x60, 0x28, 0xca, 0x70, 0xdb, 0xa0,
  1209. 0xbb, 0xc8, 0x73, 0xa9, 0x82, 0xf8, 0x6b, 0xd8,
  1210. 0xf0, 0xc9, 0x7b, 0x20, 0xdf, 0x9d, 0xfb, 0x8c,
  1211. 0xd4, 0xa2, 0x89, 0xe1, 0x9b, 0x04, 0xad, 0xaa,
  1212. 0x11, 0x6c, 0x8f, 0xce, 0x83, 0x29, 0x56, 0x69,
  1213. 0xbb, 0x00, 0x3b, 0xef, 0xca, 0x2d, 0xcd, 0x52,
  1214. 0xc8, 0xf1, 0xb3, 0x9b, 0xb4, 0x4f, 0x6d, 0x9c,
  1215. 0x3d, 0x69, 0xcc, 0x6d, 0x1f, 0x38, 0x4d, 0xe6,
  1216. 0xbb, 0x0c, 0x87, 0xdc, 0x5f, 0xa9, 0x24, 0x93,
  1217. 0x03, 0x46, 0xa2, 0x33, 0x6c, 0xf4, 0xd8, 0x5d,
  1218. 0x68, 0xf3, 0xd3, 0xe0, 0xf2, 0x30, 0xdb, 0xf5,
  1219. 0x4f, 0x0f, 0xad, 0xc7, 0xd0, 0xaa, 0x47, 0xd9,
  1220. 0x9f, 0x85, 0x1b, 0x2e, 0x6c, 0x3c, 0x57, 0x04,
  1221. 0x29, 0xf4, 0xf5, 0x66, 0x7d, 0x93, 0x4a, 0xaa,
  1222. 0x05, 0x52, 0x55, 0xc1, 0xc6, 0x06, 0x90, 0xab,
  1223. };
  1224. #ifndef OPENSSL_NO_EC
  1225. /* ECDSA key data */
  1226. static const char ecd_curve_name[] = "secp224r1";
  1227. static const unsigned char ecd_priv[] = {
  1228. 0x98, 0x1f, 0xb5, 0xf1, 0xfc, 0x87, 0x1d, 0x7d,
  1229. 0xde, 0x1e, 0x01, 0x64, 0x09, 0x9b, 0xe7, 0x1b,
  1230. 0x9f, 0xad, 0x63, 0xdd, 0x33, 0x01, 0xd1, 0x50,
  1231. 0x80, 0x93, 0x50, 0x30
  1232. };
  1233. static const unsigned char ecd_pub[] = {
  1234. 0x04, 0x95, 0x47, 0x99, 0x44, 0x29, 0x8f, 0x51,
  1235. 0x39, 0xe2, 0x53, 0xec, 0x79, 0xb0, 0x4d, 0xde,
  1236. 0x87, 0x1a, 0x76, 0x54, 0xd5, 0x96, 0xb8, 0x7a,
  1237. 0x6d, 0xf4, 0x1c, 0x2c, 0x87, 0x91, 0x5f, 0xd5,
  1238. 0x31, 0xdd, 0x24, 0xe5, 0x78, 0xd9, 0x08, 0x24,
  1239. 0x8a, 0x49, 0x99, 0xec, 0x55, 0xf2, 0x82, 0xb3,
  1240. 0xc4, 0xb7, 0x33, 0x68, 0xe4, 0x24, 0xa9, 0x12,
  1241. 0x82
  1242. };
  1243. static const ST_KAT_PARAM ecdsa_key[] = {
  1244. ST_KAT_PARAM_UTF8STRING(OSSL_PKEY_PARAM_GROUP_NAME, ecd_curve_name),
  1245. ST_KAT_PARAM_OCTET(OSSL_PKEY_PARAM_PUB_KEY, ecd_pub),
  1246. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_PRIV_KEY, ecd_priv),
  1247. ST_KAT_PARAM_END()
  1248. };
  1249. #endif /* OPENSSL_NO_EC */
  1250. #ifndef OPENSSL_NO_DSA
  1251. /* dsa 2048 */
  1252. static const unsigned char dsa_p[] = {
  1253. 0xa2, 0x9b, 0x88, 0x72, 0xce, 0x8b, 0x84, 0x23,
  1254. 0xb7, 0xd5, 0xd2, 0x1d, 0x4b, 0x02, 0xf5, 0x7e,
  1255. 0x03, 0xe9, 0xe6, 0xb8, 0xa2, 0x58, 0xdc, 0x16,
  1256. 0x61, 0x1b, 0xa0, 0x98, 0xab, 0x54, 0x34, 0x15,
  1257. 0xe4, 0x15, 0xf1, 0x56, 0x99, 0x7a, 0x3e, 0xe2,
  1258. 0x36, 0x65, 0x8f, 0xa0, 0x93, 0x26, 0x0d, 0xe3,
  1259. 0xad, 0x42, 0x2e, 0x05, 0xe0, 0x46, 0xf9, 0xec,
  1260. 0x29, 0x16, 0x1a, 0x37, 0x5f, 0x0e, 0xb4, 0xef,
  1261. 0xfc, 0xef, 0x58, 0x28, 0x5c, 0x5d, 0x39, 0xed,
  1262. 0x42, 0x5d, 0x7a, 0x62, 0xca, 0x12, 0x89, 0x6c,
  1263. 0x4a, 0x92, 0xcb, 0x19, 0x46, 0xf2, 0x95, 0x2a,
  1264. 0x48, 0x13, 0x3f, 0x07, 0xda, 0x36, 0x4d, 0x1b,
  1265. 0xdf, 0x6b, 0x0f, 0x71, 0x39, 0x98, 0x3e, 0x69,
  1266. 0x3c, 0x80, 0x05, 0x9b, 0x0e, 0xac, 0xd1, 0x47,
  1267. 0x9b, 0xa9, 0xf2, 0x85, 0x77, 0x54, 0xed, 0xe7,
  1268. 0x5f, 0x11, 0x2b, 0x07, 0xeb, 0xbf, 0x35, 0x34,
  1269. 0x8b, 0xbf, 0x3e, 0x01, 0xe0, 0x2f, 0x2d, 0x47,
  1270. 0x3d, 0xe3, 0x94, 0x53, 0xf9, 0x9d, 0xd2, 0x36,
  1271. 0x75, 0x41, 0xca, 0xca, 0x3b, 0xa0, 0x11, 0x66,
  1272. 0x34, 0x3d, 0x7b, 0x5b, 0x58, 0xa3, 0x7b, 0xd1,
  1273. 0xb7, 0x52, 0x1d, 0xb2, 0xf1, 0x3b, 0x86, 0x70,
  1274. 0x71, 0x32, 0xfe, 0x09, 0xf4, 0xcd, 0x09, 0xdc,
  1275. 0x16, 0x18, 0xfa, 0x34, 0x01, 0xeb, 0xf9, 0xcc,
  1276. 0x7b, 0x19, 0xfa, 0x94, 0xaa, 0x47, 0x20, 0x88,
  1277. 0x13, 0x3d, 0x6c, 0xb2, 0xd3, 0x5c, 0x11, 0x79,
  1278. 0xc8, 0xc8, 0xff, 0x36, 0x87, 0x58, 0xd5, 0x07,
  1279. 0xd9, 0xf9, 0xa1, 0x7d, 0x46, 0xc1, 0x10, 0xfe,
  1280. 0x31, 0x44, 0xce, 0x9b, 0x02, 0x2b, 0x42, 0xe4,
  1281. 0x19, 0xeb, 0x4f, 0x53, 0x88, 0x61, 0x3b, 0xfc,
  1282. 0x3e, 0x26, 0x24, 0x1a, 0x43, 0x2e, 0x87, 0x06,
  1283. 0xbc, 0x58, 0xef, 0x76, 0x11, 0x72, 0x78, 0xde,
  1284. 0xab, 0x6c, 0xf6, 0x92, 0x61, 0x82, 0x91, 0xb7
  1285. };
  1286. static const unsigned char dsa_q[] = {
  1287. 0xa3, 0xbf, 0xd9, 0xab, 0x78, 0x84, 0x79, 0x4e,
  1288. 0x38, 0x34, 0x50, 0xd5, 0x89, 0x1d, 0xc1, 0x8b,
  1289. 0x65, 0x15, 0x7b, 0xdc, 0xfc, 0xda, 0xc5, 0x15,
  1290. 0x18, 0x90, 0x28, 0x67
  1291. };
  1292. static const unsigned char dsa_g[] = {
  1293. 0x68, 0x19, 0x27, 0x88, 0x69, 0xc7, 0xfd, 0x3d,
  1294. 0x2d, 0x7b, 0x77, 0xf7, 0x7e, 0x81, 0x50, 0xd9,
  1295. 0xad, 0x43, 0x3b, 0xea, 0x3b, 0xa8, 0x5e, 0xfc,
  1296. 0x80, 0x41, 0x5a, 0xa3, 0x54, 0x5f, 0x78, 0xf7,
  1297. 0x22, 0x96, 0xf0, 0x6c, 0xb1, 0x9c, 0xed, 0xa0,
  1298. 0x6c, 0x94, 0xb0, 0x55, 0x1c, 0xfe, 0x6e, 0x6f,
  1299. 0x86, 0x3e, 0x31, 0xd1, 0xde, 0x6e, 0xed, 0x7d,
  1300. 0xab, 0x8b, 0x0c, 0x9d, 0xf2, 0x31, 0xe0, 0x84,
  1301. 0x34, 0xd1, 0x18, 0x4f, 0x91, 0xd0, 0x33, 0x69,
  1302. 0x6b, 0xb3, 0x82, 0xf8, 0x45, 0x5e, 0x98, 0x88,
  1303. 0xf5, 0xd3, 0x1d, 0x47, 0x84, 0xec, 0x40, 0x12,
  1304. 0x02, 0x46, 0xf4, 0xbe, 0xa6, 0x17, 0x94, 0xbb,
  1305. 0xa5, 0x86, 0x6f, 0x09, 0x74, 0x64, 0x63, 0xbd,
  1306. 0xf8, 0xe9, 0xe1, 0x08, 0xcd, 0x95, 0x29, 0xc3,
  1307. 0xd0, 0xf6, 0xdf, 0x80, 0x31, 0x6e, 0x2e, 0x70,
  1308. 0xaa, 0xeb, 0x1b, 0x26, 0xcd, 0xb8, 0xad, 0x97,
  1309. 0xbc, 0x3d, 0x28, 0x7e, 0x0b, 0x8d, 0x61, 0x6c,
  1310. 0x42, 0xe6, 0x5b, 0x87, 0xdb, 0x20, 0xde, 0xb7,
  1311. 0x00, 0x5b, 0xc4, 0x16, 0x74, 0x7a, 0x64, 0x70,
  1312. 0x14, 0x7a, 0x68, 0xa7, 0x82, 0x03, 0x88, 0xeb,
  1313. 0xf4, 0x4d, 0x52, 0xe0, 0x62, 0x8a, 0xf9, 0xcf,
  1314. 0x1b, 0x71, 0x66, 0xd0, 0x34, 0x65, 0xf3, 0x5a,
  1315. 0xcc, 0x31, 0xb6, 0x11, 0x0c, 0x43, 0xda, 0xbc,
  1316. 0x7c, 0x5d, 0x59, 0x1e, 0x67, 0x1e, 0xaf, 0x7c,
  1317. 0x25, 0x2c, 0x1c, 0x14, 0x53, 0x36, 0xa1, 0xa4,
  1318. 0xdd, 0xf1, 0x32, 0x44, 0xd5, 0x5e, 0x83, 0x56,
  1319. 0x80, 0xca, 0xb2, 0x53, 0x3b, 0x82, 0xdf, 0x2e,
  1320. 0xfe, 0x55, 0xec, 0x18, 0xc1, 0xe6, 0xcd, 0x00,
  1321. 0x7b, 0xb0, 0x89, 0x75, 0x8b, 0xb1, 0x7c, 0x2c,
  1322. 0xbe, 0x14, 0x44, 0x1b, 0xd0, 0x93, 0xae, 0x66,
  1323. 0xe5, 0x97, 0x6d, 0x53, 0x73, 0x3f, 0x4f, 0xa3,
  1324. 0x26, 0x97, 0x01, 0xd3, 0x1d, 0x23, 0xd4, 0x67
  1325. };
  1326. static const unsigned char dsa_pub[] = {
  1327. 0xa0, 0x12, 0xb3, 0xb1, 0x70, 0xb3, 0x07, 0x22,
  1328. 0x79, 0x57, 0xb7, 0xca, 0x20, 0x61, 0xa8, 0x16,
  1329. 0xac, 0x7a, 0x2b, 0x3d, 0x9a, 0xe9, 0x95, 0xa5,
  1330. 0x11, 0x9c, 0x38, 0x5b, 0x60, 0x3b, 0xf6, 0xf6,
  1331. 0xc5, 0xde, 0x4d, 0xc5, 0xec, 0xb5, 0xdf, 0xa4,
  1332. 0xa4, 0x1c, 0x68, 0x66, 0x2e, 0xb2, 0x5b, 0x63,
  1333. 0x8b, 0x7e, 0x26, 0x20, 0xba, 0x89, 0x8d, 0x07,
  1334. 0xda, 0x6c, 0x49, 0x91, 0xe7, 0x6c, 0xc0, 0xec,
  1335. 0xd1, 0xad, 0x34, 0x21, 0x07, 0x70, 0x67, 0xe4,
  1336. 0x7c, 0x18, 0xf5, 0x8a, 0x92, 0xa7, 0x2a, 0xd4,
  1337. 0x31, 0x99, 0xec, 0xb7, 0xbd, 0x84, 0xe7, 0xd3,
  1338. 0xaf, 0xb9, 0x01, 0x9f, 0x0e, 0x9d, 0xd0, 0xfb,
  1339. 0xaa, 0x48, 0x73, 0x00, 0xb1, 0x30, 0x81, 0xe3,
  1340. 0x3c, 0x90, 0x28, 0x76, 0x43, 0x6f, 0x7b, 0x03,
  1341. 0xc3, 0x45, 0x52, 0x84, 0x81, 0xd3, 0x62, 0x81,
  1342. 0x5e, 0x24, 0xfe, 0x59, 0xda, 0xc5, 0xac, 0x34,
  1343. 0x66, 0x0d, 0x4c, 0x8a, 0x76, 0xcb, 0x99, 0xa7,
  1344. 0xc7, 0xde, 0x93, 0xeb, 0x95, 0x6c, 0xd6, 0xbc,
  1345. 0x88, 0xe5, 0x8d, 0x90, 0x10, 0x34, 0x94, 0x4a,
  1346. 0x09, 0x4b, 0x01, 0x80, 0x3a, 0x43, 0xc6, 0x72,
  1347. 0xb9, 0x68, 0x8c, 0x0e, 0x01, 0xd8, 0xf4, 0xfc,
  1348. 0x91, 0xc6, 0x2a, 0x3f, 0x88, 0x02, 0x1f, 0x7b,
  1349. 0xd6, 0xa6, 0x51, 0xb1, 0xa8, 0x8f, 0x43, 0xaa,
  1350. 0x4e, 0xf2, 0x76, 0x53, 0xd1, 0x2b, 0xf8, 0xb7,
  1351. 0x09, 0x9f, 0xdf, 0x6b, 0x46, 0x10, 0x82, 0xf8,
  1352. 0xe9, 0x39, 0x10, 0x7b, 0xfd, 0x2f, 0x72, 0x10,
  1353. 0x08, 0x7d, 0x32, 0x6c, 0x37, 0x52, 0x00, 0xf1,
  1354. 0xf5, 0x1e, 0x7e, 0x74, 0xa3, 0x41, 0x31, 0x90,
  1355. 0x1b, 0xcd, 0x08, 0x63, 0x52, 0x1f, 0xf8, 0xd6,
  1356. 0x76, 0xc4, 0x85, 0x81, 0x86, 0x87, 0x36, 0xc5,
  1357. 0xe5, 0x1b, 0x16, 0xa4, 0xe3, 0x92, 0x15, 0xea,
  1358. 0x0b, 0x17, 0xc4, 0x73, 0x59, 0x74, 0xc5, 0x16
  1359. };
  1360. static const unsigned char dsa_priv[] = {
  1361. 0x6c, 0xca, 0xee, 0xf6, 0xd7, 0x3b, 0x4e, 0x80,
  1362. 0xf1, 0x1c, 0x17, 0xb8, 0xe9, 0x62, 0x7c, 0x03,
  1363. 0x66, 0x35, 0xba, 0xc3, 0x94, 0x23, 0x50, 0x5e,
  1364. 0x40, 0x7e, 0x5c, 0xb7
  1365. };
  1366. static const ST_KAT_PARAM dsa_key[] = {
  1367. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_FFC_P, dsa_p),
  1368. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_FFC_Q, dsa_q),
  1369. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_FFC_G, dsa_g),
  1370. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_PUB_KEY, dsa_pub),
  1371. ST_KAT_PARAM_BIGNUM(OSSL_PKEY_PARAM_PRIV_KEY, dsa_priv),
  1372. ST_KAT_PARAM_END()
  1373. };
  1374. #endif /* OPENSSL_NO_DSA */
  1375. static const ST_KAT_SIGN st_kat_sign_tests[] = {
  1376. {
  1377. OSSL_SELF_TEST_DESC_SIGN_RSA,
  1378. "RSA",
  1379. "SHA-256",
  1380. rsa_crt_key,
  1381. ITM(rsa_expected_sig)
  1382. },
  1383. #ifndef OPENSSL_NO_EC
  1384. {
  1385. OSSL_SELF_TEST_DESC_SIGN_ECDSA,
  1386. "EC",
  1387. "SHA-256",
  1388. ecdsa_key,
  1389. /*
  1390. * The ECDSA signature changes each time due to it using a random k.
  1391. * So there is no expected KAT for this case.
  1392. */
  1393. },
  1394. #endif /* OPENSSL_NO_EC */
  1395. #ifndef OPENSSL_NO_DSA
  1396. {
  1397. OSSL_SELF_TEST_DESC_SIGN_DSA,
  1398. "DSA",
  1399. "SHA-256",
  1400. dsa_key,
  1401. /*
  1402. * The DSA signature changes each time due to it using a random k.
  1403. * So there is no expected KAT for this case.
  1404. */
  1405. },
  1406. #endif /* OPENSSL_NO_DSA */
  1407. };
  1408. static const ST_KAT_ASYM_CIPHER st_kat_asym_cipher_tests[] = {
  1409. {
  1410. OSSL_SELF_TEST_DESC_ASYM_RSA_ENC,
  1411. "RSA",
  1412. 1,
  1413. rsa_pub_key,
  1414. rsa_enc_params,
  1415. ITM(rsa_asym_plaintext_encrypt),
  1416. ITM(rsa_asym_expected_encrypt),
  1417. },
  1418. {
  1419. OSSL_SELF_TEST_DESC_ASYM_RSA_DEC,
  1420. "RSA",
  1421. 0,
  1422. rsa_priv_key,
  1423. rsa_enc_params,
  1424. ITM(rsa_asym_expected_encrypt),
  1425. ITM(rsa_asym_plaintext_encrypt),
  1426. },
  1427. {
  1428. OSSL_SELF_TEST_DESC_ASYM_RSA_DEC,
  1429. "RSA",
  1430. 0,
  1431. rsa_crt_key,
  1432. rsa_enc_params,
  1433. ITM(rsa_asym_expected_encrypt),
  1434. ITM(rsa_asym_plaintext_encrypt),
  1435. },
  1436. };