Changeset View
Changeset View
Standalone View
Standalone View
crypto/rsa/rsa_sp800_56b_gen.c
/* | /* | ||||
* Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved. | * Copyright 2018-2023 The OpenSSL Project Authors. All Rights Reserved. | ||||
* Copyright (c) 2018-2019, Oracle and/or its affiliates. All rights reserved. | * Copyright (c) 2018-2019, Oracle and/or its affiliates. All rights reserved. | ||||
* | * | ||||
* Licensed under the Apache License 2.0 (the "License"). You may not use | * Licensed under the Apache License 2.0 (the "License"). You may not use | ||||
Context not available. | |||||
BN_CTX *ctx = NULL; | BN_CTX *ctx = NULL; | ||||
BIGNUM *e = NULL; | BIGNUM *e = NULL; | ||||
RSA_ACVP_TEST *info = NULL; | RSA_ACVP_TEST *info = NULL; | ||||
BIGNUM *tmp; | |||||
#if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS) | #if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS) | ||||
info = rsa->acvp_test; | info = rsa->acvp_test; | ||||
Context not available. | |||||
/* (Step 2) Generate prime factors */ | /* (Step 2) Generate prime factors */ | ||||
if (!ossl_rsa_fips186_4_gen_prob_primes(rsa, info, nbits, e, ctx, cb)) | if (!ossl_rsa_fips186_4_gen_prob_primes(rsa, info, nbits, e, ctx, cb)) | ||||
goto err; | goto err; | ||||
/* p>q check and skipping in case of acvp test */ | |||||
if (info == NULL && BN_cmp(rsa->p, rsa->q) < 0) { | |||||
tmp = rsa->p; | |||||
rsa->p = rsa->q; | |||||
rsa->q = tmp; | |||||
} | |||||
/* (Steps 3-5) Compute params d, n, dP, dQ, qInv */ | /* (Steps 3-5) Compute params d, n, dP, dQ, qInv */ | ||||
ok = ossl_rsa_sp800_56b_derive_params_from_pq(rsa, nbits, e, ctx); | ok = ossl_rsa_sp800_56b_derive_params_from_pq(rsa, nbits, e, ctx); | ||||
if (ok < 0) | if (ok < 0) | ||||
Context not available. |