From 3b43568d5bae85196834f9ca3339b32a77ab2c4b Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 12 May 2014 18:35:30 +0100 Subject: [PATCH] Revert "Remove Dual EC DRBG from FIPS module." Revert Dual EC DRBG removal commit as it was not accepted for 2.0.7 version of the module. This reverts commit 200f249b8c3b6439e0200d01caadc24806f1a983. --- fips/fips_test_suite.c | 12 + fips/fipsalgtest.pl | 1 + fips/rand/Makefile | 16 +- fips/rand/fips_drbg_ec.c | 542 +++++++++++ fips/rand/fips_drbg_lib.c | 2 + fips/rand/fips_drbg_selftest.c | 15 + fips/rand/fips_drbg_selftest.h | 1678 ++++++++++++++++++++++++++++++++ fips/rand/fips_rand_lcl.h | 1 + 8 files changed, 2265 insertions(+), 2 deletions(-) create mode 100644 fips/rand/fips_drbg_ec.c diff --git a/fips/fips_test_suite.c b/fips/fips_test_suite.c index e2506ff2ae..cf8f085e95 100644 --- a/fips/fips_test_suite.c +++ b/fips/fips_test_suite.c @@ -714,6 +714,18 @@ static int do_drbg_all(void) {NID_aes_128_ctr, DRBG_FLAG_CTR_USE_DF}, {NID_aes_192_ctr, DRBG_FLAG_CTR_USE_DF}, {NID_aes_256_ctr, DRBG_FLAG_CTR_USE_DF}, + {(NID_X9_62_prime256v1 << 16)|NID_sha1, 0}, + {(NID_X9_62_prime256v1 << 16)|NID_sha224, 0}, + {(NID_X9_62_prime256v1 << 16)|NID_sha256, 0}, + {(NID_X9_62_prime256v1 << 16)|NID_sha384, 0}, + {(NID_X9_62_prime256v1 << 16)|NID_sha512, 0}, + {(NID_secp384r1 << 16)|NID_sha224, 0}, + {(NID_secp384r1 << 16)|NID_sha256, 0}, + {(NID_secp384r1 << 16)|NID_sha384, 0}, + {(NID_secp384r1 << 16)|NID_sha512, 0}, + {(NID_secp521r1 << 16)|NID_sha256, 0}, + {(NID_secp521r1 << 16)|NID_sha384, 0}, + {(NID_secp521r1 << 16)|NID_sha512, 0}, {0, 0} }; DRBG_LIST *lst; diff --git a/fips/fipsalgtest.pl b/fips/fipsalgtest.pl index 954a46a6f3..2e31335ae9 100644 --- a/fips/fipsalgtest.pl +++ b/fips/fipsalgtest.pl @@ -434,6 +434,7 @@ my @fips_drbg_test_list = ( # SP800-90 DRBG tests "SP800-90 DRBG", [ "CTR_DRBG", "fips_drbgvs" ], + [ "Dual_EC_DRBG", "fips_drbgvs" ], [ "Hash_DRBG", "fips_drbgvs" ], [ "HMAC_DRBG", "fips_drbgvs" ] diff --git a/fips/rand/Makefile b/fips/rand/Makefile index 5026048455..61ed391271 100644 --- a/fips/rand/Makefile +++ b/fips/rand/Makefile @@ -23,10 +23,10 @@ APPS= LIB=$(TOP)/libcrypto.a LIBSRC= fips_rand.c fips_rand_selftest.c fips_drbg_lib.c \ - fips_drbg_hash.c fips_drbg_hmac.c fips_drbg_ctr.c \ + fips_drbg_hash.c fips_drbg_hmac.c fips_drbg_ctr.c fips_drbg_ec.c \ fips_drbg_selftest.c fips_drbg_rand.c fips_rand_lib.c LIBOBJ= fips_rand.o fips_rand_selftest.o fips_drbg_lib.o \ - fips_drbg_hash.o fips_drbg_hmac.o fips_drbg_ctr.o \ + fips_drbg_hash.o fips_drbg_hmac.o fips_drbg_ctr.o fips_drbg_ec.o \ fips_drbg_selftest.o fips_drbg_rand.o fips_rand_lib.o SRC= $(LIBSRC) @@ -105,6 +105,18 @@ fips_drbg_ctr.o: ../../include/openssl/ossl_typ.h fips_drbg_ctr.o: ../../include/openssl/safestack.h fips_drbg_ctr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h fips_drbg_ctr.o: fips_drbg_ctr.c fips_rand_lcl.h +fips_drbg_ec.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h +fips_drbg_ec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +fips_drbg_ec.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h +fips_drbg_ec.o: ../../include/openssl/ec.h ../../include/openssl/evp.h +fips_drbg_ec.o: ../../include/openssl/fips.h ../../include/openssl/fips_rand.h +fips_drbg_ec.o: ../../include/openssl/hmac.h ../../include/openssl/obj_mac.h +fips_drbg_ec.o: ../../include/openssl/objects.h +fips_drbg_ec.o: ../../include/openssl/opensslconf.h +fips_drbg_ec.o: ../../include/openssl/opensslv.h +fips_drbg_ec.o: ../../include/openssl/ossl_typ.h +fips_drbg_ec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +fips_drbg_ec.o: ../../include/openssl/symhacks.h fips_drbg_ec.c fips_rand_lcl.h fips_drbg_hash.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h fips_drbg_hash.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h fips_drbg_hash.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h diff --git a/fips/rand/fips_drbg_ec.c b/fips/rand/fips_drbg_ec.c new file mode 100644 index 0000000000..6be6534ce7 --- /dev/null +++ b/fips/rand/fips_drbg_ec.c @@ -0,0 +1,542 @@ +/* fips/rand/fips_drbg_ec.c */ +/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project. + */ +/* ==================================================================== + * Copyright (c) 2011 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + */ + +#define OPENSSL_FIPSAPI + +#include +#include +#include +#include +#include +#include +#include "fips_rand_lcl.h" + +/*#define EC_DRBG_TRACE*/ + +#ifdef EC_DRBG_TRACE +static void hexprint(FILE *out, const unsigned char *buf, int buflen) + { + int i; + fprintf(out, "\t"); + for (i = 0; i < buflen; i++) + fprintf(out, "%02X", buf[i]); + fprintf(out, "\n"); + } +static void bnprint(FILE *out, const char *name, const BIGNUM *b) + { + unsigned char *tmp; + int len; + len = BN_num_bytes(b); + tmp = OPENSSL_malloc(len); + BN_bn2bin(b, tmp); + fprintf(out, "%s\n", name); + hexprint(out, tmp, len); + OPENSSL_free(tmp); + } +#if 0 +static void ecprint(FILE *out, EC_GROUP *grp, EC_POINT *pt) + { + BIGNUM *x, *y; + x = BN_new(); + y = BN_new(); + EC_POINT_get_affine_coordinates_GFp(grp, pt, x, y, NULL); + bnprint(out, "\tPoint X: ", x); + bnprint(out, "\tPoint Y: ", y); + BN_free(x); + BN_free(y); + } +#endif +#endif + +/* This is Hash_df from SP 800-90 10.4.1 */ + +static int hash_df(DRBG_CTX *dctx, unsigned char *out, + const unsigned char *in1, size_t in1len, + const unsigned char *in2, size_t in2len, + const unsigned char *in3, size_t in3len) + { + DRBG_EC_CTX *ectx = &dctx->d.ec; + EVP_MD_CTX *mctx = &ectx->mctx; + unsigned char *vtmp = ectx->vtmp; + unsigned char tmp[6]; + size_t mdlen = M_EVP_MD_size(ectx->md); + /* Standard only ever needs seedlen bytes which is always less than + * maximum permitted so no need to check length. + */ + size_t outlen = dctx->seedlen; + size_t nbits = (outlen << 3) - ectx->exbits; + tmp[0] = 1; + tmp[1] = (nbits >> 24) & 0xff; + tmp[2] = (nbits >> 16) & 0xff; + tmp[3] = (nbits >> 8) & 0xff; + tmp[4] = nbits & 0xff; + if (!in1) + { + tmp[5] = (unsigned char)in1len; + in1 = tmp + 5; + in1len = 1; + } + for (;;) + { + if (!FIPS_digestinit(mctx, ectx->md)) + return 0; + if (!FIPS_digestupdate(mctx, tmp, 5)) + return 0; + if (in1 && !FIPS_digestupdate(mctx, in1, in1len)) + return 0; + if (in2 && !FIPS_digestupdate(mctx, in2, in2len)) + return 0; + if (in3 && !FIPS_digestupdate(mctx, in3, in3len)) + return 0; + if (outlen < mdlen) + { + if (!FIPS_digestfinal(mctx, vtmp, NULL)) + return 0; + memcpy(out, vtmp, outlen); + OPENSSL_cleanse(vtmp, mdlen); + return 1; + } + else if(!FIPS_digestfinal(mctx, out, NULL)) + return 0; + + outlen -= mdlen; + if (outlen == 0) + return 1; + tmp[0]++; + out += mdlen; + } + } + +static int bn2binpad(unsigned char *to, size_t tolen, BIGNUM *b) + { + size_t blen; + blen = BN_num_bytes(b); + /* If BIGNUM length greater than buffer, mask to get rightmost + * bytes. NB: modifies b but this doesn't matter for our purposes. + */ + if (blen > tolen) + { + BN_mask_bits(b, tolen << 3); + /* Update length because mask operation might create leading + * zeroes. + */ + blen = BN_num_bytes(b); + } + /* If b length smaller than buffer pad with zeroes */ + if (blen < tolen) + { + memset(to, 0, tolen - blen); + to += tolen - blen; + } + + /* This call cannot fail */ + BN_bn2bin(b, to); + return 1; + } +/* Convert buffer to a BIGNUM discarding extra bits if necessary */ +static int bin2bnbits(DRBG_CTX *dctx, BIGNUM *r, const unsigned char *buf) + { + DRBG_EC_CTX *ectx = &dctx->d.ec; + if (!BN_bin2bn(buf, dctx->seedlen, r)) + return 0; + /* If we have extra bits right shift off the end of r */ + if (ectx->exbits) + { + if (!BN_rshift(r, r, ectx->exbits)) + return 0; + } + return 1; + } + +/* Calculate r = phi(s * P) or r= phi(s * Q) */ + +static int drbg_ec_mul(DRBG_EC_CTX *ectx, BIGNUM *r, const BIGNUM *s, int use_q) + { + if (use_q) + { + if (!EC_POINT_mul(ectx->curve, ectx->ptmp, + NULL, ectx->Q, s, ectx->bctx)) + return 0; + } + else + { + if (!EC_POINT_mul(ectx->curve, ectx->ptmp, + s, NULL, NULL, ectx->bctx)) + return 0; + } + /* Get x coordinate of result */ + if (!EC_POINT_get_affine_coordinates_GFp(ectx->curve, ectx->ptmp, r, + NULL, ectx->bctx)) + return 0; + return 1; + } + +static int drbg_ec_instantiate(DRBG_CTX *dctx, + const unsigned char *ent, size_t ent_len, + const unsigned char *nonce, size_t nonce_len, + const unsigned char *pstr, size_t pstr_len) + { + DRBG_EC_CTX *ectx = &dctx->d.ec; + if (!hash_df(dctx, ectx->sbuf, + ent, ent_len, nonce, nonce_len, pstr, pstr_len)) + return 0; + if (!bin2bnbits(dctx, ectx->s, ectx->sbuf)) + return 0; + return 1; + } + + +static int drbg_ec_reseed(DRBG_CTX *dctx, + const unsigned char *ent, size_t ent_len, + const unsigned char *adin, size_t adin_len) + { + DRBG_EC_CTX *ectx = &dctx->d.ec; + /* Convert s value to a binary buffer. Save it to tbuf as we are + * about to overwrite it. + */ + if (ectx->exbits) + BN_lshift(ectx->s, ectx->s, ectx->exbits); + bn2binpad(ectx->tbuf, dctx->seedlen, ectx->s); + if (!hash_df(dctx, ectx->sbuf, ectx->tbuf, dctx->seedlen, + ent, ent_len, adin, adin_len)) + return 0; + if (!bin2bnbits(dctx, ectx->s, ectx->sbuf)) + return 0; + dctx->reseed_counter = 0; + return 1; + } + +static int drbg_ec_generate(DRBG_CTX *dctx, + unsigned char *out, size_t outlen, + const unsigned char *adin, size_t adin_len) + { + DRBG_EC_CTX *ectx = &dctx->d.ec; + BIGNUM *t, *r; + BIGNUM *s = ectx->s; + /* special case: check reseed interval */ + if (out == NULL) + { + size_t nb = (outlen + dctx->blocklength - 1)/dctx->blocklength; + if (dctx->reseed_counter + nb > dctx->reseed_interval) + dctx->status = DRBG_STATUS_RESEED; + return 1; + } + + BN_CTX_start(ectx->bctx); + r = BN_CTX_get(ectx->bctx); + if (!r) + goto err; + if (adin && adin_len) + { + size_t i; + t = BN_CTX_get(ectx->bctx); + if (!t) + goto err; + /* Convert s to buffer */ + if (ectx->exbits) + BN_lshift(s, s, ectx->exbits); + bn2binpad(ectx->sbuf, dctx->seedlen, s); + /* Step 2 */ + if (!hash_df(dctx, ectx->tbuf, adin, adin_len, + NULL, 0, NULL, 0)) + goto err; + /* Step 5 */ + for (i = 0; i < dctx->seedlen; i++) + ectx->tbuf[i] ^= ectx->sbuf[i]; + if (!bin2bnbits(dctx, t, ectx->tbuf)) + return 0; + } + else + /* Note if no additional input the algorithm never + * needs separate values for t and s. + */ + t = s; + +#ifdef EC_DRBG_TRACE + bnprint(stderr, "s at start of generate: ", s); +#endif + + for (;;) + { + /* Step #6, calculate s = t * P */ + if (!drbg_ec_mul(ectx, s, t, 0)) + goto err; +#ifdef EC_DRBG_TRACE + bnprint(stderr, "s in generate: ", ectx->s); +#endif + /* Step #7, calculate r = s * Q */ + if (!drbg_ec_mul(ectx, r, s, 1)) + goto err; +#ifdef EC_DRBG_TRACE + bnprint(stderr, "r in generate is: ", r); +#endif + dctx->reseed_counter++; + /* Get rightmost bits of r to output buffer */ + + if (!(dctx->xflags & DRBG_FLAG_TEST) && !dctx->lb_valid) + { + if (!bn2binpad(dctx->lb, dctx->blocklength, r)) + goto err; + dctx->lb_valid = 1; + continue; + } + if (outlen < dctx->blocklength) + { + if (!bn2binpad(ectx->vtmp, dctx->blocklength, r)) + goto err; + if (!fips_drbg_cprng_test(dctx, ectx->vtmp)) + goto err; + memcpy(out, ectx->vtmp, outlen); + break; + } + else + { + if (!bn2binpad(out, dctx->blocklength, r)) + goto err; + if (!fips_drbg_cprng_test(dctx, out)) + goto err; + } + outlen -= dctx->blocklength; + if (!outlen) + break; + out += dctx->blocklength; + /* Step #5 after first pass */ + t = s; +#ifdef EC_DRBG_TRACE + fprintf(stderr, "Random bits written:\n"); + hexprint(stderr, out, dctx->blocklength); +#endif + } + if (!drbg_ec_mul(ectx, ectx->s, ectx->s, 0)) + return 0; +#ifdef EC_DRBG_TRACE + bnprint(stderr, "s after generate is: ", s); +#endif + BN_CTX_end(ectx->bctx); + return 1; + err: + BN_CTX_end(ectx->bctx); + return 0; + } + +static int drbg_ec_uninstantiate(DRBG_CTX *dctx) + { + DRBG_EC_CTX *ectx = &dctx->d.ec; + EVP_MD_CTX_cleanup(&ectx->mctx); + EC_GROUP_free(ectx->curve); + EC_POINT_free(ectx->Q); + EC_POINT_free(ectx->ptmp); + BN_clear_free(ectx->s); + BN_CTX_free(ectx->bctx); + OPENSSL_cleanse(&dctx->d.ec, sizeof(DRBG_EC_CTX)); + return 1; + } + +/* Q points from SP 800-90 A.1, P is generator */ + +__fips_constseg +static const unsigned char p_256_qx[] = { + 0xc9,0x74,0x45,0xf4,0x5c,0xde,0xf9,0xf0,0xd3,0xe0,0x5e,0x1e, + 0x58,0x5f,0xc2,0x97,0x23,0x5b,0x82,0xb5,0xbe,0x8f,0xf3,0xef, + 0xca,0x67,0xc5,0x98,0x52,0x01,0x81,0x92 +}; +__fips_constseg +static const unsigned char p_256_qy[] = { + 0xb2,0x8e,0xf5,0x57,0xba,0x31,0xdf,0xcb,0xdd,0x21,0xac,0x46, + 0xe2,0xa9,0x1e,0x3c,0x30,0x4f,0x44,0xcb,0x87,0x05,0x8a,0xda, + 0x2c,0xb8,0x15,0x15,0x1e,0x61,0x00,0x46 +}; + +__fips_constseg +static const unsigned char p_384_qx[] = { + 0x8e,0x72,0x2d,0xe3,0x12,0x5b,0xdd,0xb0,0x55,0x80,0x16,0x4b, + 0xfe,0x20,0xb8,0xb4,0x32,0x21,0x6a,0x62,0x92,0x6c,0x57,0x50, + 0x2c,0xee,0xde,0x31,0xc4,0x78,0x16,0xed,0xd1,0xe8,0x97,0x69, + 0x12,0x41,0x79,0xd0,0xb6,0x95,0x10,0x64,0x28,0x81,0x50,0x65 +}; +__fips_constseg +static const unsigned char p_384_qy[] = { + 0x02,0x3b,0x16,0x60,0xdd,0x70,0x1d,0x08,0x39,0xfd,0x45,0xee, + 0xc3,0x6f,0x9e,0xe7,0xb3,0x2e,0x13,0xb3,0x15,0xdc,0x02,0x61, + 0x0a,0xa1,0xb6,0x36,0xe3,0x46,0xdf,0x67,0x1f,0x79,0x0f,0x84, + 0xc5,0xe0,0x9b,0x05,0x67,0x4d,0xbb,0x7e,0x45,0xc8,0x03,0xdd +}; + +__fips_constseg +static const unsigned char p_521_qx[] = { + 0x01,0xb9,0xfa,0x3e,0x51,0x8d,0x68,0x3c,0x6b,0x65,0x76,0x36, + 0x94,0xac,0x8e,0xfb,0xae,0xc6,0xfa,0xb4,0x4f,0x22,0x76,0x17, + 0x1a,0x42,0x72,0x65,0x07,0xdd,0x08,0xad,0xd4,0xc3,0xb3,0xf4, + 0xc1,0xeb,0xc5,0xb1,0x22,0x2d,0xdb,0xa0,0x77,0xf7,0x22,0x94, + 0x3b,0x24,0xc3,0xed,0xfa,0x0f,0x85,0xfe,0x24,0xd0,0xc8,0xc0, + 0x15,0x91,0xf0,0xbe,0x6f,0x63 +}; +__fips_constseg +static const unsigned char p_521_qy[] = { + 0x01,0xf3,0xbd,0xba,0x58,0x52,0x95,0xd9,0xa1,0x11,0x0d,0x1d, + 0xf1,0xf9,0x43,0x0e,0xf8,0x44,0x2c,0x50,0x18,0x97,0x6f,0xf3, + 0x43,0x7e,0xf9,0x1b,0x81,0xdc,0x0b,0x81,0x32,0xc8,0xd5,0xc3, + 0x9c,0x32,0xd0,0xe0,0x04,0xa3,0x09,0x2b,0x7d,0x32,0x7c,0x0e, + 0x7a,0x4d,0x26,0xd2,0xc7,0xb6,0x9b,0x58,0xf9,0x06,0x66,0x52, + 0x91,0x1e,0x45,0x77,0x79,0xde +}; + +int fips_drbg_ec_init(DRBG_CTX *dctx) + { + const EVP_MD *md; + const unsigned char *Q_x, *Q_y; + BIGNUM *x, *y; + size_t ptlen; + int md_nid = dctx->type & 0xffff; + int curve_nid = dctx->type >> 16; + DRBG_EC_CTX *ectx = &dctx->d.ec; + md = FIPS_get_digestbynid(md_nid); + if (!md) + return -2; + + /* These are taken from SP 800-90 10.3.1 table 4 */ + switch (curve_nid) + { + case NID_X9_62_prime256v1: + dctx->strength = 128; + dctx->seedlen = 32; + dctx->blocklength = 30; + ectx->exbits = 0; + Q_x = p_256_qx; + Q_y = p_256_qy; + ptlen = sizeof(p_256_qx); + break; + + case NID_secp384r1: + if (md_nid == NID_sha1) + return -2; + dctx->strength = 192; + dctx->seedlen = 48; + dctx->blocklength = 46; + ectx->exbits = 0; + Q_x = p_384_qx; + Q_y = p_384_qy; + ptlen = sizeof(p_384_qx); + break; + + case NID_secp521r1: + if (md_nid == NID_sha1 || md_nid == NID_sha224) + return -2; + dctx->strength = 256; + dctx->seedlen = 66; + dctx->blocklength = 63; + ectx->exbits = 7; + Q_x = p_521_qx; + Q_y = p_521_qy; + ptlen = sizeof(p_521_qx); + break; + + default: + return -2; + } + + dctx->iflags |= DRBG_CUSTOM_RESEED; + dctx->reseed_counter = 0; + dctx->instantiate = drbg_ec_instantiate; + dctx->reseed = drbg_ec_reseed; + dctx->generate = drbg_ec_generate; + dctx->uninstantiate = drbg_ec_uninstantiate; + + ectx->md = md; + EVP_MD_CTX_init(&ectx->mctx); + + dctx->min_entropy = dctx->strength / 8; + dctx->max_entropy = 2 << 10; + + dctx->min_nonce = dctx->min_entropy / 2; + dctx->max_nonce = 2 << 10; + + dctx->max_pers = 2 << 10; + dctx->max_adin = 2 << 10; + + dctx->reseed_interval = 1<<24; + dctx->max_request = dctx->reseed_interval * dctx->blocklength; + + /* Setup internal structures */ + ectx->bctx = BN_CTX_new(); + if (!ectx->bctx) + return 0; + BN_CTX_start(ectx->bctx); + + ectx->s = BN_new(); + + ectx->curve = EC_GROUP_new_by_curve_name(curve_nid); + + ectx->Q = EC_POINT_new(ectx->curve); + ectx->ptmp = EC_POINT_new(ectx->curve); + + x = BN_CTX_get(ectx->bctx); + y = BN_CTX_get(ectx->bctx); + + if (!ectx->s || !ectx->curve || !ectx->Q || !y) + goto err; + + if (!BN_bin2bn(Q_x, ptlen, x) || !BN_bin2bn(Q_y, ptlen, y)) + goto err; + if (!EC_POINT_set_affine_coordinates_GFp(ectx->curve, ectx->Q, + x, y, ectx->bctx)) + goto err; + + BN_CTX_end(ectx->bctx); + + return 1; + err: + BN_CTX_end(ectx->bctx); + drbg_ec_uninstantiate(dctx); + return 0; + } diff --git a/fips/rand/fips_drbg_lib.c b/fips/rand/fips_drbg_lib.c index bb2e168d13..ee162d05eb 100644 --- a/fips/rand/fips_drbg_lib.c +++ b/fips/rand/fips_drbg_lib.c @@ -79,6 +79,8 @@ int FIPS_drbg_init(DRBG_CTX *dctx, int type, unsigned int flags) rv = fips_drbg_ctr_init(dctx); if (rv == -2) rv = fips_drbg_hmac_init(dctx); + if (rv == -2) + rv = fips_drbg_ec_init(dctx); if (rv <= 0) { diff --git a/fips/rand/fips_drbg_selftest.c b/fips/rand/fips_drbg_selftest.c index bd1a5fddd3..a787323d6d 100644 --- a/fips/rand/fips_drbg_selftest.c +++ b/fips/rand/fips_drbg_selftest.c @@ -133,6 +133,9 @@ typedef struct { #define make_drbg_test_data_df(nid, pr, p) \ make_drbg_test_data(nid, DRBG_FLAG_CTR_USE_DF, pr, p) +#define make_drbg_test_data_ec(curve, md, pr, p) \ + make_drbg_test_data((curve << 16) | md , 0, pr, p) + static DRBG_SELFTEST_DATA drbg_test[] = { make_drbg_test_data_df(NID_aes_128_ctr, aes_128_use_df, 0), make_drbg_test_data_df(NID_aes_192_ctr, aes_192_use_df, 0), @@ -150,6 +153,18 @@ static DRBG_SELFTEST_DATA drbg_test[] = { make_drbg_test_data(NID_hmacWithSHA256, 0, hmac_sha256, 1), make_drbg_test_data(NID_hmacWithSHA384, 0, hmac_sha384, 0), make_drbg_test_data(NID_hmacWithSHA512, 0, hmac_sha512, 0), + make_drbg_test_data_ec(NID_X9_62_prime256v1, NID_sha1, p_256_sha1, 0), + make_drbg_test_data_ec(NID_X9_62_prime256v1, NID_sha224, p_256_sha224, 0), + make_drbg_test_data_ec(NID_X9_62_prime256v1, NID_sha256, p_256_sha256, 1), + make_drbg_test_data_ec(NID_X9_62_prime256v1, NID_sha384, p_256_sha384, 0), + make_drbg_test_data_ec(NID_X9_62_prime256v1, NID_sha512, p_256_sha512, 0), + make_drbg_test_data_ec(NID_secp384r1, NID_sha224, p_384_sha224, 0), + make_drbg_test_data_ec(NID_secp384r1, NID_sha256, p_384_sha256, 0), + make_drbg_test_data_ec(NID_secp384r1, NID_sha384, p_384_sha384, 0), + make_drbg_test_data_ec(NID_secp384r1, NID_sha512, p_384_sha512, 0), + make_drbg_test_data_ec(NID_secp521r1, NID_sha256, p_521_sha256, 0), + make_drbg_test_data_ec(NID_secp521r1, NID_sha384, p_521_sha384, 0), + make_drbg_test_data_ec(NID_secp521r1, NID_sha512, p_521_sha512, 0), {0,0,0} }; diff --git a/fips/rand/fips_drbg_selftest.h b/fips/rand/fips_drbg_selftest.h index f74cc89a87..31e1961553 100644 --- a/fips/rand/fips_drbg_selftest.h +++ b/fips/rand/fips_drbg_selftest.h @@ -2332,3 +2332,1681 @@ static const unsigned char hmac_sha512_returnedbits[] = 0xc2,0xd6,0xfd,0xa5 }; + +/* P-256 SHA-1 PR */ +__fips_constseg +static const unsigned char p_256_sha1_pr_entropyinput[] = + { + 0xb7,0xd4,0x38,0x90,0x9a,0xa8,0xfc,0xb6,0xd6,0x3c,0xc5,0x35, + 0x2b,0x0b,0x0e,0x1f + }; + +__fips_constseg +static const unsigned char p_256_sha1_pr_nonce[] = + { + 0xd9,0xae,0xf5,0xe8,0xd5,0x10,0x1f,0x82 + }; + +__fips_constseg +static const unsigned char p_256_sha1_pr_personalizationstring[] = + { + 0x88,0xe8,0x77,0xab,0x01,0x19,0x5e,0xaf,0x50,0x6c,0x89,0x2d, + 0x0c,0x12,0xe2,0x11 + }; + +__fips_constseg +static const unsigned char p_256_sha1_pr_additionalinput[] = + { + 0xd1,0x46,0xa6,0xb0,0x6e,0xc5,0xaa,0x7b,0x6d,0x1a,0xf9,0x36, + 0x8c,0x95,0x9c,0xed + }; + +__fips_constseg +static const unsigned char p_256_sha1_pr_entropyinputpr[] = + { + 0xb0,0x97,0xa8,0x3e,0xd3,0x28,0x3d,0x36,0xdd,0xfe,0x89,0x00, + 0x63,0x4f,0x21,0xfc + }; + +__fips_constseg +static const unsigned char p_256_sha1_pr_int_returnedbits[] = + { + 0x9f,0x66,0x6a,0x38,0x57,0x49,0x15,0xcd,0x5a,0x85,0x03,0x97, + 0x67,0xc3,0x62,0x46,0xb7,0x3a,0xd2,0x08,0x86,0x40,0x4e,0x6d, + 0x67,0xf4,0x19,0x68,0x92,0x63 + }; + +__fips_constseg +static const unsigned char p_256_sha1_pr_additionalinput2[] = + { + 0x0c,0xb6,0x1c,0xc7,0x52,0x47,0xe4,0xf1,0xa7,0x75,0x60,0x3d, + 0x60,0x07,0x72,0x6f + }; + +__fips_constseg +static const unsigned char p_256_sha1_pr_entropyinputpr2[] = + { + 0x39,0x37,0xb6,0x55,0x82,0x71,0x0e,0xd4,0x8f,0x8c,0x10,0xe5, + 0x7c,0x8f,0x5e,0x37 + }; + +__fips_constseg +static const unsigned char p_256_sha1_pr_returnedbits[] = + { + 0x37,0x6c,0x94,0x02,0xbe,0x28,0x42,0xd5,0xe7,0x4d,0x1a,0x6e, + 0xa8,0x5a,0x90,0x9a,0x31,0xa8,0x84,0x16,0xbc,0xe9,0x18,0xa4, + 0xe1,0xa1,0x05,0xf0,0x2a,0xe3 + }; + + +/* P-256 SHA-1 No PR */ +__fips_constseg +static const unsigned char p_256_sha1_entropyinput[] = + { + 0xac,0x08,0x45,0x86,0x79,0xfc,0x4b,0xb4,0x8b,0xe4,0xfd,0x1d, + 0x0e,0xeb,0x1b,0x8f + }; + +__fips_constseg +static const unsigned char p_256_sha1_nonce[] = + { + 0x5e,0xf4,0xe9,0xc5,0x04,0xee,0xb7,0x8a + }; + +__fips_constseg +static const unsigned char p_256_sha1_personalizationstring[] = + { + 0x55,0x0f,0xca,0x3b,0x1c,0xa6,0xf3,0xce,0xcb,0x6f,0xa7,0xc7, + 0x26,0x65,0x0f,0x7c + }; + +__fips_constseg +static const unsigned char p_256_sha1_additionalinput[] = + { + 0x74,0x51,0x73,0xa9,0xee,0x2e,0x21,0xf9,0xba,0x07,0xe4,0xad, + 0x97,0xae,0x1c,0x8b + }; + +__fips_constseg +static const unsigned char p_256_sha1_int_returnedbits[] = + { + 0x8d,0x45,0x11,0xa9,0x74,0x14,0x05,0x94,0x97,0x66,0x71,0xe2, + 0x9b,0x61,0x22,0x85,0xa5,0xaa,0x09,0x01,0x75,0xb5,0xab,0x3a, + 0x3a,0x6e,0x69,0xd3,0xc8,0xc4 + }; + +__fips_constseg +static const unsigned char p_256_sha1_entropyinputreseed[] = + { + 0x34,0xd9,0x8b,0x67,0x82,0xaf,0x97,0x95,0xe9,0x25,0xa7,0x93, + 0x37,0x06,0x73,0x5c + }; + +__fips_constseg +static const unsigned char p_256_sha1_additionalinputreseed[] = + { + 0x39,0x21,0x24,0x27,0x67,0xa1,0xc3,0xc4,0x90,0xc2,0x68,0x68, + 0x26,0x9b,0x32,0xc2 + }; + +__fips_constseg +static const unsigned char p_256_sha1_additionalinput2[] = + { + 0x84,0xa8,0x10,0xe5,0x71,0x0c,0x1e,0x74,0x42,0x6a,0xa5,0x09, + 0x90,0x74,0x39,0xd7 + }; + +__fips_constseg +static const unsigned char p_256_sha1_returnedbits[] = + { + 0x1e,0x0b,0x5c,0x41,0xcd,0xab,0x07,0xbd,0xdc,0x53,0xa7,0x62, + 0xd1,0xd0,0xca,0x19,0xe6,0xbb,0x8e,0xcf,0x1e,0x0a,0x4c,0xc0, + 0x2d,0x8c,0xe2,0xa4,0x89,0x2c + }; + + +/* P-256 SHA-224 PR */ +__fips_constseg +static const unsigned char p_256_sha224_pr_entropyinput[] = + { + 0x92,0x05,0xf0,0x1e,0xc4,0xc4,0x9e,0xab,0x85,0x10,0x16,0xda, + 0xa6,0xb4,0xba,0x6f + }; + +__fips_constseg +static const unsigned char p_256_sha224_pr_nonce[] = + { + 0xa3,0x5e,0xde,0x12,0xdc,0xa7,0x67,0xfd + }; + +__fips_constseg +static const unsigned char p_256_sha224_pr_personalizationstring[] = + { + 0x76,0xa0,0x8d,0x6c,0x0d,0x19,0x5d,0x94,0x9b,0x92,0x67,0x78, + 0x6c,0x02,0xfe,0xe4 + }; + +__fips_constseg +static const unsigned char p_256_sha224_pr_additionalinput[] = + { + 0xe2,0x05,0xcf,0x63,0x0f,0xf1,0xd0,0x41,0xc9,0xe3,0xf6,0xb0, + 0x57,0xaa,0xcd,0x92 + }; + +__fips_constseg +static const unsigned char p_256_sha224_pr_entropyinputpr[] = + { + 0x1a,0xd5,0xa9,0x25,0x52,0xa8,0xba,0x51,0x81,0x99,0x62,0x4d, + 0xbf,0x30,0x44,0xf3 + }; + +__fips_constseg +static const unsigned char p_256_sha224_pr_int_returnedbits[] = + { + 0xbf,0x9e,0x45,0x73,0x67,0x4b,0x25,0xa5,0x58,0x23,0x31,0xd8, + 0x0f,0xf3,0xe5,0x5d,0x0e,0x2d,0x9b,0x4a,0x5f,0x93,0x9c,0xad, + 0x6a,0xc5,0x70,0x4e,0x5e,0x58 + }; + +__fips_constseg +static const unsigned char p_256_sha224_pr_additionalinput2[] = + { + 0x4a,0x85,0x19,0xb2,0x61,0x5d,0xd5,0xc0,0x1f,0x47,0x72,0x8b, + 0x62,0x35,0x19,0xc1 + }; + +__fips_constseg +static const unsigned char p_256_sha224_pr_entropyinputpr2[] = + { + 0xda,0xa7,0x84,0x3f,0xfa,0xf9,0xd1,0x51,0x17,0xf8,0xe3,0x77, + 0xf5,0x20,0x37,0x17 + }; + +__fips_constseg +static const unsigned char p_256_sha224_pr_returnedbits[] = + { + 0x15,0xa4,0xa1,0x53,0x4f,0x63,0x06,0xfe,0x28,0xfd,0x58,0xa9, + 0xac,0x9c,0x83,0xb7,0x3a,0x86,0x82,0x92,0x96,0x89,0xea,0x3d, + 0xbd,0x83,0x3a,0x06,0x2a,0x7d + }; + + +/* P-256 SHA-224 No PR */ +__fips_constseg +static const unsigned char p_256_sha224_entropyinput[] = + { + 0xec,0x5b,0x46,0x4a,0xe1,0xe1,0xcb,0x31,0x86,0xa7,0x11,0x3a, + 0xff,0x87,0x4a,0x66 + }; + +__fips_constseg +static const unsigned char p_256_sha224_nonce[] = + { + 0xd1,0x6c,0x33,0x3c,0x37,0xc9,0xc6,0xac + }; + +__fips_constseg +static const unsigned char p_256_sha224_personalizationstring[] = + { + 0x8b,0xfe,0x68,0x96,0x2d,0xc5,0x91,0xb3,0xf2,0xaa,0x15,0xad, + 0x1a,0x50,0x0c,0x0a + }; + +__fips_constseg +static const unsigned char p_256_sha224_additionalinput[] = + { + 0xd4,0x48,0xfd,0x16,0x41,0xea,0xef,0x06,0x7f,0x4a,0xa2,0x60, + 0x60,0x31,0x20,0x5d + }; + +__fips_constseg +static const unsigned char p_256_sha224_int_returnedbits[] = + { + 0x68,0x64,0x67,0x0c,0x73,0x08,0x00,0x60,0x5a,0xa6,0x9a,0x27, + 0x01,0x81,0xae,0x2e,0x1d,0xa6,0x0a,0x86,0x77,0xef,0x05,0x3f, + 0x42,0xbe,0x46,0x73,0x40,0x1c + }; + +__fips_constseg +static const unsigned char p_256_sha224_entropyinputreseed[] = + { + 0x9c,0xde,0x86,0x11,0x55,0x9a,0xb4,0x2b,0x70,0xf0,0xc6,0x9d, + 0x8d,0x3a,0xc3,0x1e + }; + +__fips_constseg +static const unsigned char p_256_sha224_additionalinputreseed[] = + { + 0x5d,0x5b,0xeb,0x38,0xc5,0x8b,0x2b,0xc8,0x73,0xe3,0x0e,0xca, + 0x35,0xb0,0x4d,0x11 + }; + +__fips_constseg +static const unsigned char p_256_sha224_additionalinput2[] = + { + 0xf7,0xa3,0x79,0x4b,0xb0,0x2c,0x1e,0xc6,0x61,0x69,0x14,0x6a, + 0xed,0xf1,0xa2,0xd8 + }; + +__fips_constseg +static const unsigned char p_256_sha224_returnedbits[] = + { + 0x89,0x75,0x1b,0x89,0x20,0xcc,0xe2,0xaf,0xae,0x5e,0xc1,0xa9, + 0xde,0xc0,0x35,0x0b,0xf6,0x4e,0x04,0xfc,0xa7,0xe6,0x35,0xf9, + 0x16,0x8a,0xc6,0x0c,0x63,0x6b + }; + + +/* P-256 SHA-256 PR */ +__fips_constseg +static const unsigned char p_256_sha256_pr_entropyinput[] = + { + 0x22,0xe4,0x4c,0x01,0x94,0x59,0xce,0x08,0xb3,0x92,0x48,0xe2, + 0x0d,0x1a,0x32,0x4d + }; + +__fips_constseg +static const unsigned char p_256_sha256_pr_nonce[] = + { + 0x8d,0xf9,0x20,0x8a,0x65,0xf4,0x93,0x37 + }; + +__fips_constseg +static const unsigned char p_256_sha256_pr_personalizationstring[] = + { + 0x06,0x7e,0xe8,0x4f,0xdd,0xae,0x8d,0xf1,0xc9,0x13,0x9a,0x81, + 0xd3,0x68,0x76,0xc1 + }; + +__fips_constseg +static const unsigned char p_256_sha256_pr_additionalinput[] = + { + 0xfa,0x8e,0xea,0xf3,0xcf,0xda,0x7c,0x11,0x88,0xaa,0xb9,0x02, + 0x84,0xc4,0x30,0x54 + }; + +__fips_constseg +static const unsigned char p_256_sha256_pr_entropyinputpr[] = + { + 0xbb,0x21,0x72,0x4f,0x83,0x03,0x14,0x18,0x8e,0x88,0xec,0x73, + 0xde,0xed,0x60,0xf7 + }; + +__fips_constseg +static const unsigned char p_256_sha256_pr_int_returnedbits[] = + { + 0xdc,0x40,0x73,0x5e,0x1d,0x21,0x35,0x8c,0xcf,0xa4,0x50,0x05, + 0x5e,0x73,0xbd,0xde,0x5e,0x58,0xcc,0xc0,0x6f,0xd9,0xca,0x8d, + 0x48,0x9d,0x84,0x77,0xc2,0x8e + }; + +__fips_constseg +static const unsigned char p_256_sha256_pr_additionalinput2[] = + { + 0x0e,0xa7,0x4d,0x4f,0x19,0x94,0x34,0x05,0x46,0x3e,0x0c,0x05, + 0x27,0x85,0xd9,0xdf + }; + +__fips_constseg +static const unsigned char p_256_sha256_pr_entropyinputpr2[] = + { + 0x4f,0xae,0x44,0x10,0x2b,0xa1,0xbc,0xd7,0xcb,0xa7,0x49,0x55, + 0x27,0x54,0x36,0x2b + }; + +__fips_constseg +static const unsigned char p_256_sha256_pr_returnedbits[] = + { + 0x1c,0x16,0xf7,0x2b,0xd0,0xb7,0x54,0x5a,0xa5,0x85,0x14,0x63, + 0xd4,0x96,0x81,0x5a,0x6b,0xa4,0xde,0x57,0xbf,0xf3,0x81,0xc7, + 0xf5,0xbc,0xeb,0x4e,0x49,0xdf + }; + + +/* P-256 SHA-256 No PR */ +__fips_constseg +static const unsigned char p_256_sha256_entropyinput[] = + { + 0xa7,0x0b,0x6b,0xf7,0xfb,0x40,0x1a,0xca,0xa9,0x1f,0x16,0xc9, + 0x6a,0xd0,0x4a,0x8c + }; + +__fips_constseg +static const unsigned char p_256_sha256_nonce[] = + { + 0x97,0x8e,0xb1,0x72,0xe8,0x30,0xfc,0x43 + }; + +__fips_constseg +static const unsigned char p_256_sha256_personalizationstring[] = + { + 0x6c,0x90,0x00,0x41,0x84,0x7c,0x58,0x56,0x48,0xf0,0x60,0x04, + 0xe9,0xc0,0xa0,0xd8 + }; + +__fips_constseg +static const unsigned char p_256_sha256_additionalinput[] = + { + 0x69,0xad,0xd7,0x7c,0xbd,0x90,0xa1,0x63,0xcd,0x64,0x7c,0xb3, + 0xce,0xff,0xf2,0xf7 + }; + +__fips_constseg +static const unsigned char p_256_sha256_int_returnedbits[] = + { + 0xe8,0x5a,0x4f,0x5d,0xab,0xc7,0xd2,0x94,0x4d,0xbf,0x02,0x57, + 0xa1,0x89,0x73,0xa1,0xc2,0xca,0xfb,0x46,0x11,0x41,0x47,0x8e, + 0x32,0x45,0xd7,0x8a,0x8a,0x38 + }; + +__fips_constseg +static const unsigned char p_256_sha256_entropyinputreseed[] = + { + 0x5c,0xb4,0x82,0x38,0xa2,0x2d,0x78,0x63,0x2a,0x38,0x77,0x5b, + 0x9a,0x59,0x4d,0x17 + }; + +__fips_constseg +static const unsigned char p_256_sha256_additionalinputreseed[] = + { + 0x43,0x28,0x7f,0x91,0x92,0xad,0x88,0x75,0x64,0xe5,0xef,0x95, + 0x59,0xa9,0x11,0x61 + }; + +__fips_constseg +static const unsigned char p_256_sha256_additionalinput2[] = + { + 0x77,0xee,0xfc,0x84,0x5b,0x69,0xdf,0x9f,0x7e,0xf2,0xb1,0x35, + 0x34,0x28,0x8f,0xcd + }; + +__fips_constseg +static const unsigned char p_256_sha256_returnedbits[] = + { + 0x2d,0x45,0x00,0x60,0x87,0x6c,0xfa,0x69,0x06,0x9e,0x99,0xf9, + 0xf6,0xb6,0x1e,0xf6,0xfb,0x6b,0x54,0x68,0x1a,0xd3,0xda,0x31, + 0x3e,0x60,0x4a,0x31,0x7d,0x41 + }; + + +/* P-256 SHA-384 PR */ +__fips_constseg +static const unsigned char p_256_sha384_pr_entropyinput[] = + { + 0xb3,0x6a,0x1b,0x68,0xe3,0x8a,0xa4,0xad,0x2d,0xa0,0x6a,0xae, + 0x10,0xe5,0x55,0x58 + }; + +__fips_constseg +static const unsigned char p_256_sha384_pr_nonce[] = + { + 0xe2,0xe8,0xd4,0x8d,0xc8,0x47,0xad,0x79 + }; + +__fips_constseg +static const unsigned char p_256_sha384_pr_personalizationstring[] = + { + 0xf9,0xbb,0xac,0xe9,0xd9,0x8a,0x58,0xae,0x58,0xa6,0x68,0xd2, + 0xff,0x49,0x71,0x08 + }; + +__fips_constseg +static const unsigned char p_256_sha384_pr_additionalinput[] = + { + 0xa7,0xa3,0xcc,0xc1,0xbf,0xa7,0x32,0xe8,0xcb,0x21,0xf4,0x35, + 0x42,0xa6,0xdd,0x4b + }; + +__fips_constseg +static const unsigned char p_256_sha384_pr_entropyinputpr[] = + { + 0x37,0xdb,0x5a,0x83,0x9c,0x7a,0x50,0xe3,0xc7,0xbd,0x50,0x63, + 0x88,0x44,0xa1,0x50 + }; + +__fips_constseg +static const unsigned char p_256_sha384_pr_int_returnedbits[] = + { + 0x65,0x3a,0xdd,0x95,0x3a,0x52,0xd7,0x7f,0x8d,0x81,0x1b,0x53, + 0x4e,0xa9,0x5b,0x80,0xa2,0x08,0x1e,0xf5,0x7f,0xac,0x62,0x28, + 0xbc,0x1c,0x02,0xd2,0xe9,0x1e + }; + +__fips_constseg +static const unsigned char p_256_sha384_pr_additionalinput2[] = + { + 0xb3,0xff,0xbc,0x54,0x38,0x49,0x1f,0xad,0x3f,0x33,0x5f,0x45, + 0x21,0x2f,0xcf,0xba + }; + +__fips_constseg +static const unsigned char p_256_sha384_pr_entropyinputpr2[] = + { + 0x43,0x37,0x4a,0x16,0x15,0x1d,0x3d,0xa9,0x3b,0xcf,0xbb,0x73, + 0x67,0xce,0x93,0xbf + }; + +__fips_constseg +static const unsigned char p_256_sha384_pr_returnedbits[] = + { + 0x1e,0x1b,0x69,0x67,0xb8,0xd7,0xb4,0x18,0xb8,0xa0,0x11,0xc7, + 0x5f,0xd7,0x14,0xb7,0x24,0xae,0xa5,0x35,0x06,0xa0,0xd0,0x7f, + 0xcd,0x9b,0x20,0x03,0x66,0xc0 + }; + + +/* P-256 SHA-384 No PR */ +__fips_constseg +static const unsigned char p_256_sha384_entropyinput[] = + { + 0x1c,0x0d,0xa7,0x27,0x1f,0xb4,0xa2,0x4a,0xe5,0x25,0x00,0xbe, + 0xbe,0x80,0x88,0xa8 + }; + +__fips_constseg +static const unsigned char p_256_sha384_nonce[] = + { + 0x2c,0x7e,0x21,0x02,0x46,0x9e,0xe5,0xae + }; + +__fips_constseg +static const unsigned char p_256_sha384_personalizationstring[] = + { + 0x0a,0xf6,0x83,0xa9,0x7b,0x97,0x20,0x60,0xcc,0x46,0x0e,0x52, + 0xd0,0xcb,0x57,0xb5 + }; + +__fips_constseg +static const unsigned char p_256_sha384_additionalinput[] = + { + 0xac,0xd8,0x25,0xef,0x85,0xa8,0x5e,0x55,0x89,0x5b,0x6e,0xf6, + 0x4d,0x4d,0x05,0x53 + }; + +__fips_constseg +static const unsigned char p_256_sha384_int_returnedbits[] = + { + 0x5c,0x71,0x32,0x2f,0x34,0x09,0x99,0x6a,0x4e,0x55,0xaf,0x4b, + 0x73,0x32,0xb5,0xad,0x52,0x4c,0x54,0xa0,0x25,0x3b,0xd9,0x70, + 0xe5,0xe4,0x6f,0x61,0xab,0x8c + }; + +__fips_constseg +static const unsigned char p_256_sha384_entropyinputreseed[] = + { + 0x4b,0x0d,0xa9,0x66,0xc3,0x64,0xe9,0xd5,0x87,0xb1,0x98,0xc2, + 0xeb,0x14,0xd2,0x8a + }; + +__fips_constseg +static const unsigned char p_256_sha384_additionalinputreseed[] = + { + 0x1f,0x11,0x6b,0xc0,0x15,0x38,0xbd,0x62,0x27,0xf7,0x6d,0x97, + 0x77,0xd1,0xcc,0x00 + }; + +__fips_constseg +static const unsigned char p_256_sha384_additionalinput2[] = + { + 0x1d,0x9a,0xe5,0xfc,0xed,0x93,0x3d,0xbb,0x08,0xf3,0xba,0x01, + 0x6f,0x9f,0xdf,0xb1 + }; + +__fips_constseg +static const unsigned char p_256_sha384_returnedbits[] = + { + 0x4a,0xd5,0xd3,0x62,0xbb,0x6e,0x6c,0xb2,0x1c,0x0e,0xf6,0x97, + 0xd3,0x15,0x18,0xb5,0x42,0x59,0xc4,0xf6,0xa9,0x8f,0x1b,0xff, + 0xaa,0xf8,0xf9,0x9c,0xba,0x47 + }; + + +/* P-256 SHA-512 PR */ +__fips_constseg +static const unsigned char p_256_sha512_pr_entropyinput[] = + { + 0x73,0x83,0x07,0x93,0x85,0x39,0x2f,0x96,0xcd,0x74,0x32,0x4d, + 0x68,0x0e,0x97,0x9d + }; + +__fips_constseg +static const unsigned char p_256_sha512_pr_nonce[] = + { + 0xab,0xc6,0xf4,0x38,0x72,0x9b,0x9f,0x36 + }; + +__fips_constseg +static const unsigned char p_256_sha512_pr_personalizationstring[] = + { + 0x88,0x8e,0xc1,0xaf,0xe9,0x1b,0x8a,0xf5,0xf2,0x23,0x44,0x71, + 0xf5,0x9a,0xed,0x5e + }; + +__fips_constseg +static const unsigned char p_256_sha512_pr_additionalinput[] = + { + 0x38,0xf7,0x2b,0x11,0x7b,0xd6,0xfa,0xbd,0x07,0x42,0x46,0x77, + 0xed,0x1b,0x3f,0x95 + }; + +__fips_constseg +static const unsigned char p_256_sha512_pr_entropyinputpr[] = + { + 0x52,0xf2,0x68,0x6d,0xc9,0x1b,0xc7,0xb0,0x52,0x07,0x69,0x79, + 0x25,0x5d,0xbb,0xdb + }; + +__fips_constseg +static const unsigned char p_256_sha512_pr_int_returnedbits[] = + { + 0x23,0xa6,0x84,0x48,0x4f,0xd3,0x1f,0x56,0x57,0xae,0x50,0xea, + 0x9f,0x2b,0x47,0x80,0x6a,0x46,0x10,0x54,0x1d,0x77,0x67,0x79, + 0x45,0xbb,0x1d,0x90,0x2c,0xce + }; + +__fips_constseg +static const unsigned char p_256_sha512_pr_additionalinput2[] = + { + 0x9c,0x46,0x61,0x85,0x2c,0x9e,0x2c,0xd0,0x4d,0xcd,0x73,0x78, + 0x08,0x8d,0x49,0x5b + }; + +__fips_constseg +static const unsigned char p_256_sha512_pr_entropyinputpr2[] = + { + 0x71,0x60,0x46,0x14,0xc1,0xaa,0x21,0xc8,0xf1,0xfe,0x32,0x90, + 0x46,0xfd,0xe9,0x80 + }; + +__fips_constseg +static const unsigned char p_256_sha512_pr_returnedbits[] = + { + 0x7a,0x30,0x7d,0x6e,0xb1,0x22,0xb9,0x68,0x7d,0x00,0x14,0x63, + 0xca,0xe2,0x06,0x03,0xe0,0x94,0xbb,0x45,0x14,0x2d,0xd2,0xd1, + 0xfb,0x35,0xfd,0xe6,0xf1,0x81 + }; + + +/* P-256 SHA-512 No PR */ +__fips_constseg +static const unsigned char p_256_sha512_entropyinput[] = + { + 0x55,0xd0,0x7f,0xb7,0x23,0x81,0x95,0x38,0xa7,0xbf,0x01,0x8d, + 0x06,0x8b,0xbc,0x47 + }; + +__fips_constseg +static const unsigned char p_256_sha512_nonce[] = + { + 0x96,0xab,0x85,0xba,0x88,0x7b,0xf5,0x6e + }; + +__fips_constseg +static const unsigned char p_256_sha512_personalizationstring[] = + { + 0xea,0x25,0x60,0xd0,0x5d,0xd8,0x9c,0x8d,0x43,0x23,0x49,0x0a, + 0xd5,0x57,0xf3,0x54 + }; + +__fips_constseg +static const unsigned char p_256_sha512_additionalinput[] = + { + 0x8e,0xe8,0xfd,0x2e,0xcd,0x27,0xc6,0x7e,0x7a,0xf8,0xe7,0x11, + 0xb8,0x0d,0x20,0x36 + }; + +__fips_constseg +static const unsigned char p_256_sha512_int_returnedbits[] = + { + 0x57,0x18,0x20,0x51,0xd7,0x57,0x13,0xb0,0xa0,0x8f,0x92,0xd2, + 0xf5,0xa0,0x85,0xf3,0xac,0x64,0xb7,0x6b,0x94,0xde,0x9f,0xda, + 0x0a,0x04,0x11,0xdf,0x52,0x27 + }; + +__fips_constseg +static const unsigned char p_256_sha512_entropyinputreseed[] = + { + 0x89,0x1d,0x17,0x0c,0xe4,0x82,0x34,0xe7,0x81,0x6c,0x47,0x47, + 0xc6,0x49,0x50,0x3e + }; + +__fips_constseg +static const unsigned char p_256_sha512_additionalinputreseed[] = + { + 0xe7,0xe4,0x88,0x00,0xa7,0xc9,0xb7,0x6b,0x70,0xda,0xe3,0xf0, + 0x44,0xa9,0x02,0xf6 + }; + +__fips_constseg +static const unsigned char p_256_sha512_additionalinput2[] = + { + 0x09,0x9f,0xd2,0xe8,0xb2,0x0e,0x6e,0x89,0xf5,0x73,0x1c,0x1f, + 0x93,0xf2,0x76,0xb2 + }; + +__fips_constseg +static const unsigned char p_256_sha512_returnedbits[] = + { + 0xdd,0x42,0x2a,0x7b,0x4f,0x84,0x07,0xfa,0x4d,0x17,0x9a,0x2e, + 0x48,0xba,0xbf,0xc5,0x1c,0x42,0xc7,0xc3,0x63,0x4f,0x79,0xb0, + 0xc1,0x54,0x1d,0xa6,0x0a,0x1c + }; + + +/* P-384 SHA-224 PR */ +__fips_constseg +static const unsigned char p_384_sha224_pr_entropyinput[] = + { + 0x34,0xf0,0x89,0xac,0x46,0x33,0xe2,0x7f,0x8c,0x02,0x65,0x09, + 0xe1,0xcf,0x93,0x5b,0x10,0xbc,0xb0,0x43,0x4f,0xc7,0x62,0x19 + }; + +__fips_constseg +static const unsigned char p_384_sha224_pr_nonce[] = + { + 0x55,0x30,0xdf,0xa9,0xfb,0xbe,0x4a,0x2e,0x1d,0x03,0xf5,0x91 + }; + +__fips_constseg +static const unsigned char p_384_sha224_pr_personalizationstring[] = + { + 0x35,0xc7,0x3a,0x7b,0x5a,0x4e,0xd4,0x1a,0x82,0xe2,0xf5,0xed, + 0x40,0x61,0x4b,0xf4,0xb9,0xcf,0xd0,0xc1,0xe2,0x41,0x23,0x04 + }; + +__fips_constseg +static const unsigned char p_384_sha224_pr_additionalinput[] = + { + 0xec,0xef,0x64,0xfb,0x92,0xbb,0xdf,0x8b,0xc8,0xf2,0xad,0xd8, + 0x93,0x21,0x6f,0x11,0xde,0x37,0x52,0xe3,0x16,0x49,0xc7,0xe1 + }; + +__fips_constseg +static const unsigned char p_384_sha224_pr_entropyinputpr[] = + { + 0x59,0xb0,0x7e,0x34,0x49,0x29,0x7e,0x91,0x92,0x91,0x0c,0xca, + 0x8e,0x31,0x62,0x06,0xab,0xf4,0x81,0x80,0xa4,0x55,0x8f,0x0f + }; + +__fips_constseg +static const unsigned char p_384_sha224_pr_int_returnedbits[] = + { + 0x29,0xd9,0x3a,0x95,0xb1,0x34,0xff,0x73,0x06,0x1e,0x08,0x43, + 0xd7,0x1d,0x53,0xd1,0xcf,0x09,0xd2,0x83,0x04,0x44,0x29,0x9d, + 0x0d,0x18,0x76,0x94,0xa8,0x98,0xb4,0xc1,0xb0,0x31,0xbc,0xe6, + 0xf0,0xc7,0x57,0x35,0x5d,0x32,0x78,0x9e,0x1d,0x2a + }; + +__fips_constseg +static const unsigned char p_384_sha224_pr_additionalinput2[] = + { + 0x56,0x8c,0x6f,0x29,0xd6,0x25,0x9f,0xb8,0x6a,0x1d,0x70,0x5f, + 0x6a,0xe7,0xe2,0x2e,0xcc,0x6b,0x78,0x0a,0x3f,0x54,0x73,0x97 + }; + +__fips_constseg +static const unsigned char p_384_sha224_pr_entropyinputpr2[] = + { + 0xe3,0x91,0x20,0x13,0x78,0xc6,0x01,0xfd,0x82,0xd7,0x43,0x1e, + 0xed,0x85,0x4a,0xe2,0x0c,0x6f,0xdc,0x43,0x5f,0x7c,0xfd,0xd0 + }; + +__fips_constseg +static const unsigned char p_384_sha224_pr_returnedbits[] = + { + 0x89,0xa9,0x17,0xd8,0xcb,0x73,0x17,0x69,0x78,0x69,0x50,0x58, + 0x74,0xe4,0x8c,0x6f,0x5c,0xfa,0x6e,0x01,0xb3,0xf0,0xce,0xa9, + 0xd0,0xc0,0x40,0xb3,0x20,0x78,0xe2,0xdb,0xec,0x1f,0x73,0xea, + 0x2e,0xa6,0xf1,0xc8,0xfe,0x7c,0xe7,0x68,0xf7,0x86 + }; + + +/* P-384 SHA-224 No PR */ +__fips_constseg +static const unsigned char p_384_sha224_entropyinput[] = + { + 0x44,0x2c,0xc3,0xc6,0x20,0xe6,0x61,0xec,0xd1,0x2b,0xdf,0x18, + 0x2e,0xc5,0x4a,0xd4,0x80,0x55,0xbd,0x54,0x89,0x01,0x7b,0xbb + }; + +__fips_constseg +static const unsigned char p_384_sha224_nonce[] = + { + 0x16,0x27,0x4b,0xb3,0x0f,0x01,0xd0,0xe6,0x9f,0x5c,0x44,0xa4 + }; + +__fips_constseg +static const unsigned char p_384_sha224_personalizationstring[] = + { + 0x55,0x26,0x3e,0xee,0xaa,0x1b,0x35,0x27,0xef,0x18,0x28,0x62, + 0x51,0x1e,0xbc,0x4c,0x64,0x0d,0xf8,0x20,0xe6,0x0a,0x1d,0xaa + }; + +__fips_constseg +static const unsigned char p_384_sha224_additionalinput[] = + { + 0x27,0x08,0x22,0x32,0x4a,0xd6,0xc6,0x51,0xff,0xc5,0xb7,0x8f, + 0xb4,0x3e,0xa0,0x6e,0xe2,0x55,0xa1,0xf1,0x2e,0x0d,0x89,0x91 + }; + +__fips_constseg +static const unsigned char p_384_sha224_int_returnedbits[] = + { + 0x85,0x0e,0xe3,0xde,0xed,0x40,0xdc,0xec,0x9a,0x2d,0x65,0x24, + 0x2b,0x56,0xd6,0xce,0x7c,0x40,0x07,0xe5,0x61,0x64,0xe5,0xac, + 0x6e,0x48,0xa3,0xda,0x7d,0x4c,0xd6,0x7d,0xd0,0x69,0xa8,0x93, + 0xa7,0xb1,0x91,0xba,0x0d,0x81,0x8f,0x04,0xaf,0x91 + }; + +__fips_constseg +static const unsigned char p_384_sha224_entropyinputreseed[] = + { + 0x27,0x57,0xc2,0x22,0xa6,0x70,0xb9,0x74,0x86,0x59,0x8c,0xff, + 0x7d,0x10,0x0c,0xe3,0x24,0xf1,0x95,0xbd,0x99,0x84,0xca,0x11 + }; + +__fips_constseg +static const unsigned char p_384_sha224_additionalinputreseed[] = + { + 0x5a,0xc3,0x47,0x2c,0x9c,0x1d,0xe0,0x43,0x3b,0x1b,0x01,0xed, + 0x86,0x5d,0x1b,0x3f,0x45,0xb1,0x8e,0xa9,0x79,0x7b,0x88,0x01 + }; + +__fips_constseg +static const unsigned char p_384_sha224_additionalinput2[] = + { + 0x7d,0x48,0x91,0xda,0x00,0x60,0x33,0x2c,0x22,0xe4,0x42,0x61, + 0xbc,0x70,0x05,0x73,0x22,0x23,0x42,0xda,0x7a,0x2b,0xba,0xbb + }; + +__fips_constseg +static const unsigned char p_384_sha224_returnedbits[] = + { + 0xfa,0x7d,0x7b,0x35,0x32,0xbe,0x44,0x91,0x90,0xd2,0x69,0x9a, + 0x06,0xb8,0x52,0x3e,0x3b,0xcf,0x1e,0x81,0xd3,0x20,0x5f,0x5b, + 0x55,0xb6,0xb3,0xc9,0x6b,0xc7,0x0c,0xf1,0xa7,0xbd,0x4a,0x83, + 0x25,0x50,0xc3,0x78,0x3f,0x4e,0xe9,0xed,0x6c,0x4c + }; + + +/* P-384 SHA-256 PR */ +__fips_constseg +static const unsigned char p_384_sha256_pr_entropyinput[] = + { + 0xc6,0xd0,0xc7,0xa3,0x7e,0x2b,0x8c,0xd6,0x23,0xe9,0x9e,0x1f, + 0x77,0x30,0xed,0x6a,0xfc,0xe4,0x7b,0xf0,0x6f,0xd6,0xfe,0x05 + }; + +__fips_constseg +static const unsigned char p_384_sha256_pr_nonce[] = + { + 0x67,0x91,0xca,0x93,0xc8,0x1e,0x93,0x13,0x00,0x72,0x4e,0xa2 + }; + +__fips_constseg +static const unsigned char p_384_sha256_pr_personalizationstring[] = + { + 0xa5,0x5b,0x6e,0xeb,0xc9,0x0d,0x42,0x0b,0x41,0xec,0x0b,0x9e, + 0xde,0xc1,0x80,0x4d,0xe3,0x86,0xa0,0xfe,0x7e,0x92,0x47,0xa3 + }; + +__fips_constseg +static const unsigned char p_384_sha256_pr_additionalinput[] = + { + 0x9a,0x04,0xa9,0x78,0x48,0xa8,0x77,0x0f,0x38,0x2a,0x54,0x66, + 0x34,0xaa,0x31,0xbd,0xf6,0xfb,0xc1,0x14,0xa5,0xcb,0x1c,0xf2 + }; + +__fips_constseg +static const unsigned char p_384_sha256_pr_entropyinputpr[] = + { + 0x19,0x6c,0x48,0xf5,0x64,0xb3,0xb4,0x49,0x6e,0xb8,0xc4,0x8b, + 0xab,0xba,0xb5,0x8e,0xa3,0xf1,0x6e,0xe9,0xf6,0x37,0xa1,0x46 + }; + +__fips_constseg +static const unsigned char p_384_sha256_pr_int_returnedbits[] = + { + 0xfd,0x04,0x26,0x4f,0xbd,0x84,0xe3,0x54,0xb2,0x9b,0xb1,0x84, + 0x66,0x5f,0x02,0xc0,0xcc,0x69,0x7e,0x4d,0x4f,0xc4,0x00,0x8e, + 0x13,0x5d,0xe9,0x0f,0x98,0x71,0xe8,0x7f,0x50,0xd1,0x49,0xc8, + 0xae,0x71,0xe9,0x60,0x94,0x90,0xce,0x6d,0xba,0xab + }; + +__fips_constseg +static const unsigned char p_384_sha256_pr_additionalinput2[] = + { + 0x4d,0x27,0x90,0x17,0x81,0x74,0x4f,0xa4,0x40,0xdf,0x42,0x29, + 0xc5,0x37,0xf1,0x31,0x89,0x90,0x27,0x8a,0x96,0xcc,0x68,0x6e + }; + +__fips_constseg +static const unsigned char p_384_sha256_pr_entropyinputpr2[] = + { + 0x1d,0xbe,0xdf,0x39,0xd8,0x82,0xb2,0x8f,0x7f,0x90,0xac,0x19, + 0xc8,0x65,0xf2,0x5a,0xff,0x4e,0xbb,0xcf,0xcd,0xce,0x2c,0xfd + }; + +__fips_constseg +static const unsigned char p_384_sha256_pr_returnedbits[] = + { + 0x45,0x63,0xac,0xb5,0x1e,0x49,0x99,0x67,0x89,0xd4,0x9c,0xa9, + 0xf8,0x5a,0x05,0x0d,0xeb,0xe6,0xc7,0x78,0x8e,0xf1,0xec,0xe3, + 0xc8,0x52,0xf1,0xfa,0x0f,0xd0,0xd7,0xbe,0x8a,0x34,0x0a,0x1f, + 0x38,0x42,0xc6,0xac,0x61,0xd4,0x32,0xc5,0xd2,0x15 + }; + + +/* P-384 SHA-256 No PR */ +__fips_constseg +static const unsigned char p_384_sha256_entropyinput[] = + { + 0x52,0x92,0xc4,0xac,0xce,0xf5,0x35,0xa4,0x15,0xdb,0xa9,0xe1, + 0xbc,0x7b,0x08,0xa5,0x27,0x16,0xe3,0x50,0x08,0x2d,0x09,0x2d + }; + +__fips_constseg +static const unsigned char p_384_sha256_nonce[] = + { + 0xe8,0x14,0x2b,0xee,0xba,0xac,0xe0,0x25,0xd0,0x3b,0x78,0xc5 + }; + +__fips_constseg +static const unsigned char p_384_sha256_personalizationstring[] = + { + 0x28,0x0c,0x86,0x48,0x5e,0xca,0xfa,0x89,0x1f,0x58,0xb8,0x2c, + 0x41,0x28,0x3f,0x98,0x71,0x66,0x7b,0xb7,0x32,0xa2,0xe1,0x49 + }; + +__fips_constseg +static const unsigned char p_384_sha256_additionalinput[] = + { + 0xdc,0x59,0xb1,0x23,0x39,0x75,0x1b,0x27,0x24,0x5f,0x7a,0x55, + 0x82,0xdc,0xdc,0xe2,0x12,0x65,0xbf,0x8a,0x65,0xdb,0x27,0xdb + }; + +__fips_constseg +static const unsigned char p_384_sha256_int_returnedbits[] = + { + 0xc0,0x86,0xd8,0x67,0xdd,0xe4,0xce,0x15,0x60,0xad,0x45,0x60, + 0x80,0x8b,0x5a,0xb6,0x85,0x6d,0x4a,0xdf,0x8e,0xc0,0x2d,0xbf, + 0xa9,0x8c,0x9b,0x8d,0x03,0xca,0xbf,0x3b,0x1f,0xdc,0xc1,0xac, + 0xa8,0x0f,0x45,0xd6,0x2e,0xd1,0xe6,0x29,0xb5,0x1c + }; + +__fips_constseg +static const unsigned char p_384_sha256_entropyinputreseed[] = + { + 0x9f,0x19,0x9f,0xc8,0x18,0x43,0xfc,0x9a,0x97,0xed,0x20,0x13, + 0xad,0xc9,0xa0,0x65,0xef,0x38,0xd6,0x2e,0xce,0x4d,0xe1,0x1d + }; + +__fips_constseg +static const unsigned char p_384_sha256_additionalinputreseed[] = + { + 0xa6,0x27,0x35,0x9f,0x8a,0xaa,0xf5,0xb3,0x60,0x4b,0x16,0x68, + 0xdd,0x32,0x2e,0x1b,0xb1,0x34,0x47,0x03,0x45,0x3f,0xb6,0x3e + }; + +__fips_constseg +static const unsigned char p_384_sha256_additionalinput2[] = + { + 0x76,0x4e,0x5c,0x75,0x33,0xa5,0x94,0x95,0xf4,0x36,0xa5,0x39, + 0x28,0xc1,0x74,0xd1,0xfa,0x1d,0x8a,0x40,0x6e,0x84,0x4e,0xc7 + }; + +__fips_constseg +static const unsigned char p_384_sha256_returnedbits[] = + { + 0x50,0x15,0xc9,0x98,0x73,0x71,0x55,0xb7,0x7a,0xf4,0xa5,0xe7, + 0xb3,0xe2,0x24,0x2e,0x96,0x5b,0xd1,0xab,0xe8,0x51,0x1f,0xbe, + 0x3b,0x1e,0x1f,0xd4,0x18,0x2d,0x99,0xda,0xb8,0xa5,0x98,0x65, + 0x1d,0xaa,0x1e,0x46,0x8f,0x6b,0x4f,0xa2,0xd5,0xdf + }; + + +/* P-384 SHA-384 PR */ +__fips_constseg +static const unsigned char p_384_sha384_pr_entropyinput[] = + { + 0x3b,0x40,0x57,0x65,0x46,0x14,0xa5,0xf6,0x63,0x21,0xe7,0x33, + 0xd7,0x38,0xa7,0x54,0x33,0x62,0x08,0x08,0x37,0xef,0xbf,0x22 + }; + +__fips_constseg +static const unsigned char p_384_sha384_pr_nonce[] = + { + 0xf4,0xd4,0x11,0x0a,0x4a,0xdb,0xfc,0xbb,0x08,0x7a,0x20,0x51 + }; + +__fips_constseg +static const unsigned char p_384_sha384_pr_personalizationstring[] = + { + 0x5d,0x5b,0x9d,0xe5,0x45,0x62,0x5b,0xd0,0xa8,0x1b,0xea,0xe3, + 0xbd,0x59,0xd4,0xab,0x50,0xbe,0x5d,0x21,0x5d,0x85,0x42,0x16 + }; + +__fips_constseg +static const unsigned char p_384_sha384_pr_additionalinput[] = + { + 0xd9,0xac,0x4b,0x76,0x18,0x46,0xba,0x30,0x88,0xdf,0x41,0xdb, + 0x72,0x9b,0x4d,0xb7,0xbb,0x12,0xd2,0xd8,0x00,0xa0,0x81,0x14 + }; + +__fips_constseg +static const unsigned char p_384_sha384_pr_entropyinputpr[] = + { + 0x46,0x6d,0x66,0xaf,0xcf,0xb3,0x59,0x37,0x52,0x7e,0xa0,0xce, + 0x6d,0xaa,0x40,0xac,0x87,0xce,0x01,0x76,0x8f,0xac,0x49,0x42 + }; + +__fips_constseg +static const unsigned char p_384_sha384_pr_int_returnedbits[] = + { + 0xe1,0xea,0x43,0x73,0x35,0xf8,0x1f,0x2d,0xab,0x82,0x82,0x7f, + 0x82,0xca,0x78,0xb4,0x9b,0xfd,0x89,0xbc,0x83,0xcb,0x8d,0x09, + 0x44,0xb6,0xd6,0x0c,0xd9,0x43,0x97,0x5c,0xf8,0x51,0x5d,0xe3, + 0x0c,0x36,0xe1,0xaf,0xd3,0xbd,0x43,0x08,0xb8,0x65 + }; + +__fips_constseg +static const unsigned char p_384_sha384_pr_additionalinput2[] = + { + 0x6f,0xe5,0x27,0xa8,0x0c,0x4b,0xad,0x03,0xba,0xaa,0x70,0xc5, + 0xc6,0x4c,0xa6,0x6b,0xd9,0xb4,0x74,0x7a,0xea,0x4b,0x07,0xc8 + }; + +__fips_constseg +static const unsigned char p_384_sha384_pr_entropyinputpr2[] = + { + 0xec,0xc8,0x0c,0x3a,0x39,0xd3,0x2e,0xa9,0xab,0x57,0x89,0x1d, + 0x85,0x23,0x54,0x40,0xdf,0x15,0xbd,0x65,0x41,0xe5,0xaf,0xfb + }; + +__fips_constseg +static const unsigned char p_384_sha384_pr_returnedbits[] = + { + 0x3f,0xe0,0xa9,0x90,0x8e,0x27,0x2c,0xbe,0xfe,0xdd,0x35,0x67, + 0x4e,0x9b,0x9b,0x54,0xf3,0xb9,0x53,0xf4,0x62,0x8a,0xad,0x67, + 0x3e,0x68,0x92,0xd5,0xdb,0xd7,0x8f,0xb1,0xf7,0x10,0x5e,0xc6, + 0xc3,0xe8,0x45,0x60,0xde,0x05,0x4e,0x94,0xbc,0x43 + }; + + +/* P-384 SHA-384 No PR */ +__fips_constseg +static const unsigned char p_384_sha384_entropyinput[] = + { + 0x52,0x51,0xd7,0x2a,0x26,0xda,0xeb,0x5c,0xfb,0x23,0x47,0x49, + 0xf7,0x04,0xc6,0x62,0xed,0x72,0x3e,0x70,0x41,0x87,0x75,0x42 + }; + +__fips_constseg +static const unsigned char p_384_sha384_nonce[] = + { + 0x63,0x66,0x35,0x65,0x9b,0xe5,0xd3,0xcb,0x94,0x82,0x81,0x05 + }; + +__fips_constseg +static const unsigned char p_384_sha384_personalizationstring[] = + { + 0x52,0xa4,0xce,0x0e,0x4b,0x72,0x21,0x63,0xad,0x21,0x7f,0x60, + 0x9e,0x5d,0xa7,0xff,0xef,0xf1,0xfb,0x04,0xdb,0x30,0x5a,0x0c + }; + +__fips_constseg +static const unsigned char p_384_sha384_additionalinput[] = + { + 0xd7,0xde,0x8e,0xc4,0xeb,0x69,0xd2,0x2b,0xed,0x00,0x4a,0x6e, + 0x3a,0x13,0xf5,0x48,0xe4,0x83,0xad,0x81,0x4d,0x68,0xe5,0x57 + }; + +__fips_constseg +static const unsigned char p_384_sha384_int_returnedbits[] = + { + 0xbc,0x2d,0x9b,0x3b,0xbb,0x75,0xf4,0xdf,0xda,0x0f,0x10,0x88, + 0xb4,0x95,0x4c,0xf3,0xfa,0xff,0x3d,0x30,0x53,0x0b,0xa7,0xb9, + 0x95,0x27,0xc3,0x11,0xc9,0xef,0xd4,0xfe,0x84,0x9d,0xe0,0x76, + 0xcc,0x39,0x83,0xab,0x3f,0x31,0xe7,0x6d,0x44,0x0f + }; + +__fips_constseg +static const unsigned char p_384_sha384_entropyinputreseed[] = + { + 0xef,0x0f,0xa7,0x4e,0x90,0xe1,0x57,0x9e,0xce,0x52,0xe1,0xa0, + 0xd3,0x0f,0x06,0xa4,0xfe,0x5d,0x55,0x60,0xe2,0xc5,0x45,0x3b + }; + +__fips_constseg +static const unsigned char p_384_sha384_additionalinputreseed[] = + { + 0xec,0x87,0x9e,0x8e,0x58,0xb8,0xa3,0xd3,0x3e,0x49,0x22,0xf5, + 0x68,0x5b,0x60,0x6e,0x7b,0x73,0xd5,0xa4,0x7c,0x9e,0xcd,0xba + }; + +__fips_constseg +static const unsigned char p_384_sha384_additionalinput2[] = + { + 0x1c,0xd2,0xce,0x30,0x31,0x8b,0xbb,0xaf,0xbb,0xa8,0xae,0x20, + 0xa3,0x6b,0xb5,0x37,0xfe,0x09,0x91,0x1a,0x63,0x33,0x29,0x8c + }; + +__fips_constseg +static const unsigned char p_384_sha384_returnedbits[] = + { + 0xd7,0x36,0x7b,0x33,0x50,0x6a,0x59,0xb0,0x7c,0xb3,0xc4,0xe9, + 0xc2,0x16,0x41,0x7b,0xe4,0x4c,0xd8,0x7c,0x6b,0x74,0x00,0x31, + 0xd1,0x97,0x2d,0x7a,0x97,0x22,0x45,0xe6,0xf0,0xcd,0x8e,0xa5, + 0xeb,0xab,0x37,0xd6,0xb7,0xb1,0x9c,0x42,0xfb,0xcf + }; + + +/* P-384 SHA-512 PR */ +__fips_constseg +static const unsigned char p_384_sha512_pr_entropyinput[] = + { + 0x14,0xdf,0x91,0xdb,0xad,0xe2,0x22,0xe5,0x56,0xa1,0x88,0xbd, + 0x42,0x73,0xf7,0x8d,0xdc,0x99,0x54,0x99,0x8a,0xab,0x11,0x4b + }; + +__fips_constseg +static const unsigned char p_384_sha512_pr_nonce[] = + { + 0x10,0x49,0x5d,0xf6,0x5d,0x17,0xa7,0xa6,0xd8,0xc7,0xc8,0xe7 + }; + +__fips_constseg +static const unsigned char p_384_sha512_pr_personalizationstring[] = + { + 0x61,0x59,0xc5,0x8e,0x30,0x77,0x05,0x75,0x87,0xff,0x0b,0x06, + 0x03,0x79,0xa5,0x8b,0x59,0xb8,0x32,0xc9,0x19,0x47,0x7d,0x0e + }; + +__fips_constseg +static const unsigned char p_384_sha512_pr_additionalinput[] = + { + 0x41,0xd5,0x73,0x17,0x13,0x4c,0xe8,0x7c,0x83,0x45,0x84,0xf1, + 0x72,0xae,0x1d,0xea,0x08,0x0a,0x56,0xec,0x16,0xf9,0x1f,0xb6 + }; + +__fips_constseg +static const unsigned char p_384_sha512_pr_entropyinputpr[] = + { + 0xa6,0x85,0xa8,0xa4,0x0f,0xad,0x96,0x32,0x39,0x5e,0x86,0xb0, + 0x8b,0xda,0xb2,0xf0,0x38,0x75,0xf8,0xe2,0xc0,0xbf,0x77,0x62 + }; + +__fips_constseg +static const unsigned char p_384_sha512_pr_int_returnedbits[] = + { + 0xc8,0xf2,0x0c,0x8a,0xe7,0x72,0xe2,0xa3,0x5e,0x0a,0xaa,0x21, + 0x3a,0x92,0x08,0x70,0xaf,0xc2,0x1e,0xed,0xd1,0x2c,0xa0,0xbc, + 0xcb,0x0e,0x46,0xb9,0x34,0x97,0x62,0x03,0x4a,0x93,0xe3,0x6f, + 0x92,0x08,0x71,0x16,0xce,0x3e,0x5b,0x6b,0x9a,0x52 + }; + +__fips_constseg +static const unsigned char p_384_sha512_pr_additionalinput2[] = + { + 0x72,0x72,0xb3,0x26,0x05,0x49,0xf0,0x34,0xb6,0x04,0x75,0x6a, + 0x0a,0x86,0x9c,0x8f,0xe5,0x3d,0x90,0x26,0x42,0x92,0x2a,0x77 + }; + +__fips_constseg +static const unsigned char p_384_sha512_pr_entropyinputpr2[] = + { + 0xf1,0xda,0x51,0xa2,0x21,0x54,0x2d,0x6d,0xec,0x92,0xe5,0x8f, + 0x81,0x96,0x21,0x60,0x93,0x33,0x3d,0xfb,0x92,0xfe,0xae,0xcb + }; + +__fips_constseg +static const unsigned char p_384_sha512_pr_returnedbits[] = + { + 0x12,0x87,0x30,0xc4,0x87,0x61,0x58,0xab,0x79,0x05,0xb4,0xfd, + 0x47,0x95,0x86,0x4c,0x24,0x45,0xb0,0x4b,0x23,0x9a,0xe6,0x72, + 0x03,0xd8,0xc1,0x8a,0xbc,0xd0,0x3b,0xb5,0x8e,0x84,0x9f,0x2d, + 0xa4,0xf6,0x9b,0x89,0xd6,0x92,0x72,0x70,0x63,0xb9 + }; + + +/* P-384 SHA-512 No PR */ +__fips_constseg +static const unsigned char p_384_sha512_entropyinput[] = + { + 0xc7,0x7b,0x0e,0xe1,0x06,0x66,0x63,0x87,0x15,0x09,0x0a,0xe2, + 0xbe,0xdc,0xd5,0x3c,0x65,0xce,0xc5,0x25,0xfd,0xf2,0x23,0xbe + }; + +__fips_constseg +static const unsigned char p_384_sha512_nonce[] = + { + 0x5c,0xe8,0xa7,0x7d,0x45,0x8d,0x89,0xcd,0xb7,0xa3,0x4a,0x98 + }; + +__fips_constseg +static const unsigned char p_384_sha512_personalizationstring[] = + { + 0xa9,0x0e,0x29,0xff,0x2f,0x4e,0x92,0xe3,0xbd,0xcf,0x25,0xfa, + 0x96,0xdf,0x18,0x16,0x9a,0x99,0xb0,0x07,0xfe,0x51,0x24,0x9e + }; + +__fips_constseg +static const unsigned char p_384_sha512_additionalinput[] = + { + 0x1a,0x19,0xdf,0x08,0x35,0x94,0x83,0x30,0xab,0x01,0x98,0x2b, + 0xa5,0xe2,0x6d,0x99,0xe7,0x30,0xd5,0xef,0xf1,0xa7,0x61,0x61 + }; + +__fips_constseg +static const unsigned char p_384_sha512_int_returnedbits[] = + { + 0xa2,0x80,0xdb,0xa3,0x6c,0x7b,0x74,0x57,0x65,0x9d,0x32,0x53, + 0xaf,0xcc,0x91,0x21,0x59,0x3c,0xf2,0xf7,0xf7,0x06,0x29,0xee, + 0xce,0x1f,0x3d,0xdb,0x2c,0x9c,0xb9,0xfb,0xf1,0xe1,0xf1,0xac, + 0x90,0xcd,0x6e,0xc5,0x97,0x1e,0xa2,0x90,0x2b,0x7e + }; + +__fips_constseg +static const unsigned char p_384_sha512_entropyinputreseed[] = + { + 0xf4,0x57,0x3d,0xc5,0x13,0x99,0xb2,0x4d,0xdd,0xdf,0xf3,0xa0, + 0x7b,0x82,0x8a,0x22,0x9a,0x02,0x9c,0xac,0x6f,0xb4,0x07,0xd8 + }; + +__fips_constseg +static const unsigned char p_384_sha512_additionalinputreseed[] = + { + 0x12,0x98,0x84,0xa1,0xb5,0x26,0x7e,0x55,0xe1,0xd1,0x00,0x8f, + 0x50,0x96,0x30,0xa7,0x33,0xf5,0xb4,0x76,0x93,0x7a,0x2d,0x82 + }; + +__fips_constseg +static const unsigned char p_384_sha512_additionalinput2[] = + { + 0xfd,0x4c,0x76,0x61,0x48,0x40,0xa7,0x1e,0xa1,0xe9,0x25,0xcc, + 0xa6,0x21,0x4e,0x87,0xc9,0x27,0x06,0x3e,0x89,0x8b,0x18,0x3c + }; + +__fips_constseg +static const unsigned char p_384_sha512_returnedbits[] = + { + 0x90,0xa9,0xd4,0x1a,0x7f,0xb5,0xdd,0x66,0x5f,0xa7,0xc9,0x53, + 0x57,0xfc,0xc1,0x42,0x93,0x09,0xb4,0xf6,0x6c,0x7a,0xce,0x16, + 0x5e,0xed,0xad,0xea,0x0e,0x34,0x06,0xbb,0x80,0x89,0xba,0xd3, + 0xfe,0x49,0x21,0x4e,0x28,0xa7,0xfe,0xdb,0x27,0xfe + }; + + +/* P-521 SHA-256 PR */ +__fips_constseg +static const unsigned char p_521_sha256_pr_entropyinput[] = + { + 0x1a,0xb3,0x78,0x1e,0x14,0x19,0x83,0x05,0xac,0xb0,0x95,0xe1, + 0x10,0xa3,0xc4,0xbc,0x8e,0x13,0x2c,0xf2,0xad,0x63,0x25,0x1f, + 0x88,0xc4,0xc4,0x4e,0x6d,0x03,0x96,0x5e + }; + +__fips_constseg +static const unsigned char p_521_sha256_pr_nonce[] = + { + 0xd8,0x3d,0x1c,0x7e,0x4a,0x8e,0x28,0x4a,0xd6,0xf7,0xe8,0x0c, + 0x54,0x69,0x31,0xe4 + }; + +__fips_constseg +static const unsigned char p_521_sha256_pr_personalizationstring[] = + { + 0xc7,0xa6,0xb8,0xc0,0x25,0xaa,0x88,0xf5,0xc7,0x6a,0xd2,0xfc, + 0x7a,0x07,0xdd,0xf9,0x02,0xfb,0x79,0x36,0x17,0xc3,0x23,0x6e, + 0x9e,0xcd,0x5c,0x5d,0x2b,0xa3,0x45,0x86 + }; + +__fips_constseg +static const unsigned char p_521_sha256_pr_additionalinput[] = + { + 0xde,0xc5,0x1d,0x59,0x4d,0x25,0x3c,0x4f,0xbb,0x81,0xb3,0x61, + 0xd4,0x84,0x6e,0x4e,0x52,0x80,0xcd,0x5d,0x1a,0xb9,0xdf,0x44, + 0x94,0xf2,0xde,0x54,0x49,0x37,0xea,0xe8 + }; + +__fips_constseg +static const unsigned char p_521_sha256_pr_entropyinputpr[] = + { + 0x4e,0xe6,0x23,0xa4,0x97,0xaf,0x70,0x36,0xed,0xed,0x37,0x6b, + 0xc9,0x31,0x95,0x1e,0x07,0x42,0x42,0x4b,0x24,0x06,0xee,0xa0, + 0xb5,0xb1,0xd7,0x40,0x29,0x2e,0xa8,0xd8 + }; + +__fips_constseg +static const unsigned char p_521_sha256_pr_int_returnedbits[] = + { + 0x7d,0x64,0x63,0x00,0xa5,0x98,0x9b,0xf3,0xf4,0x09,0x44,0x64, + 0xcc,0xa8,0x99,0xbc,0x6e,0xac,0x67,0xb9,0xb1,0xb5,0x3b,0xe8, + 0x99,0xde,0x91,0xe8,0x8b,0x95,0x09,0xcc,0x35,0xde,0xd7,0x78, + 0x97,0x47,0x7d,0xa0,0x5f,0xe4,0x48,0x1e,0x5f,0x14,0xa0,0xda, + 0xd6,0xac,0x59,0xf0,0x31,0xc6,0xb4,0x78,0x70,0x32,0x87,0xd8, + 0xbb,0xe1,0x8e + }; + +__fips_constseg +static const unsigned char p_521_sha256_pr_additionalinput2[] = + { + 0xda,0x8a,0xbb,0x5e,0x1f,0xc7,0x4b,0x7e,0x2b,0x09,0xdd,0x64, + 0x42,0x4b,0x19,0x66,0x16,0xb6,0xec,0x1c,0x46,0xd1,0x23,0x26, + 0x16,0xe9,0x4a,0x3b,0x6e,0xc1,0xc6,0x74 + }; + +__fips_constseg +static const unsigned char p_521_sha256_pr_entropyinputpr2[] = + { + 0x7b,0x4d,0x60,0x68,0xb1,0xd7,0xbe,0xf7,0x40,0xb5,0x84,0xa8, + 0x3b,0x49,0x38,0x8a,0xc2,0x40,0x44,0x0b,0x80,0xc8,0x94,0xbf, + 0x6a,0xf5,0x72,0x74,0xb5,0x6f,0x9f,0x7a + }; + +__fips_constseg +static const unsigned char p_521_sha256_pr_returnedbits[] = + { + 0xb2,0x4e,0x40,0x75,0xaf,0xcf,0x93,0x13,0xaf,0x97,0x49,0x49, + 0x5f,0xdf,0x5d,0x21,0x2f,0x99,0x7d,0xe9,0xb8,0x98,0x3e,0x1f, + 0x06,0xcc,0xca,0xb6,0xcf,0x6d,0xd2,0xd9,0x85,0x45,0x1a,0xd5, + 0x39,0x6a,0x26,0x6c,0x7b,0x7b,0x72,0x18,0xa2,0xf1,0x99,0x7e, + 0xe1,0xa0,0xa6,0x54,0xe4,0x0f,0x73,0x48,0xc2,0x54,0xc2,0xc3, + 0x4f,0x53,0xb3 + }; + + +/* P-521 SHA-256 No PR */ +__fips_constseg +static const unsigned char p_521_sha256_entropyinput[] = + { + 0x69,0x5d,0x57,0x6d,0xe8,0xb1,0x0a,0x01,0xf8,0x1d,0xb9,0x5d, + 0xbd,0xfb,0xec,0x38,0xc9,0xd3,0x70,0x88,0x9a,0x8d,0xf2,0x4e, + 0x55,0xd6,0xde,0xa2,0xc4,0xd2,0x78,0xfb + }; + +__fips_constseg +static const unsigned char p_521_sha256_nonce[] = + { + 0x12,0xd2,0x1a,0xac,0xaf,0x49,0xb2,0xa4,0x9c,0x33,0x2e,0xdb, + 0x46,0xd1,0xc7,0x23 + }; + +__fips_constseg +static const unsigned char p_521_sha256_personalizationstring[] = + { + 0xb7,0xe2,0xeb,0xa9,0x88,0xb5,0x24,0xf3,0x82,0xc6,0x83,0xe3, + 0x5e,0x12,0x32,0xd1,0x50,0x16,0xd4,0x96,0x5e,0x62,0x0b,0xb8, + 0x02,0x5b,0x2e,0xd2,0x01,0x52,0x4a,0x48 + }; + +__fips_constseg +static const unsigned char p_521_sha256_additionalinput[] = + { + 0xf4,0xa2,0xfa,0xae,0x18,0x94,0xdb,0x12,0x0b,0xa8,0x1e,0x4e, + 0x7f,0xdb,0x3d,0x9e,0x06,0xe2,0x77,0x53,0x2b,0x76,0x0a,0xbd, + 0xcc,0xdb,0xae,0x5a,0xbc,0xb0,0x53,0x3f + }; + +__fips_constseg +static const unsigned char p_521_sha256_int_returnedbits[] = + { + 0xbd,0x16,0xe4,0x4d,0x62,0xa1,0xb4,0x4f,0x3f,0xba,0x27,0x58, + 0xa3,0xa1,0x6f,0x92,0xe9,0xe9,0x48,0xd0,0x64,0xba,0xb2,0x17, + 0x54,0x9a,0xcc,0x8d,0xae,0x2e,0x68,0x62,0x42,0xab,0x55,0x24, + 0x47,0x0f,0x71,0xd2,0xa8,0x78,0xf0,0x5b,0x76,0xd0,0x01,0xd7, + 0x86,0xca,0xe5,0xa4,0x41,0x82,0x73,0x51,0x5e,0xa4,0x12,0xa4, + 0xe1,0xea,0xbd + }; + +__fips_constseg +static const unsigned char p_521_sha256_entropyinputreseed[] = + { + 0xda,0x4e,0x7f,0xf0,0x7d,0x4d,0xd8,0x74,0xa2,0x74,0x08,0x82, + 0x1b,0xe2,0xab,0xc9,0xd2,0xae,0x07,0xc3,0xc5,0x94,0x2f,0xfa, + 0x40,0xe0,0x5a,0x95,0x5b,0x99,0x7f,0x28 + }; + +__fips_constseg +static const unsigned char p_521_sha256_additionalinputreseed[] = + { + 0xf3,0x7d,0x64,0xae,0x7a,0xb3,0x9c,0xee,0x0a,0xd3,0x1a,0x56, + 0x3d,0x65,0xac,0x33,0xcc,0x3c,0xb0,0x4a,0x43,0xe3,0xf4,0xe7, + 0x05,0x49,0xcc,0x28,0x81,0xaf,0x73,0x8a + }; + +__fips_constseg +static const unsigned char p_521_sha256_additionalinput2[] = + { + 0x80,0xf2,0xdc,0xd2,0x0e,0x77,0x89,0xd7,0x46,0x67,0x31,0x28, + 0xf6,0xe1,0x1a,0x3f,0x70,0xdb,0x42,0x57,0xc7,0x0a,0xbd,0xf9, + 0x46,0x0e,0x50,0xc8,0x32,0xe0,0x4d,0x8f + }; + +__fips_constseg +static const unsigned char p_521_sha256_returnedbits[] = + { + 0x04,0xce,0x3f,0x47,0x4b,0x90,0x0e,0x0b,0x5d,0x61,0xd2,0xe4, + 0xca,0x19,0x98,0x3e,0xda,0xbb,0xe0,0x68,0x42,0x16,0x3c,0x25, + 0x69,0xb2,0x62,0x3f,0x57,0x84,0x22,0xc5,0x27,0x94,0xcb,0x2a, + 0x6c,0xe4,0xe5,0x3a,0x4d,0xfe,0x23,0xeb,0x81,0x09,0x8a,0xa4, + 0x57,0x8d,0x38,0x26,0x36,0x83,0xc7,0xfa,0xbd,0x1e,0xab,0x50, + 0xfe,0xae,0x42 + }; + + +/* P-521 SHA-384 PR */ +__fips_constseg +static const unsigned char p_521_sha384_pr_entropyinput[] = + { + 0xd7,0xc3,0x75,0xc9,0xdc,0xd6,0x28,0x49,0x6c,0x0c,0x26,0xe8, + 0x50,0x5a,0x98,0x53,0xa0,0xa1,0x59,0xfc,0xd9,0xef,0x34,0x05, + 0x42,0x12,0x5f,0x6c,0x80,0x65,0x37,0x77 + }; + +__fips_constseg +static const unsigned char p_521_sha384_pr_nonce[] = + { + 0x07,0x8a,0xc4,0xbb,0x27,0x54,0x33,0xe2,0xfa,0x4a,0xe2,0x84, + 0xe5,0x5b,0x27,0x69 + }; + +__fips_constseg +static const unsigned char p_521_sha384_pr_personalizationstring[] = + { + 0x69,0x90,0xea,0xac,0x46,0x2f,0x9a,0x3a,0xcc,0xdb,0xbc,0x26, + 0x5d,0xae,0x6d,0xca,0x80,0x62,0x95,0x3f,0x7c,0x17,0xa3,0xc5, + 0x36,0x69,0x8a,0x70,0x4e,0xb0,0xfb,0x16 + }; + +__fips_constseg +static const unsigned char p_521_sha384_pr_additionalinput[] = + { + 0xc7,0x82,0x8d,0xac,0x49,0xed,0x4d,0xe0,0x5f,0x26,0xe4,0xdf, + 0xd6,0x26,0xd0,0x90,0x5b,0xeb,0x36,0xa1,0x5a,0x8d,0xe0,0x33, + 0x18,0x86,0x73,0xcb,0x0d,0x3c,0xf4,0x76 + }; + +__fips_constseg +static const unsigned char p_521_sha384_pr_entropyinputpr[] = + { + 0x88,0xeb,0xbc,0xc4,0xdb,0xb0,0x0c,0xc7,0xc9,0x0a,0xae,0x9f, + 0xe7,0x2c,0x8d,0x8e,0x9a,0x5b,0x37,0xf4,0x91,0x15,0x7c,0x1c, + 0x84,0x84,0x48,0x47,0x2d,0x24,0xc4,0xf8 + }; + +__fips_constseg +static const unsigned char p_521_sha384_pr_int_returnedbits[] = + { + 0xf1,0x8a,0x43,0xec,0x2b,0x3f,0x74,0x05,0xae,0x4f,0x96,0xbb, + 0x90,0xba,0x55,0x23,0xb5,0x07,0xc9,0xfc,0x53,0x36,0x02,0x1d, + 0xb5,0xf4,0x8a,0x8c,0x71,0xb0,0xb2,0x35,0x2e,0xc1,0x91,0xbb, + 0x78,0xf1,0x5f,0x1d,0x1b,0xa3,0xa3,0x4d,0x93,0x76,0x36,0xbe, + 0xb2,0x83,0x6e,0xe1,0x00,0xe3,0x58,0x98,0x84,0x1a,0x4d,0x77, + 0x1c,0x3a,0x5f + }; + +__fips_constseg +static const unsigned char p_521_sha384_pr_additionalinput2[] = + { + 0x1e,0xbd,0x75,0x87,0x28,0x2e,0x05,0xbe,0xb3,0xa8,0x81,0x57, + 0x00,0x24,0xe5,0xe2,0xad,0x7d,0xe5,0x60,0x36,0x9b,0x82,0x09, + 0xac,0xdd,0xec,0x5e,0xb6,0xc6,0x9e,0x72 + }; + +__fips_constseg +static const unsigned char p_521_sha384_pr_entropyinputpr2[] = + { + 0xa4,0x30,0xe4,0xec,0x31,0x84,0x79,0x5c,0x40,0xd8,0x54,0x9d, + 0xd9,0x64,0xdf,0x46,0xc4,0xca,0x08,0x19,0x65,0x24,0x41,0xa8, + 0xdb,0x4c,0xbd,0x4a,0x5a,0x6c,0xe7,0x40 + }; + +__fips_constseg +static const unsigned char p_521_sha384_pr_returnedbits[] = + { + 0x15,0x44,0x90,0x6e,0x56,0xc1,0x51,0x2a,0x0d,0x3a,0x2f,0x1a, + 0x2d,0x0e,0xf8,0x32,0x05,0xe0,0xd7,0x77,0xd4,0x82,0x31,0x11, + 0x4e,0x70,0x50,0x76,0x5a,0x42,0x56,0x0a,0xeb,0x27,0x63,0x74, + 0xe5,0xc4,0x83,0x31,0x25,0x14,0xc4,0x5e,0x6e,0xc7,0xec,0x57, + 0x4b,0xaf,0x17,0xd9,0x43,0x61,0xfb,0xf6,0xc1,0x18,0xc3,0x41, + 0x3a,0xae,0x81 + }; + + +/* P-521 SHA-384 No PR */ +__fips_constseg +static const unsigned char p_521_sha384_entropyinput[] = + { + 0xd2,0x5e,0x8a,0xdf,0x9d,0x50,0x3e,0xb8,0x0e,0x01,0x7b,0x02, + 0x95,0xb4,0x26,0x59,0x25,0x7c,0xdf,0x15,0x6f,0x2f,0x59,0xe2, + 0x60,0x8d,0xf8,0x83,0xdc,0xaf,0xb0,0xe1 + }; + +__fips_constseg +static const unsigned char p_521_sha384_nonce[] = + { + 0x03,0xb8,0xbe,0x6f,0x90,0x5a,0xca,0x32,0xcd,0x86,0x9f,0x0a, + 0x01,0xb6,0x8f,0x41 + }; + +__fips_constseg +static const unsigned char p_521_sha384_personalizationstring[] = + { + 0x39,0x5d,0xc0,0xa6,0xa7,0x8f,0xc4,0x5e,0xec,0xb7,0x45,0xa7, + 0x18,0x35,0x73,0xac,0x41,0x12,0x9c,0x8e,0x83,0xaa,0x45,0xb0, + 0x35,0x9a,0x8a,0x44,0x6f,0xea,0xb8,0x15 + }; + +__fips_constseg +static const unsigned char p_521_sha384_additionalinput[] = + { + 0xac,0x37,0xb4,0x53,0x39,0xd7,0xdd,0xad,0x63,0x8d,0xe6,0x1a, + 0x4c,0xdf,0x1d,0x3a,0x0c,0x54,0xcf,0xb0,0x15,0x01,0xc5,0x46, + 0xc7,0x56,0xff,0x64,0x50,0x29,0xb2,0xb2 + }; + +__fips_constseg +static const unsigned char p_521_sha384_int_returnedbits[] = + { + 0x16,0xf7,0x2a,0xa2,0x12,0x41,0xb9,0x58,0xac,0x9c,0x99,0xaa, + 0x9b,0xbd,0xcd,0x2c,0x18,0x0d,0xf6,0x5a,0x52,0xd8,0x26,0x4e, + 0xd0,0x7a,0xc1,0xe5,0x67,0x54,0x7f,0x65,0x63,0x2a,0xd1,0xef, + 0xf0,0x8f,0xb9,0x2e,0xb0,0xdb,0xc7,0x03,0xc8,0xe1,0x58,0xaa, + 0xdb,0x7c,0x67,0xf6,0xf4,0x4d,0x33,0x0d,0xf0,0x6c,0xd9,0xdd, + 0xd4,0x2c,0xa1 + }; + +__fips_constseg +static const unsigned char p_521_sha384_entropyinputreseed[] = + { + 0x38,0xae,0xd1,0xbd,0xde,0xcc,0x88,0xc7,0x2d,0x39,0x68,0x1e, + 0xef,0x19,0xb6,0x3c,0xcc,0xed,0xec,0x87,0xc5,0xc5,0x56,0x22, + 0xf6,0xa9,0xea,0xf4,0x8b,0x43,0x6b,0xf7 + }; + +__fips_constseg +static const unsigned char p_521_sha384_additionalinputreseed[] = + { + 0x6f,0xd8,0x16,0x55,0x9f,0xe8,0x71,0x65,0x83,0xf2,0xf5,0xaf, + 0xad,0xff,0x19,0x72,0x59,0x8c,0x84,0xdb,0xc7,0x14,0x88,0x34, + 0xda,0xda,0xde,0x4f,0xf0,0xfa,0xa3,0x33 + }; + +__fips_constseg +static const unsigned char p_521_sha384_additionalinput2[] = + { + 0xd9,0xe2,0x19,0x2e,0x78,0x71,0x2f,0xec,0x45,0xcc,0x63,0x0e, + 0x5b,0x7a,0x02,0x34,0x29,0x90,0xd5,0x2c,0x10,0x7e,0xdd,0x5a, + 0x3e,0x1a,0x4c,0x69,0xcb,0xec,0xc6,0x33 + }; + +__fips_constseg +static const unsigned char p_521_sha384_returnedbits[] = + { + 0x88,0x53,0x0c,0xa7,0x5c,0x3f,0x56,0x6a,0x0a,0x10,0xa5,0xac, + 0x41,0x60,0x2a,0xa2,0x29,0x35,0x4c,0xc8,0x24,0xd1,0x75,0xc9, + 0xcc,0xb8,0x87,0x46,0xcc,0xf2,0x72,0x05,0x7f,0x39,0xf0,0x0f, + 0x4d,0x26,0xac,0x8c,0xa4,0x9a,0x87,0xe1,0x16,0xb3,0xc1,0x95, + 0xba,0x0e,0x7b,0x96,0xa9,0x91,0x15,0x9c,0x54,0x16,0x73,0x3b, + 0xce,0x2a,0xfd + }; + + +/* P-521 SHA-512 PR */ +__fips_constseg +static const unsigned char p_521_sha512_pr_entropyinput[] = + { + 0xb7,0x8e,0x4a,0x70,0x59,0xf4,0xb4,0xfa,0x94,0xef,0xc7,0xe7, + 0x7b,0xde,0x06,0x46,0x2e,0x71,0xde,0x82,0x59,0xd5,0x3a,0x32, + 0xee,0x1e,0x64,0x24,0x25,0xf4,0x1d,0xa6 + }; + +__fips_constseg +static const unsigned char p_521_sha512_pr_nonce[] = + { + 0x46,0x15,0x8e,0x0c,0x97,0x3c,0x81,0x7b,0x2b,0x38,0xde,0x1a, + 0x93,0x68,0x00,0x30 + }; + +__fips_constseg +static const unsigned char p_521_sha512_pr_personalizationstring[] = + { + 0x05,0x12,0xdf,0xac,0xf9,0xf8,0xce,0xec,0x1e,0x98,0x91,0x6d, + 0x1d,0xf5,0x4c,0xdf,0xb5,0xb4,0x43,0x90,0x1d,0xaa,0x53,0x9c, + 0x9a,0xa3,0xb5,0x54,0x63,0x74,0xf0,0xf2 + }; + +__fips_constseg +static const unsigned char p_521_sha512_pr_additionalinput[] = + { + 0x04,0x8d,0xfc,0x7a,0xa2,0x25,0x99,0x6a,0xb0,0x17,0x7e,0xe8, + 0x3b,0xc1,0x2f,0x59,0x48,0xde,0xbe,0x44,0xcc,0x2c,0xe6,0xa8, + 0xf0,0x57,0x69,0x7e,0x85,0x2a,0xa8,0x8b + }; + +__fips_constseg +static const unsigned char p_521_sha512_pr_entropyinputpr[] = + { + 0xbb,0xa2,0x0b,0x9f,0xf2,0x01,0x4c,0x9a,0x20,0x87,0x75,0x69, + 0x18,0x51,0x21,0x12,0x55,0xf3,0xc4,0xfe,0x2c,0x5e,0x08,0x85, + 0x52,0x12,0x68,0xb8,0x90,0x87,0x0c,0x6f + }; + +__fips_constseg +static const unsigned char p_521_sha512_pr_int_returnedbits[] = + { + 0x81,0x79,0xde,0xe3,0xe0,0x72,0xd8,0x86,0x39,0x42,0x4b,0x86, + 0xf0,0x4b,0xf2,0xa2,0x56,0xc1,0x67,0x41,0x12,0x2e,0x33,0x2d, + 0x48,0x80,0x91,0x40,0xef,0x3d,0x47,0xf1,0x9b,0xea,0x55,0x2e, + 0x78,0xa1,0x22,0x24,0x5b,0x0c,0xea,0x35,0xba,0xb5,0x0c,0x74, + 0x17,0x1a,0x07,0xe6,0x0b,0x51,0xb5,0x9b,0xbf,0xdb,0xa8,0x05, + 0xe4,0x7a,0x01 + }; + +__fips_constseg +static const unsigned char p_521_sha512_pr_additionalinput2[] = + { + 0x9d,0x9c,0xbd,0x7e,0x2d,0x33,0x41,0x63,0xb7,0x44,0x91,0xd0, + 0xd1,0xaf,0x07,0x8a,0xb2,0xc4,0xd9,0xbc,0x72,0x37,0x70,0x7d, + 0x85,0x47,0x06,0x9e,0x73,0x2b,0x85,0xb7 + }; + +__fips_constseg +static const unsigned char p_521_sha512_pr_entropyinputpr2[] = + { + 0xcd,0x1e,0x0c,0x58,0xe9,0x65,0x44,0x95,0x7a,0x68,0xf1,0xe1, + 0xd7,0xc5,0xdb,0x89,0x0d,0xdc,0x30,0x0e,0x16,0xc1,0xe5,0xad, + 0x57,0x60,0x50,0x31,0x5f,0xf0,0x05,0xf7 + }; + +__fips_constseg +static const unsigned char p_521_sha512_pr_returnedbits[] = + { + 0x5b,0x24,0x8e,0xab,0x1b,0x1b,0x86,0xe0,0x65,0x11,0x84,0x75, + 0xbf,0x5b,0x00,0x0b,0xd8,0x08,0x7d,0x3f,0xfa,0x70,0xe7,0x65, + 0xe3,0x68,0xe8,0x1f,0x78,0x68,0x49,0x5d,0x06,0x3f,0x7b,0x9b, + 0xc2,0xc9,0x06,0x48,0xbd,0x3d,0x27,0x6c,0x36,0xc3,0xfb,0x57, + 0x89,0x8a,0x90,0x92,0x1c,0xc0,0xda,0x58,0xd8,0x0e,0x81,0x70, + 0x6d,0xd4,0x34 + }; + + +/* P-521 SHA-512 No PR */ +__fips_constseg +static const unsigned char p_521_sha512_entropyinput[] = + { + 0x3d,0x1f,0x10,0x75,0x3c,0x9f,0x09,0xf2,0xe2,0x38,0x50,0x8e, + 0x88,0xb1,0x1f,0x45,0xd3,0xb9,0x60,0xd9,0xd4,0x2f,0xed,0xbb, + 0x5f,0xb2,0x0e,0x3b,0xaa,0x6b,0x2e,0xee + }; + +__fips_constseg +static const unsigned char p_521_sha512_nonce[] = + { + 0x9d,0x59,0xbf,0xcb,0xcf,0x3f,0xe0,0xb1,0x2b,0x6f,0x3d,0xd8, + 0x38,0x77,0xf6,0x1c + }; + +__fips_constseg +static const unsigned char p_521_sha512_personalizationstring[] = + { + 0xf2,0x91,0xdb,0xef,0x70,0x9a,0x87,0x74,0xc4,0xf6,0x8e,0x09, + 0xe8,0x39,0xe5,0xc0,0x79,0x12,0xcb,0xeb,0x58,0x1c,0x88,0x81, + 0x83,0xe8,0x66,0xd0,0x2f,0x49,0xef,0x63 + }; + +__fips_constseg +static const unsigned char p_521_sha512_additionalinput[] = + { + 0x38,0x7c,0xdd,0x33,0xcd,0x09,0x12,0xc0,0xb8,0x73,0x72,0xdf, + 0xad,0xe1,0xe9,0xd2,0x69,0xd0,0xa0,0x1a,0xe5,0xfc,0x51,0x0a, + 0xd5,0x90,0xe9,0x8c,0x66,0x8c,0x63,0x35 + }; + +__fips_constseg +static const unsigned char p_521_sha512_int_returnedbits[] = + { + 0x7c,0xd6,0xd8,0xbb,0x12,0x5d,0xaf,0x65,0x65,0xd2,0x20,0x58, + 0x82,0x17,0xbb,0xd6,0x37,0x24,0x23,0xe2,0x49,0xe3,0x13,0x74, + 0x66,0x7a,0xaf,0x35,0x8f,0x18,0x88,0xa8,0xb8,0xc3,0x84,0xb1, + 0xb5,0xfa,0xf2,0x46,0x49,0x91,0x95,0x06,0x1a,0x8c,0xb3,0x94, + 0x78,0x11,0x73,0x9d,0xeb,0x07,0xc6,0x20,0x52,0x89,0xf1,0xaf, + 0xb2,0x66,0xba + }; + +__fips_constseg +static const unsigned char p_521_sha512_entropyinputreseed[] = + { + 0xd5,0x51,0xf0,0x88,0xb6,0xa5,0x26,0x8c,0x34,0x82,0xd3,0xa4, + 0xee,0x6e,0xc4,0x70,0x27,0xb8,0x85,0xa7,0xca,0x22,0x7b,0x62, + 0x9c,0xcf,0x3e,0xa9,0xc2,0x6e,0x3a,0x3e + }; + +__fips_constseg +static const unsigned char p_521_sha512_additionalinputreseed[] = + { + 0x22,0xce,0x9f,0x3b,0x36,0x8d,0x4e,0xe2,0xe5,0xff,0xaf,0x72, + 0x90,0xe8,0xfa,0x3b,0x16,0xe2,0xcb,0xc6,0xf1,0xac,0x5e,0xb8, + 0x8e,0xb0,0x0a,0x05,0xeb,0xd4,0xfd,0x58 + }; + +__fips_constseg +static const unsigned char p_521_sha512_additionalinput2[] = + { + 0x2f,0x55,0x03,0xe2,0x5f,0x58,0xf4,0xc8,0xf9,0x98,0x79,0x9a, + 0x1e,0x44,0xa5,0x0d,0x38,0x20,0x5e,0xe4,0x54,0x0a,0xd4,0x1f, + 0xc3,0xcf,0x3e,0x66,0xf2,0x2f,0xd5,0xb6 + }; + +__fips_constseg +static const unsigned char p_521_sha512_returnedbits[] = + { + 0x2e,0xbf,0x98,0xf9,0x85,0x27,0x8b,0xff,0x36,0xb9,0x40,0x0b, + 0xc0,0xa1,0xa0,0x13,0x20,0x06,0xcc,0xe6,0x2a,0x03,0x77,0x7d, + 0xee,0xde,0xcc,0x34,0xe3,0xcd,0x77,0xea,0xd0,0x3e,0xbe,0xdd, + 0xf6,0x15,0xfb,0xa7,0xd7,0x8e,0xd0,0x2e,0x2f,0x82,0x4c,0xc7, + 0x87,0xb1,0x6f,0xc5,0xf8,0x5c,0x78,0xde,0x77,0x9b,0x15,0x9a, + 0xb9,0x3c,0x38 + }; + diff --git a/fips/rand/fips_rand_lcl.h b/fips/rand/fips_rand_lcl.h index 7f6cdffe10..e03537bd5f 100644 --- a/fips/rand/fips_rand_lcl.h +++ b/fips/rand/fips_rand_lcl.h @@ -236,5 +236,6 @@ struct drbg_ctx_st int fips_drbg_ctr_init(DRBG_CTX *dctx); int fips_drbg_hash_init(DRBG_CTX *dctx); int fips_drbg_hmac_init(DRBG_CTX *dctx); +int fips_drbg_ec_init(DRBG_CTX *dctx); int fips_drbg_kat(DRBG_CTX *dctx, int nid, unsigned int flags); int fips_drbg_cprng_test(DRBG_CTX *dctx, const unsigned char *out); -- 2.25.1