From f844f9eb44186df2f8b0cfd3264b4eb003d8c61a Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 13 Apr 2020 22:34:56 +0200 Subject: Rename FIPS_MODE to FIPS_MODULE This macro is used to determine if certain pieces of code should become part of the FIPS module or not. The old name was confusing. Fixes #11538 Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/11539) --- crypto/bn/bn_conv.c | 4 +- crypto/bn/bn_ctx.c | 10 ++-- crypto/bn/bn_dh.c | 6 +-- crypto/bn/bn_prime.c | 8 ++-- crypto/bn/bn_rand.c | 8 ++-- crypto/context.c | 10 ++-- crypto/core_namemap.c | 8 ++-- crypto/dh/dh_check.c | 8 ++-- crypto/dh/dh_gen.c | 18 ++++---- crypto/dh/dh_group_params.c | 4 +- crypto/dh/dh_key.c | 20 ++++---- crypto/dh/dh_lib.c | 30 ++++++------ crypto/dh/dh_local.h | 2 +- crypto/dh/dh_pmeth.c | 10 ++-- crypto/dsa/dsa_gen.c | 8 ++-- crypto/dsa/dsa_key.c | 8 ++-- crypto/dsa/dsa_lib.c | 22 ++++----- crypto/dsa/dsa_local.h | 2 +- crypto/dsa/dsa_ossl.c | 4 +- crypto/ec/ec2_oct.c | 20 ++++---- crypto/ec/ec2_smpl.c | 28 +++++------ crypto/ec/ec_asn1.c | 4 +- crypto/ec/ec_check.c | 4 +- crypto/ec/ec_ctrl.c | 2 +- crypto/ec/ec_curve.c | 42 ++++++++--------- crypto/ec/ec_key.c | 18 ++++---- crypto/ec/ec_kmeth.c | 8 ++-- crypto/ec/ec_lib.c | 24 +++++----- crypto/ec/ec_local.h | 2 +- crypto/ec/ec_mult.c | 6 +-- crypto/ec/ecp_nistp224.c | 10 ++-- crypto/ec/ecp_nistp256.c | 10 ++-- crypto/ec/ecp_nistp521.c | 10 ++-- crypto/ec/ecp_oct.c | 4 +- crypto/evp/digest.c | 28 +++++------ crypto/evp/e_aes.c | 10 ++-- crypto/evp/evp_enc.c | 24 +++++----- crypto/evp/evp_fetch.c | 4 +- crypto/evp/evp_lib.c | 14 +++--- crypto/evp/exchange.c | 4 +- crypto/evp/m_sigver.c | 6 +-- crypto/evp/p_lib.c | 54 +++++++++++----------- crypto/evp/pmeth_check.c | 6 +-- crypto/evp/pmeth_gn.c | 16 +++---- crypto/evp/pmeth_lib.c | 24 +++++----- crypto/ffc/ffc_params.c | 6 +-- crypto/ffc/ffc_params_generate.c | 2 +- crypto/initthread.c | 18 ++++---- crypto/mem.c | 4 +- crypto/ppccap.c | 4 +- crypto/property/property.c | 2 +- crypto/provider_core.c | 42 ++++++++--------- crypto/provider_predefined.c | 2 +- crypto/rand/drbg_ctr.c | 2 +- crypto/rand/drbg_lib.c | 12 ++--- crypto/rand/rand_lib.c | 16 +++---- crypto/rand/rand_local.h | 2 +- crypto/rand/rand_unix.c | 6 +-- crypto/rand/rand_win.c | 2 +- crypto/rsa/rsa_chk.c | 10 ++-- crypto/rsa/rsa_gen.c | 8 ++-- crypto/rsa/rsa_lib.c | 42 ++++++++--------- crypto/rsa/rsa_local.h | 2 +- crypto/rsa/rsa_mp_names.c | 6 +-- crypto/rsa/rsa_oaep.c | 6 +-- crypto/rsa/rsa_ossl.c | 22 ++++----- crypto/rsa/rsa_pk1.c | 2 +- crypto/rsa/rsa_sign.c | 20 ++++---- crypto/rsa/rsa_sp800_56b_check.c | 4 +- crypto/self_test_core.c | 4 +- crypto/threads_pthread.c | 4 +- include/crypto/evp.h | 12 ++--- include/internal/ffc.h | 4 +- include/internal/thread_once.h | 4 +- providers/build.info | 8 ++-- providers/common/der/der_rsa.c.in | 2 +- providers/common/provider_util.c | 8 ++-- providers/fips/fipsprov.c | 2 +- .../implementations/ciphers/cipher_aes_xts_fips.c | 4 +- providers/implementations/exchange/ecdh_exch.c | 8 ++-- .../implementations/include/prov/implementations.h | 4 +- providers/implementations/kdfs/pbkdf2_fips.c | 4 +- providers/implementations/keymgmt/rsa_kmgmt.c | 2 +- providers/implementations/signature/rsa.c | 4 +- test/aesgcmtest.c | 8 ++-- test/drbg_cavs_test.c | 2 +- test/drbgtest.c | 10 ++-- test/ecdsatest.c | 4 +- test/evp_extra_test.c | 4 +- 89 files changed, 458 insertions(+), 458 deletions(-) diff --git a/crypto/bn/bn_conv.c b/crypto/bn/bn_conv.c index fd21464d74..089b755748 100644 --- a/crypto/bn/bn_conv.c +++ b/crypto/bn/bn_conv.c @@ -46,8 +46,8 @@ char *BN_bn2hex(const BIGNUM *a) return buf; } -#ifndef FIPS_MODE -/* No BIO_snprintf in FIPS_MODE */ +#ifndef FIPS_MODULE +/* No BIO_snprintf in FIPS_MODULE */ /* Must 'OPENSSL_free' the returned data */ char *BN_bn2dec(const BIGNUM *a) { diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c index ecc0034bbc..5fc8322a31 100644 --- a/crypto/bn/bn_ctx.c +++ b/crypto/bn/bn_ctx.c @@ -90,7 +90,7 @@ struct bignum_ctx { OPENSSL_CTX *libctx; }; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* Debugging functionality */ static void ctxdbg(BIO *channel, const char *text, BN_CTX *ctx) { @@ -126,7 +126,7 @@ static void ctxdbg(BIO *channel, const char *text, BN_CTX *ctx) #else /* TODO(3.0): Consider if we want to do this in FIPS mode */ # define CTXDBG(str, ctx) do {} while(0) -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ BN_CTX *BN_CTX_new_ex(OPENSSL_CTX *ctx) { @@ -143,7 +143,7 @@ BN_CTX *BN_CTX_new_ex(OPENSSL_CTX *ctx) return ret; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *BN_CTX_new(void) { return BN_CTX_new_ex(NULL); @@ -159,7 +159,7 @@ BN_CTX *BN_CTX_secure_new_ex(OPENSSL_CTX *ctx) return ret; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *BN_CTX_secure_new(void) { return BN_CTX_secure_new_ex(NULL); @@ -170,7 +170,7 @@ void BN_CTX_free(BN_CTX *ctx) { if (ctx == NULL) return; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE OSSL_TRACE_BEGIN(BN_CTX) { BN_POOL_ITEM *pool = ctx->pool.head; BIO_printf(trc_out, diff --git a/crypto/bn/bn_dh.c b/crypto/bn/bn_dh.c index 9ffb6d8d83..9a7cc17f62 100644 --- a/crypto/bn/bn_dh.c +++ b/crypto/bn/bn_dh.c @@ -22,7 +22,7 @@ /* DH parameters from RFC3526 */ -# ifndef FIPS_MODE +# ifndef FIPS_MODULE /* * "1536-bit MODP Group" from RFC3526, Section 2. * @@ -60,7 +60,7 @@ static const BN_ULONG modp_1536_q[] = { BN_DEF(0x4533E63A, 0x94812704), BN_DEF(0xC06E0E68, 0x62633145), BN_DEF(0x10B4611A, 0xE487ED51), BN_DEF(0xFFFFFFFF, 0x7FFFFFFF) }; -# endif /* FIPS_MODE */ +# endif /* FIPS_MODULE */ /*- * "2048-bit MODP Group" from RFC3526, Section 3. @@ -1037,7 +1037,7 @@ make_dh_bn(ffdhe6144_q) make_dh_bn(ffdhe8192_p) make_dh_bn(ffdhe8192_q) -# ifndef FIPS_MODE +# ifndef FIPS_MODULE make_dh_bn(modp_1536_p) make_dh_bn(modp_1536_q) # endif diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c index ce5789ea3e..20fa0baac7 100644 --- a/crypto/bn/bn_prime.c +++ b/crypto/bn/bn_prime.c @@ -207,7 +207,7 @@ int BN_generate_prime_ex2(BIGNUM *ret, int bits, int safe, return found; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb) { @@ -265,7 +265,7 @@ static int bn_is_prime_int(const BIGNUM *w, int checks, BN_CTX *ctx, int do_trial_division, BN_GENCB *cb) { int i, status, ret = -1; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *ctxlocal = NULL; #else @@ -301,7 +301,7 @@ static int bn_is_prime_int(const BIGNUM *w, int checks, BN_CTX *ctx, if (!BN_GENCB_call(cb, 1, -1)) return -1; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL && (ctxlocal = ctx = BN_CTX_new()) == NULL) goto err; #endif @@ -311,7 +311,7 @@ static int bn_is_prime_int(const BIGNUM *w, int checks, BN_CTX *ctx, goto err; ret = (status == BN_PRIMETEST_PROBABLY_PRIME); err: -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(ctxlocal); #endif return ret; diff --git a/crypto/bn/bn_rand.c b/crypto/bn/bn_rand.c index 91cb39ee49..e603bb7030 100644 --- a/crypto/bn/bn_rand.c +++ b/crypto/bn/bn_rand.c @@ -103,7 +103,7 @@ int BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, BN_CTX *ctx) { return bnrand(NORMAL, rnd, bits, top, bottom, ctx); } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) { return bnrand(NORMAL, rnd, bits, top, bottom, NULL); @@ -120,7 +120,7 @@ int BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, BN_CTX *ctx) return bnrand(PRIVATE, rnd, bits, top, bottom, ctx); } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) { return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); @@ -199,7 +199,7 @@ int BN_rand_range_ex(BIGNUM *r, const BIGNUM *range, BN_CTX *ctx) return bnrand_range(NORMAL, r, range, ctx); } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int BN_rand_range(BIGNUM *r, const BIGNUM *range) { return bnrand_range(NORMAL, r, range, NULL); @@ -211,7 +211,7 @@ int BN_priv_rand_range_ex(BIGNUM *r, const BIGNUM *range, BN_CTX *ctx) return bnrand_range(PRIVATE, r, range, ctx); } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) { return bnrand_range(PRIVATE, r, range, NULL); diff --git a/crypto/context.c b/crypto/context.c index cf3b078b5d..1c95298ea2 100644 --- a/crypto/context.c +++ b/crypto/context.c @@ -39,7 +39,7 @@ struct openssl_ctx_st { struct openssl_ctx_onfree_list_st *onfreelist; }; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE static OPENSSL_CTX default_context_int; /* Always points at default_context_int if it has been initialised */ @@ -119,7 +119,7 @@ static int context_deinit(OPENSSL_CTX *ctx) return 1; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE void openssl_ctx_default_deinit(void) { context_deinit(default_context); @@ -146,7 +146,7 @@ OPENSSL_CTX *OPENSSL_CTX_new(void) return ctx; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int OPENSSL_CTX_load_config(OPENSSL_CTX *ctx, const char *config_file) { return CONF_modules_load_file_with_libctx(ctx, config_file, NULL, 0) > 0; @@ -162,7 +162,7 @@ void OPENSSL_CTX_free(OPENSSL_CTX *ctx) OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx) { -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) { if (!RUN_ONCE(&default_context_init, do_default_context_init)) return 0; @@ -174,7 +174,7 @@ OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx) int openssl_ctx_is_default(OPENSSL_CTX *ctx) { -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL || ctx == default_context) return 1; #endif diff --git a/crypto/core_namemap.c b/crypto/core_namemap.c index 3d509314fa..94c80de091 100644 --- a/crypto/core_namemap.c +++ b/crypto/core_namemap.c @@ -136,7 +136,7 @@ int ossl_namemap_name2num_n(const OSSL_NAMEMAP *namemap, NAMENUM_ENTRY *namenum_entry, namenum_tmpl; int number = 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (namemap == NULL) namemap = ossl_namemap_stored(NULL); #endif @@ -198,7 +198,7 @@ int ossl_namemap_add_name_n(OSSL_NAMEMAP *namemap, int number, NAMENUM_ENTRY *namenum = NULL; int tmp_number; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (namemap == NULL) namemap = ossl_namemap_stored(NULL); #endif @@ -309,7 +309,7 @@ int ossl_namemap_add_names(OSSL_NAMEMAP *namemap, int number, * ============== */ -#ifndef FIPS_MODE +#ifndef FIPS_MODULE #include /* Creates an initial namemap with names found in the legacy method db */ @@ -366,7 +366,7 @@ OSSL_NAMEMAP *ossl_namemap_stored(OPENSSL_CTX *libctx) openssl_ctx_get_data(libctx, OPENSSL_CTX_NAMEMAP_INDEX, &stored_namemap_method); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (namemap != NULL && ossl_namemap_empty(namemap)) { /* Before pilfering, we make sure the legacy database is populated */ OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS diff --git a/crypto/dh/dh_check.c b/crypto/dh/dh_check.c index a25e83f15e..9dd595ae12 100644 --- a/crypto/dh/dh_check.c +++ b/crypto/dh/dh_check.c @@ -44,7 +44,7 @@ int DH_check_params_ex(const DH *dh) return errflags == 0; } -#ifdef FIPS_MODE +#ifdef FIPS_MODULE int DH_check_params(const DH *dh, int *ret) { int nid; @@ -102,7 +102,7 @@ int DH_check_params(const DH *dh, int *ret) BN_CTX_free(ctx); return ok; } -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ /*- * Check that p is a safe prime and @@ -140,7 +140,7 @@ int DH_check_ex(const DH *dh) /* Note: according to documentation - this only checks the params */ int DH_check(const DH *dh, int *ret) { -#ifdef FIPS_MODE +#ifdef FIPS_MODULE return DH_check_params(dh, ret); #else int ok = 0, r; @@ -210,7 +210,7 @@ int DH_check(const DH *dh, int *ret) BN_CTX_end(ctx); BN_CTX_free(ctx); return ok; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ } int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key) diff --git a/crypto/dh/dh_gen.c b/crypto/dh/dh_gen.c index 39bb365216..327f6ff610 100644 --- a/crypto/dh/dh_gen.c +++ b/crypto/dh/dh_gen.c @@ -30,10 +30,10 @@ #include "crypto/dh.h" #include "dh_local.h" -#ifndef FIPS_MODE +#ifndef FIPS_MODULE static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_GENCB *cb); -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ int dh_generate_ffc_parameters(DH *dh, int type, int pbits, int qbits, EVP_MD *md, BN_GENCB *cb) @@ -47,7 +47,7 @@ int dh_generate_ffc_parameters(DH *dh, int type, int pbits, qbits = (pbits >= 2048 ? SHA256_DIGEST_LENGTH : SHA_DIGEST_LENGTH) * 8; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (type == DH_PARAMGEN_TYPE_FIPS_186_2) ret = ffc_params_FIPS186_2_generate(dh->libctx, &dh->params, FFC_PARAM_TYPE_DH, @@ -96,7 +96,7 @@ int dh_get_named_group_uid_from_size(int pbits) return nid; } -#ifdef FIPS_MODE +#ifdef FIPS_MODULE static int dh_gen_named_group(OPENSSL_CTX *libctx, DH *ret, int prime_len) { @@ -116,12 +116,12 @@ static int dh_gen_named_group(OPENSSL_CTX *libctx, DH *ret, int prime_len) DH_free(dh); return ok; } -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb) { -#ifdef FIPS_MODE +#ifdef FIPS_MODULE if (generator != 2) return 0; return dh_gen_named_group(ret->libctx, ret, prime_len); @@ -129,10 +129,10 @@ int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, if (ret->meth->generate_params) return ret->meth->generate_params(ret, prime_len, generator, cb); return dh_builtin_genparams(ret, prime_len, generator, cb); -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /*- * We generate DH parameters as follows * find a prime p which is prime_len bits long, @@ -238,4 +238,4 @@ static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_CTX_free(ctx); return ok; } -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ diff --git a/crypto/dh/dh_group_params.c b/crypto/dh/dh_group_params.c index 7221e806c5..e0daa6ebc4 100644 --- a/crypto/dh/dh_group_params.c +++ b/crypto/dh/dh_group_params.c @@ -59,7 +59,7 @@ static const DH_NAMED_GROUP dh_named_groups[] = { FFDHE(4096), FFDHE(6144), FFDHE(8192), -#ifndef FIPS_MODE +#ifndef FIPS_MODULE MODP(1536), #endif MODP(2048), @@ -71,7 +71,7 @@ static const DH_NAMED_GROUP dh_named_groups[] = { * Additional dh named groups from RFC 5114 that have a different g. * The uid can be any unique identifier. */ -#ifndef FIPS_MODE +#ifndef FIPS_MODULE RFC5114("dh_1024_160", 1, 1024, 1024_160), RFC5114("dh_2048_224", 2, 2048, 2048_224), RFC5114("dh_2048_256", 3, 2048, 2048_256), diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c index 918949d953..1893b487ca 100644 --- a/crypto/dh/dh_key.c +++ b/crypto/dh/dh_key.c @@ -20,7 +20,7 @@ #include "crypto/dh.h" #include "crypto/security_bits.h" -#ifdef FIPS_MODE +#ifdef FIPS_MODULE # define MIN_STRENGTH 112 #else # define MIN_STRENGTH 80 @@ -39,7 +39,7 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) BN_MONT_CTX *mont = NULL; BIGNUM *tmp; int ret = -1; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int check_result; #endif @@ -74,7 +74,7 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) goto err; } /* TODO(3.0) : Solve in a PR related to Key validation for DH */ -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (!DH_check_pub_key(dh, pub_key, &check_result) || check_result) { DHerr(0, DH_R_INVALID_PUBKEY); goto err; @@ -95,7 +95,7 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) { -#ifdef FIPS_MODE +#ifdef FIPS_MODULE return compute_key(key, pub_key, dh); #else return dh->meth->compute_key(key, pub_key, dh); @@ -106,7 +106,7 @@ int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh) { int rv, pad; -#ifdef FIPS_MODE +#ifdef FIPS_MODULE rv = compute_key(key, pub_key, dh); #else rv = dh->meth->compute_key(key, pub_key, dh); @@ -166,16 +166,16 @@ static int dh_finish(DH *dh) return 1; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE void DH_set_default_method(const DH_METHOD *meth) { default_DH_method = meth; } -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ int DH_generate_key(DH *dh) { -#ifdef FIPS_MODE +#ifdef FIPS_MODULE return generate_key(dh); #else return dh->meth->generate_key(dh); @@ -214,7 +214,7 @@ static int generate_key(DH *dh) { int ok = 0; int generate_new_key = 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE unsigned l; #endif BN_CTX *ctx = NULL; @@ -264,7 +264,7 @@ static int generate_key(DH *dh) max_strength, priv_key)) goto err; } else { -#ifdef FIPS_MODE +#ifdef FIPS_MODULE if (dh->params.q == NULL) goto err; #else diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 7e42d13f3c..c3585f264f 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -26,7 +26,7 @@ static DH *dh_new_intern(ENGINE *engine, OPENSSL_CTX *libctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int DH_set_method(DH *dh, const DH_METHOD *meth) { /* @@ -61,7 +61,7 @@ DH *DH_new_method(ENGINE *engine) { return dh_new_intern(engine, NULL); } -#endif /* !FIPS_MODE */ +#endif /* !FIPS_MODULE */ DH *dh_new_with_libctx(OPENSSL_CTX *libctx) { @@ -87,7 +87,7 @@ static DH *dh_new_intern(ENGINE *engine, OPENSSL_CTX *libctx) ret->libctx = libctx; ret->meth = DH_get_default_method(); -#if !defined(FIPS_MODE) && !defined(OPENSSL_NO_ENGINE) +#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_ENGINE) ret->flags = ret->meth->flags; /* early default init */ if (engine) { if (!ENGINE_init(engine)) { @@ -108,10 +108,10 @@ static DH *dh_new_intern(ENGINE *engine, OPENSSL_CTX *libctx) ret->flags = ret->meth->flags; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data)) goto err; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ if ((ret->meth->init != NULL) && !ret->meth->init(ret)) { DHerr(0, ERR_R_INIT_FAIL); @@ -140,7 +140,7 @@ void DH_free(DH *r) if (r->meth != NULL && r->meth->finish != NULL) r->meth->finish(r); -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) # if !defined(OPENSSL_NO_ENGINE) ENGINE_finish(r->engine); # endif @@ -167,7 +167,7 @@ int DH_up_ref(DH *r) return ((i > 1) ? 1 : 0); } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int DH_set_ex_data(DH *d, int idx, void *arg) { return CRYPTO_set_ex_data(&d->ex_data, idx, arg); @@ -310,12 +310,12 @@ void DH_set_flags(DH *dh, int flags) dh->flags |= flags; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE ENGINE *DH_get0_engine(DH *dh) { return dh->engine; } -#endif /*FIPS_MODE */ +#endif /*FIPS_MODULE */ FFC_PARAMS *dh_get0_params(DH *dh) { @@ -400,7 +400,7 @@ int EVP_PKEY_CTX_set_dh_paramgen_type(EVP_PKEY_CTX *ctx, int typ) if ((ret = dh_paramgen_check(ctx)) <= 0) return ret; -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) /* TODO(3.0): Remove this eventually when no more legacy */ if (ctx->op.keymgmt.genctx == NULL) return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, @@ -426,7 +426,7 @@ int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int pbits) if ((ret = dh_paramgen_check(ctx)) <= 0) return ret; -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) /* TODO(3.0): Remove this eventually when no more legacy */ if (ctx->op.keymgmt.genctx == NULL) return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, @@ -447,7 +447,7 @@ int EVP_PKEY_CTX_set_dh_paramgen_subprime_len(EVP_PKEY_CTX *ctx, int qbits) if ((ret = dh_paramgen_check(ctx)) <= 0) return ret; -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) /* TODO(3.0): Remove this eventually when no more legacy */ if (ctx->op.keymgmt.genctx == NULL) return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, @@ -468,7 +468,7 @@ int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen) if ((ret = dh_paramgen_check(ctx)) <= 0) return ret; -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) /* TODO(3.0): Remove this eventually when no more legacy */ if (ctx->op.keymgmt.genctx == NULL) return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, @@ -490,7 +490,7 @@ int EVP_PKEY_CTX_set_dh_rfc5114(EVP_PKEY_CTX *ctx, int gen) if ((ret = dh_paramgen_check(ctx)) <= 0) return ret; -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) /* TODO(3.0): Remove this eventually when no more legacy */ if (ctx->op.keymgmt.genctx == NULL) return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, @@ -520,7 +520,7 @@ int EVP_PKEY_CTX_set_dh_nid(EVP_PKEY_CTX *ctx, int nid) if ((ret = dh_paramgen_check(ctx)) <= 0) return ret; -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) /* TODO(3.0): Remove this eventually when no more legacy */ if (ctx->op.keymgmt.genctx == NULL) return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, diff --git a/crypto/dh/dh_local.h b/crypto/dh/dh_local.h index 3b0181f76a..a54d25f487 100644 --- a/crypto/dh/dh_local.h +++ b/crypto/dh/dh_local.h @@ -28,7 +28,7 @@ struct dh_st { int flags; BN_MONT_CTX *method_mont_p; CRYPTO_REF_COUNT references; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE CRYPTO_EX_DATA ex_data; ENGINE *engine; #endif diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c index 0d0b6a842f..23527acf04 100644 --- a/crypto/dh/dh_pmeth.c +++ b/crypto/dh/dh_pmeth.c @@ -306,7 +306,7 @@ static DH *ffc_params_generate(OPENSSL_CTX *libctx, DH_PKEY_CTX *dctx, else md = EVP_sha1(); } -# ifndef FIPS_MODE +# ifndef FIPS_MODULE if (dctx->paramgen_type == DH_PARAMGEN_TYPE_FIPS_186_2) rv = ffc_params_FIPS186_2_generate(libctx, &ret->params, FFC_PARAM_TYPE_DH, @@ -346,7 +346,7 @@ static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, return 1; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (dctx->rfc5114_param) { switch (dctx->rfc5114_param) { case 1: @@ -367,7 +367,7 @@ static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY_assign(pkey, EVP_PKEY_DHX, dh); return 1; } -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ if (ctx->pkey_gencb != NULL) { pcb = BN_GENCB_new(); @@ -375,9 +375,9 @@ static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, return 0; evp_pkey_set_cb_translate(pcb, ctx); } -# ifdef FIPS_MODE +# ifdef FIPS_MODULE dctx->paramgen_type = DH_PARAMGEN_TYPE_FIPS_186_4; -# endif /* FIPS_MODE */ +# endif /* FIPS_MODULE */ if (dctx->paramgen_type >= DH_PARAMGEN_TYPE_FIPS_186_2) { dh = ffc_params_generate(NULL, dctx, pcb); BN_GENCB_free(pcb); diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c index 7b72867f71..acd088ee79 100644 --- a/crypto/dsa/dsa_gen.c +++ b/crypto/dsa/dsa_gen.c @@ -36,7 +36,7 @@ int dsa_generate_ffc_parameters(DSA *dsa, int type, qbits = (pbits >= 2048 ? SHA256_DIGEST_LENGTH : SHA_DIGEST_LENGTH) * 8; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (type == DSA_PARAMGEN_TYPE_FIPS_186_2) ret = ffc_params_FIPS186_2_generate(dsa->libctx, &dsa->params, FFC_PARAM_TYPE_DSA, @@ -51,13 +51,13 @@ int dsa_generate_ffc_parameters(DSA *dsa, int type, return ret; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int DSA_generate_parameters_ex(DSA *dsa, int bits, const unsigned char *seed_in, int seed_len, int *counter_ret, unsigned long *h_ret, BN_GENCB *cb) { -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (dsa->meth->dsa_paramgen) return dsa->meth->dsa_paramgen(dsa, bits, seed_in, seed_len, counter_ret, h_ret, cb); @@ -66,7 +66,7 @@ int DSA_generate_parameters_ex(DSA *dsa, int bits, && !ffc_params_set_validate_params(&dsa->params, seed_in, seed_len, -1)) return 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* The old code used FIPS 186-2 DSA Parameter generation */ if (bits <= 1024 && seed_len == 20) { if (!dsa_generate_ffc_parameters(dsa, DSA_PARAMGEN_TYPE_FIPS_186_2, diff --git a/crypto/dsa/dsa_key.c b/crypto/dsa/dsa_key.c index f9bb3470f6..7bd9c5ff2e 100644 --- a/crypto/dsa/dsa_key.c +++ b/crypto/dsa/dsa_key.c @@ -21,7 +21,7 @@ #include "crypto/dsa.h" #include "dsa_local.h" -#ifdef FIPS_MODE +#ifdef FIPS_MODULE # define MIN_STRENGTH 112 #else # define MIN_STRENGTH 80 @@ -32,7 +32,7 @@ static int dsa_keygen_pairwise_test(DSA *dsa, OSSL_CALLBACK *cb, void *cbarg); int DSA_generate_key(DSA *dsa) { -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (dsa->meth->dsa_keygen != NULL) return dsa->meth->dsa_keygen(dsa); #endif @@ -96,9 +96,9 @@ static int dsa_keygen(DSA *dsa, int pairwise_test) dsa->priv_key = priv_key; dsa->pub_key = pub_key; -#ifdef FIPS_MODE +#ifdef FIPS_MODULE pairwise_test = 1; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ ok = 1; if (pairwise_test) { diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c index b773f2c526..e71a8c8f8e 100644 --- a/crypto/dsa/dsa_lib.c +++ b/crypto/dsa/dsa_lib.c @@ -27,7 +27,7 @@ static DSA *dsa_new_intern(ENGINE *engine, OPENSSL_CTX *libctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int DSA_set_ex_data(DSA *d, int idx, void *arg) { @@ -124,7 +124,7 @@ int DSA_set_method(DSA *dsa, const DSA_METHOD *meth) meth->init(dsa); return 1; } -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ const DSA_METHOD *DSA_get_method(DSA *d) @@ -151,7 +151,7 @@ static DSA *dsa_new_intern(ENGINE *engine, OPENSSL_CTX *libctx) ret->libctx = libctx; ret->meth = DSA_get_default_method(); -#if !defined(FIPS_MODE) && !defined(OPENSSL_NO_ENGINE) +#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_ENGINE) ret->flags = ret->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW; /* early default init */ if (engine) { if (!ENGINE_init(engine)) { @@ -172,7 +172,7 @@ static DSA *dsa_new_intern(ENGINE *engine, OPENSSL_CTX *libctx) ret->flags = ret->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (!crypto_new_ex_data_ex(libctx, CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data)) goto err; #endif @@ -199,7 +199,7 @@ DSA *dsa_new_with_ctx(OPENSSL_CTX *libctx) return dsa_new_intern(NULL, libctx); } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE DSA *DSA_new(void) { return dsa_new_intern(NULL, NULL); @@ -221,11 +221,11 @@ void DSA_free(DSA *r) if (r->meth != NULL && r->meth->finish != NULL) r->meth->finish(r); -#if !defined(FIPS_MODE) && !defined(OPENSSL_NO_ENGINE) +#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_ENGINE) ENGINE_finish(r->engine); #endif -#ifndef FIPS_MODE +#ifndef FIPS_MODULE CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, r, &r->ex_data); #endif @@ -430,7 +430,7 @@ int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits) if ((ret = dsa_paramgen_check(ctx)) <= 0) return ret; -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) /* TODO(3.0): Remove this eventually when no more legacy */ if (ctx->op.keymgmt.genctx == NULL) return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, @@ -452,7 +452,7 @@ int EVP_PKEY_CTX_set_dsa_paramgen_q_bits(EVP_PKEY_CTX *ctx, int qbits) if ((ret = dsa_paramgen_check(ctx)) <= 0) return ret; -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) /* TODO(3.0): Remove this eventually when no more legacy */ if (ctx->op.keymgmt.genctx == NULL) return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, @@ -475,7 +475,7 @@ int EVP_PKEY_CTX_set_dsa_paramgen_md_props(EVP_PKEY_CTX *ctx, if ((ret = dsa_paramgen_check(ctx)) <= 0) return ret; -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) /* TODO(3.0): Remove this eventually when no more legacy */ if (ctx->op.keymgmt.genctx == NULL) { const EVP_MD *md = EVP_get_digestbyname(md_name); @@ -495,7 +495,7 @@ int EVP_PKEY_CTX_set_dsa_paramgen_md_props(EVP_PKEY_CTX *ctx, return EVP_PKEY_CTX_set_params(ctx, params); } -#if !defined(FIPS_MODE) +#if !defined(FIPS_MODULE) int EVP_PKEY_CTX_set_dsa_paramgen_md(EVP_PKEY_CTX *ctx, const EVP_MD *md) { const char *md_name = (md == NULL) ? "" : EVP_MD_name(md); diff --git a/crypto/dsa/dsa_local.h b/crypto/dsa/dsa_local.h index b841595c1c..7b43ec6108 100644 --- a/crypto/dsa/dsa_local.h +++ b/crypto/dsa/dsa_local.h @@ -25,7 +25,7 @@ struct dsa_st { /* Normally used to cache montgomery values */ BN_MONT_CTX *method_mont_p; CRYPTO_REF_COUNT references; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE CRYPTO_EX_DATA ex_data; #endif const DSA_METHOD *meth; diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c index 7288832e08..b52fa1c00b 100644 --- a/crypto/dsa/dsa_ossl.c +++ b/crypto/dsa/dsa_ossl.c @@ -50,12 +50,12 @@ static DSA_METHOD openssl_dsa_meth = { static const DSA_METHOD *default_DSA_method = &openssl_dsa_meth; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE void DSA_set_default_method(const DSA_METHOD *meth) { default_DSA_method = meth; } -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ const DSA_METHOD *DSA_get_default_method(void) { diff --git a/crypto/ec/ec2_oct.c b/crypto/ec/ec2_oct.c index d4a7a1abdc..78eea869a3 100644 --- a/crypto/ec/ec2_oct.c +++ b/crypto/ec/ec2_oct.c @@ -43,7 +43,7 @@ int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, { BIGNUM *tmp, *x, *y, *z; int ret = 0, z0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; /* clear error queue */ @@ -81,7 +81,7 @@ int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, if (!BN_GF2m_add(tmp, x, tmp)) goto err; if (!BN_GF2m_mod_solve_quad_arr(z, tmp, group->poly, ctx)) { -#ifndef FIPS_MODE +#ifndef FIPS_MODULE unsigned long err = ERR_peek_last_error(); if (ERR_GET_LIB(err) == ERR_LIB_BN @@ -113,7 +113,7 @@ int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -132,7 +132,7 @@ size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, int used_ctx = 0; BIGNUM *x, *y, *yxi; size_t field_len, i, skip; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif @@ -168,7 +168,7 @@ size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, goto err; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) { ctx = new_ctx = BN_CTX_new(); if (ctx == NULL) @@ -236,7 +236,7 @@ size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, if (used_ctx) BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -244,7 +244,7 @@ size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, err: if (used_ctx) BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return 0; @@ -263,7 +263,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, BIGNUM *x, *y, *yxi; size_t field_len, enc_len; int ret = 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif @@ -305,7 +305,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, return 0; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) { ctx = new_ctx = BN_CTX_new(); if (ctx == NULL) @@ -358,7 +358,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; diff --git a/crypto/ec/ec2_smpl.c b/crypto/ec/ec2_smpl.c index 5d921b6606..98d128927d 100644 --- a/crypto/ec/ec2_smpl.c +++ b/crypto/ec/ec2_smpl.c @@ -182,7 +182,7 @@ int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group, { int ret = 0; BIGNUM *b; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; if (ctx == NULL) { @@ -213,7 +213,7 @@ int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group, err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -361,7 +361,7 @@ int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, { BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *t; int ret = 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif @@ -377,7 +377,7 @@ int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, return 1; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) { ctx = new_ctx = BN_CTX_new(); if (ctx == NULL) @@ -467,7 +467,7 @@ int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -514,7 +514,7 @@ int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif @@ -528,7 +528,7 @@ int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, if (!point->Z_is_one) return -1; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) { ctx = new_ctx = BN_CTX_new(); if (ctx == NULL) @@ -566,7 +566,7 @@ int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -584,7 +584,7 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, { BIGNUM *aX, *aY, *bX, *bY; int ret = -1; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif @@ -599,7 +599,7 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, return ((BN_cmp(a->X, b->X) == 0) && BN_cmp(a->Y, b->Y) == 0) ? 0 : 1; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) { ctx = new_ctx = BN_CTX_new(); if (ctx == NULL) @@ -623,7 +623,7 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -635,14 +635,14 @@ int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point, { BIGNUM *x, *y; int ret = 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) return 1; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) { ctx = new_ctx = BN_CTX_new(); if (ctx == NULL) @@ -670,7 +670,7 @@ int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point, err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c index fcd039653f..b2c91efbfd 100644 --- a/crypto/ec/ec_asn1.c +++ b/crypto/ec/ec_asn1.c @@ -21,7 +21,7 @@ #include "internal/nelem.h" #include "crypto/asn1_dsa.h" -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int EC_GROUP_get_basis_type(const EC_GROUP *group) { @@ -1237,7 +1237,7 @@ int i2o_ECPublicKey(const EC_KEY *a, unsigned char **out) DECLARE_ASN1_FUNCTIONS(ECDSA_SIG) DECLARE_ASN1_ENCODE_FUNCTIONS_name(ECDSA_SIG, ECDSA_SIG) -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ ECDSA_SIG *ECDSA_SIG_new(void) { diff --git a/crypto/ec/ec_check.c b/crypto/ec/ec_check.c index aba437a54d..a29519cc4d 100644 --- a/crypto/ec/ec_check.c +++ b/crypto/ec/ec_check.c @@ -45,7 +45,7 @@ int EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only, int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx) { -#ifdef FIPS_MODE +#ifdef FIPS_MODULE /* * ECC domain parameter validation. * See SP800-56A R3 5.5.2 "Assurances of Domain-Parameter Validity" Part 1b. @@ -114,5 +114,5 @@ int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx) BN_CTX_free(new_ctx); EC_POINT_free(point); return ret; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ } diff --git a/crypto/ec/ec_ctrl.c b/crypto/ec/ec_ctrl.c index 314ebe6181..9e12b9a159 100644 --- a/crypto/ec/ec_ctrl.c +++ b/crypto/ec/ec_ctrl.c @@ -463,7 +463,7 @@ int EVP_PKEY_CTX_get_ec_paramgen_curve_name(EVP_PKEY_CTX *ctx, return 1; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid) { if (ctx == NULL || !EVP_PKEY_CTX_IS_GEN_OP(ctx)) { diff --git a/crypto/ec/ec_curve.c b/crypto/ec/ec_curve.c index 86e2921718..9f929883ec 100644 --- a/crypto/ec/ec_curve.c +++ b/crypto/ec/ec_curve.c @@ -200,7 +200,7 @@ static const struct { } }; -# ifndef FIPS_MODE +# ifndef FIPS_MODULE /* the x9.62 prime curves (minus the nist prime curves) */ static const struct { EC_CURVE_DATA h; @@ -379,7 +379,7 @@ static const struct { 0x43, 0x21, 0x46, 0x52, 0x65, 0x51 } }; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ static const struct { EC_CURVE_DATA h; @@ -419,7 +419,7 @@ static const struct { } }; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* the secg prime curves (minus the nist and x9.62 prime curves) */ static const struct { EC_CURVE_DATA h; @@ -841,13 +841,13 @@ static const struct { 0x5C, 0x5C, 0x2A, 0x3D } }; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ #ifndef OPENSSL_NO_EC2M /* characteristic two curves */ -# ifndef FIPS_MODE +# ifndef FIPS_MODULE static const struct { EC_CURVE_DATA h; unsigned char data[20 + 15 * 6]; @@ -975,7 +975,7 @@ static const struct { 0x33, 0x04, 0x9B, 0xA9, 0x8F } }; -# endif /* FIPS_MODE */ +# endif /* FIPS_MODULE */ static const struct { EC_CURVE_DATA h; @@ -1007,7 +1007,7 @@ static const struct { } }; -# ifndef FIPS_MODE +# ifndef FIPS_MODULE static const struct { EC_CURVE_DATA h; unsigned char data[0 + 21 * 6]; @@ -1036,7 +1036,7 @@ static const struct { 0xAA, 0xB6, 0x89, 0xC2, 0x9C, 0xA7, 0x10, 0x27, 0x9B } }; -# endif /* FIPS_MODE */ +# endif /* FIPS_MODULE */ static const struct { EC_CURVE_DATA h; @@ -1067,7 +1067,7 @@ static const struct { } }; -# ifndef FIPS_MODE +# ifndef FIPS_MODULE static const struct { EC_CURVE_DATA h; unsigned char data[20 + 25 * 6]; @@ -1143,7 +1143,7 @@ static const struct { 0xD5 } }; -# endif /* FIPS_MODE */ +# endif /* FIPS_MODULE */ static const struct { EC_CURVE_DATA h; @@ -1219,7 +1219,7 @@ static const struct { } }; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE static const struct { EC_CURVE_DATA h; unsigned char data[0 + 30 * 6]; @@ -1255,7 +1255,7 @@ static const struct { 0x1D, 0xA8, 0x00, 0xE4, 0x78, 0xA5 } }; -# endif /* FIPS_MODE */ +# endif /* FIPS_MODULE */ static const struct { EC_CURVE_DATA h; @@ -1539,7 +1539,7 @@ static const struct { } }; -# ifndef FIPS_MODE +# ifndef FIPS_MODULE static const struct { EC_CURVE_DATA h; unsigned char data[20 + 21 * 6]; @@ -2224,7 +2224,7 @@ static const struct { 0xED, 0xF9, 0x7C, 0x44, 0xDB, 0x9F, 0x24, 0x20, 0xBA, 0xFC, 0xA7, 0x5E } }; -# endif /* FIPS_MODE */ +# endif /* FIPS_MODULE */ #endif /* OPENSSL_NO_EC2M */ /* @@ -2235,7 +2235,7 @@ static const struct { * generation mechanism is different from those defined in ANSI X9.62. */ -#ifndef FIPS_MODE +#ifndef FIPS_MODULE static const struct { EC_CURVE_DATA h; unsigned char data[0 + 20 * 6]; @@ -2775,9 +2775,9 @@ static const struct { 0x9C, 0xA9, 0x00, 0x69 } }; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ -#if !defined(OPENSSL_NO_SM2) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_SM2) && !defined(FIPS_MODULE) static const struct { EC_CURVE_DATA h; unsigned char data[0 + 32 * 6]; @@ -2824,7 +2824,7 @@ typedef struct _ec_list_element_st { const char *comment; } ec_list_element; -#ifdef FIPS_MODE +#ifdef FIPS_MODULE static const ec_list_element curve_list[] = { /* prime field curves */ /* secg curves */ @@ -3113,7 +3113,7 @@ static const ec_list_element curve_list[] = { "SM2 curve over a 256 bit prime field"}, # endif }; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ #define curve_list_length OSSL_NELEM(curve_list) @@ -3165,7 +3165,7 @@ int ec_curve_name2nid(const char *name) if ((nid = EC_curve_nist2nid(name)) != NID_undef) return nid; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* * TODO(3.0) Figure out if we can use other names than the NIST names * ("B-163", "K-163" & "P-192") in the FIPS module, or if other names @@ -3302,7 +3302,7 @@ EC_GROUP *EC_GROUP_new_by_curve_name_ex(OPENSSL_CTX *libctx, int nid) return ret; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE EC_GROUP *EC_GROUP_new_by_curve_name(int nid) { return EC_GROUP_new_by_curve_name_ex(NULL, nid); diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c index 72dd4a02cf..421e87d9ee 100644 --- a/crypto/ec/ec_key.c +++ b/crypto/ec/ec_key.c @@ -26,7 +26,7 @@ static int ecdsa_keygen_pairwise_test(EC_KEY *eckey, OSSL_CALLBACK *cb, void *cbarg); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE EC_KEY *EC_KEY_new(void) { return ec_key_new_method_int(NULL, NULL); @@ -56,7 +56,7 @@ EC_KEY *EC_KEY_new_by_curve_name_ex(OPENSSL_CTX *ctx, int nid) return ret; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE EC_KEY *EC_KEY_new_by_curve_name(int nid) { return EC_KEY_new_by_curve_name_ex(NULL, nid); @@ -79,14 +79,14 @@ void EC_KEY_free(EC_KEY *r) if (r->meth != NULL && r->meth->finish != NULL) r->meth->finish(r); -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) ENGINE_finish(r->engine); #endif if (r->group && r->group->meth->keyfinish) r->group->meth->keyfinish(r); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE CRYPTO_free_ex_data(CRYPTO_EX_INDEX_EC_KEY, r, &r->ex_data); #endif CRYPTO_THREAD_lock_free(r->lock); @@ -108,7 +108,7 @@ EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) dest->meth->finish(dest); if (dest->group && dest->group->meth->keyfinish) dest->group->meth->keyfinish(dest); -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) if (ENGINE_finish(dest->engine) == 0) return 0; dest->engine = NULL; @@ -156,14 +156,14 @@ EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) dest->conv_form = src->conv_form; dest->version = src->version; dest->flags = src->flags; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_EC_KEY, &dest->ex_data, &src->ex_data)) return NULL; #endif if (src->meth != dest->meth) { -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) if (src->engine != NULL && ENGINE_init(src->engine) == 0) return NULL; dest->engine = src->engine; @@ -312,9 +312,9 @@ int ec_generate_key(OPENSSL_CTX *libctx, EC_KEY *eckey, int pairwise_test) eckey->dirty_cnt++; -#ifdef FIPS_MODE +#ifdef FIPS_MODULE pairwise_test = 1; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ ok = 1; if (pairwise_test) { diff --git a/crypto/ec/ec_kmeth.c b/crypto/ec/ec_kmeth.c index 9ba4f0ddb6..1f30571089 100644 --- a/crypto/ec/ec_kmeth.c +++ b/crypto/ec/ec_kmeth.c @@ -65,7 +65,7 @@ int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth) if (finish != NULL) finish(key); -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) ENGINE_finish(key->engine); key->engine = NULL; #endif @@ -96,7 +96,7 @@ EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine) } ret->meth = EC_KEY_get_default_method(); -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) if (engine != NULL) { if (!ENGINE_init(engine)) { ECerr(EC_F_EC_KEY_NEW_METHOD_INT, ERR_R_ENGINE_LIB); @@ -118,7 +118,7 @@ EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine) ret->conv_form = POINT_CONVERSION_UNCOMPRESSED; /* No ex_data inside the FIPS provider */ -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_EC_KEY, ret, &ret->ex_data)) { goto err; } @@ -135,7 +135,7 @@ EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine) return NULL; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE EC_KEY *EC_KEY_new_method(ENGINE *engine) { return ec_key_new_method_int(NULL, engine); diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index 16fe437dde..589380d466 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -65,7 +65,7 @@ EC_GROUP *EC_GROUP_new_ex(OPENSSL_CTX *libctx, const EC_METHOD *meth) return NULL; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) { return EC_GROUP_new_ex(NULL, meth); @@ -597,7 +597,7 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) { int r = 0; BIGNUM *a1, *a2, *a3, *b1, *b2, *b3; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *ctx_new = NULL; #endif @@ -612,7 +612,7 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) if (a->meth->flags & EC_FLAGS_CUSTOM_CURVE) return 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) ctx_new = ctx = BN_CTX_new(); #endif @@ -628,7 +628,7 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) b3 = BN_CTX_get(ctx); if (b3 == NULL) { BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(ctx_new); #endif return -1; @@ -680,7 +680,7 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) } end: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(ctx_new); #endif return r; @@ -1047,7 +1047,7 @@ int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, { int ret = 0; size_t i = 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif @@ -1066,7 +1066,7 @@ int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, } } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) ctx = new_ctx = BN_CTX_secure_new(); #endif @@ -1081,7 +1081,7 @@ int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, /* use default */ ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -1161,7 +1161,7 @@ static int ec_precompute_mont_data(EC_GROUP *group) return ret; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg) { return CRYPTO_set_ex_data(&key->ex_data, idx, arg); @@ -1185,14 +1185,14 @@ static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r, { BIGNUM *e = NULL; int ret = 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif if (group->mont_data == NULL) return 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) ctx = new_ctx = BN_CTX_secure_new(); #endif @@ -1222,7 +1222,7 @@ static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r, err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; diff --git a/crypto/ec/ec_local.h b/crypto/ec/ec_local.h index 63e672af79..d9383f10a7 100644 --- a/crypto/ec/ec_local.h +++ b/crypto/ec/ec_local.h @@ -288,7 +288,7 @@ struct ec_key_st { point_conversion_form_t conv_form; CRYPTO_REF_COUNT references; int flags; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE CRYPTO_EX_DATA ex_data; #endif CRYPTO_RWLOCK *lock; diff --git a/crypto/ec/ec_mult.c b/crypto/ec/ec_mult.c index 385a4789bc..3372184560 100644 --- a/crypto/ec/ec_mult.c +++ b/crypto/ec/ec_mult.c @@ -833,7 +833,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) EC_POINT **points = NULL; EC_PRE_COMP *pre_comp; int ret = 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif @@ -848,7 +848,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) goto err; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) ctx = new_ctx = BN_CTX_new(); #endif @@ -965,7 +965,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif EC_ec_pre_comp_free(pre_comp); diff --git a/crypto/ec/ecp_nistp224.c b/crypto/ec/ecp_nistp224.c index f0c0ad940d..1808c4c76c 100644 --- a/crypto/ec/ecp_nistp224.c +++ b/crypto/ec/ecp_nistp224.c @@ -1299,7 +1299,7 @@ int ec_GFp_nistp224_group_set_curve(EC_GROUP *group, const BIGNUM *p, { int ret = 0; BIGNUM *curve_p, *curve_a, *curve_b; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; if (ctx == NULL) @@ -1326,7 +1326,7 @@ int ec_GFp_nistp224_group_set_curve(EC_GROUP *group, const BIGNUM *p, ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx); err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -1617,14 +1617,14 @@ int ec_GFp_nistp224_precompute_mult(EC_GROUP *group, BN_CTX *ctx) BIGNUM *x, *y; EC_POINT *generator = NULL; felem tmp_felems[32]; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif /* throw away old precomputation */ EC_pre_comp_free(group); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) ctx = new_ctx = BN_CTX_new(); #endif @@ -1738,7 +1738,7 @@ int ec_GFp_nistp224_precompute_mult(EC_GROUP *group, BN_CTX *ctx) err: BN_CTX_end(ctx); EC_POINT_free(generator); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif EC_nistp224_pre_comp_free(pre); diff --git a/crypto/ec/ecp_nistp256.c b/crypto/ec/ecp_nistp256.c index 70f5792ead..fb9b22554d 100644 --- a/crypto/ec/ecp_nistp256.c +++ b/crypto/ec/ecp_nistp256.c @@ -1912,7 +1912,7 @@ int ec_GFp_nistp256_group_set_curve(EC_GROUP *group, const BIGNUM *p, { int ret = 0; BIGNUM *curve_p, *curve_a, *curve_b; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; if (ctx == NULL) @@ -1939,7 +1939,7 @@ int ec_GFp_nistp256_group_set_curve(EC_GROUP *group, const BIGNUM *p, ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx); err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -2239,14 +2239,14 @@ int ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx) EC_POINT *generator = NULL; smallfelem tmp_smallfelems[32]; felem x_tmp, y_tmp, z_tmp; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif /* throw away old precomputation */ EC_pre_comp_free(group); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) ctx = new_ctx = BN_CTX_new(); #endif @@ -2370,7 +2370,7 @@ int ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx) err: BN_CTX_end(ctx); EC_POINT_free(generator); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif EC_nistp256_pre_comp_free(pre); diff --git a/crypto/ec/ecp_nistp521.c b/crypto/ec/ecp_nistp521.c index db99b963e6..28e048ede9 100644 --- a/crypto/ec/ecp_nistp521.c +++ b/crypto/ec/ecp_nistp521.c @@ -1752,7 +1752,7 @@ int ec_GFp_nistp521_group_set_curve(EC_GROUP *group, const BIGNUM *p, { int ret = 0; BIGNUM *curve_p, *curve_a, *curve_b; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; if (ctx == NULL) @@ -1779,7 +1779,7 @@ int ec_GFp_nistp521_group_set_curve(EC_GROUP *group, const BIGNUM *p, ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx); err: BN_CTX_end(ctx); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif return ret; @@ -2075,14 +2075,14 @@ int ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx) BIGNUM *x, *y; EC_POINT *generator = NULL; felem tmp_felems[16]; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX *new_ctx = NULL; #endif /* throw away old precomputation */ EC_pre_comp_free(group); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE if (ctx == NULL) ctx = new_ctx = BN_CTX_new(); #endif @@ -2176,7 +2176,7 @@ int ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx) err: BN_CTX_end(ctx); EC_POINT_free(generator); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE BN_CTX_free(new_ctx); #endif EC_nistp521_pre_comp_free(pre); diff --git a/crypto/ec/ecp_oct.c b/crypto/ec/ecp_oct.c index 57a196cfba..38d661e13f 100644 --- a/crypto/ec/ecp_oct.c +++ b/crypto/ec/ecp_oct.c @@ -28,7 +28,7 @@ int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, BIGNUM *tmp1, *tmp2, *x, *y; int ret = 0; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* clear error queue */ ERR_clear_error(); #endif @@ -107,7 +107,7 @@ int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, } if (!BN_mod_sqrt(y, tmp1, group->field, ctx)) { -#ifndef FIPS_MODE +#ifndef FIPS_MODULE unsigned long err = ERR_peek_last_error(); if (ERR_GET_LIB(err) == ERR_LIB_BN diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index fba5315232..91baa0d45c 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -24,7 +24,7 @@ int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) if (ctx == NULL) return 1; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* TODO(3.0): Temporarily no support for EVP_DigestSign* in FIPS module */ /* * pctx should be freed by the user of EVP_MD_CTX @@ -59,7 +59,7 @@ int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size); } -#if !defined(FIPS_MODE) && !defined(OPENSSL_NO_ENGINE) +#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_ENGINE) ENGINE_finish(ctx->engine); #endif @@ -94,7 +94,7 @@ int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) { -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) ENGINE *tmpimpl = NULL; #endif @@ -114,7 +114,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) ctx->reqdigest = type; /* TODO(3.0): Legacy work around code below. Remove this */ -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) /* * Whether it's nice or not, "Inits" can be used on "Final"'d contexts so * this context may already have an ENGINE! Try to avoid releasing the @@ -145,7 +145,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) */ if (ctx->engine != NULL || impl != NULL -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) || tmpimpl != NULL #endif || (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) != 0) { @@ -164,7 +164,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) /* TODO(3.0): Start of non-legacy code below */ if (type->prov == NULL) { -#ifdef FIPS_MODE +#ifdef FIPS_MODULE /* We only do explicit fetches inside the FIPS module */ EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_INITIALIZATION_ERROR); return 0; @@ -205,7 +205,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) /* TODO(3.0): Remove legacy code below */ legacy: -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) if (type) { if (impl != NULL) { if (!ENGINE_init(impl)) { @@ -257,10 +257,10 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) } } } -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) skip_to_init: #endif -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* * TODO(3.0): Temporarily no support for EVP_DigestSign* inside FIPS module * or when using providers. @@ -452,7 +452,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) /* copied EVP_MD_CTX should free the copied EVP_PKEY_CTX */ EVP_MD_CTX_clear_flags(out, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX); -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* TODO(3.0): Temporarily no support for EVP_DigestSign* in FIPS module */ if (in->pctx != NULL) { out->pctx = EVP_PKEY_CTX_dup(in->pctx); @@ -468,7 +468,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) /* TODO(3.0): Remove legacy code below */ legacy: -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) /* Make sure it's safe to copy a digest context using an ENGINE */ if (in->engine && !ENGINE_init(in->engine)) { EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB); @@ -509,7 +509,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) out->update = in->update; -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* TODO(3.0): Temporarily no support for EVP_DigestSign* in FIPS module */ if (in->pctx) { out->pctx = EVP_PKEY_CTX_dup(in->pctx); @@ -724,7 +724,7 @@ EVP_MD *evp_md_new(void) * provider based, we know that none of its code depends on legacy * NIDs or any functionality that use them. */ -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* TODO(3.x) get rid of the need for legacy NIDs */ static void set_legacy_nid(const char *name, void *vlegacy_nid) { @@ -764,7 +764,7 @@ static void *evp_md_from_dispatch(int name_id, return NULL; } -#ifndef FIPS_MODE +#ifndef FIPS_MODULE /* TODO(3.x) get rid of the need for legacy NIDs */ md->type = NID_undef; evp_names_do_all(prov, name_id, set_legacy_nid, &md->type); diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index 39c53b5595..05be21901d 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -71,7 +71,7 @@ typedef struct { const unsigned char iv[16]); } EVP_AES_XTS_CTX; -#ifdef FIPS_MODE +#ifdef FIPS_MODULE static const int allow_insecure_decrypt = 0; #else static const int allow_insecure_decrypt = 1; @@ -2901,7 +2901,7 @@ static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, return rv; } -#ifdef FIPS_MODE +#ifdef FIPS_MODULE /* * See SP800-38D (GCM) Section 8 "Uniqueness requirement on IVS and keys" * @@ -2923,7 +2923,7 @@ static int aes_gcm_iv_generate(EVP_AES_GCM_CTX *gctx, int offset) return 0; return 1; } -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) @@ -2937,7 +2937,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (gctx->tls_aad_len >= 0) return aes_gcm_tls_cipher(ctx, out, in, len); -#ifdef FIPS_MODE +#ifdef FIPS_MODULE /* * FIPS requires generation of AES-GCM IV's inside the FIPS module. * The IV can still be set externally (the security policy will state that @@ -2954,7 +2954,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, #else if (!gctx->iv_set) return -1; -#endif /* FIPS_MODE */ +#endif /* FIPS_MODULE */ if (in) { if (out == NULL) { diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index f6d7e87f12..0f7b0a7dde 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -51,7 +51,7 @@ int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx) OPENSSL_cleanse(ctx->cipher_data, ctx->cipher->ctx_size); } OPENSSL_free(ctx->cipher_data); -#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) +#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) ENGINE_fi