2020-04-01 13:51:18 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <openssl/core_names.h>
|
|
|
|
#include "crypto/rsa.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following tables are constants used during RSA parameter building
|
|
|
|
* operations. It is easier to point to one of these fixed strings than have
|
|
|
|
* to dynamically add and generate the names on the fly.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A fixed table of names for the RSA prime factors starting with
|
|
|
|
* P,Q and up to 8 additional primes.
|
|
|
|
*/
|
rsa: add ossl_ prefix to internal rsa_ calls.
The functions being:
rsa_check_crt_components, rsa_check_key, rsa_check_pminusq_diff,
rsa_check_prime_factor, rsa_check_prime_factor_range,
rsa_check_private_exponent, rsa_check_public_exponent,
rsa_digestinfo_encoding, rsa_fips186_4_gen_prob_primes, rsa_fromdata,
rsa_get0_all_params, rsa_get0_libctx, rsa_get0_pss_params_30,
rsa_get_lcm, rsa_mgf_nid2name, rsa_mp_coeff_names, rsa_mp_exp_names,
rsa_mp_factor_names, rsa_new_with_ctx, rsa_oaeppss_md2nid,
rsa_oaeppss_nid2name, rsa_padding_add_PKCS1_OAEP_mgf1_with_libctx,
rsa_padding_add_PKCS1_type_2_with_libctx,
rsa_padding_add_SSLv23_with_libctx, rsa_padding_check_PKCS1_type_2_TLS,
rsa_pkey_method, rsa_pss_params_30_copy, rsa_pss_params_30_fromdata,
rsa_pss_params_30_hashalg, rsa_pss_params_30_is_unrestricted,
rsa_pss_params_30_maskgenalg, rsa_pss_params_30_maskgenhashalg,
rsa_pss_params_30_saltlen, rsa_pss_params_30_set_defaults,
rsa_pss_params_30_set_hashalg, rsa_pss_params_30_set_maskgenalg,
rsa_pss_params_30_set_maskgenhashalg, rsa_pss_params_30_set_saltlen,
rsa_pss_params_30_set_trailerfield, rsa_pss_params_30_todata,
rsa_pss_params_30_trailerfield, rsa_pss_pkey_method, rsa_set0_all_params,
rsa_sp800_56b_check_keypair, rsa_sp800_56b_check_private,
rsa_sp800_56b_check_public, rsa_sp800_56b_derive_params_from_pq,
rsa_sp800_56b_generate_key, rsa_sp800_56b_pairwise_test,
rsa_sp800_56b_validate_strength, rsa_todata, rsa_validate_pairwise,
rsa_validate_private and rsa_validate_public.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13040)
2020-09-30 12:20:14 +08:00
|
|
|
const char *ossl_rsa_mp_factor_names[] = {
|
2020-04-01 13:51:18 +08:00
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR1,
|
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR2,
|
2020-04-14 04:34:56 +08:00
|
|
|
#ifndef FIPS_MODULE
|
2020-04-01 13:51:18 +08:00
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR3,
|
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR4,
|
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR5,
|
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR6,
|
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR7,
|
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR8,
|
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR9,
|
|
|
|
OSSL_PKEY_PARAM_RSA_FACTOR10,
|
|
|
|
#endif
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A fixed table of names for the RSA exponents starting with
|
|
|
|
* DP,DQ and up to 8 additional exponents.
|
|
|
|
*/
|
rsa: add ossl_ prefix to internal rsa_ calls.
The functions being:
rsa_check_crt_components, rsa_check_key, rsa_check_pminusq_diff,
rsa_check_prime_factor, rsa_check_prime_factor_range,
rsa_check_private_exponent, rsa_check_public_exponent,
rsa_digestinfo_encoding, rsa_fips186_4_gen_prob_primes, rsa_fromdata,
rsa_get0_all_params, rsa_get0_libctx, rsa_get0_pss_params_30,
rsa_get_lcm, rsa_mgf_nid2name, rsa_mp_coeff_names, rsa_mp_exp_names,
rsa_mp_factor_names, rsa_new_with_ctx, rsa_oaeppss_md2nid,
rsa_oaeppss_nid2name, rsa_padding_add_PKCS1_OAEP_mgf1_with_libctx,
rsa_padding_add_PKCS1_type_2_with_libctx,
rsa_padding_add_SSLv23_with_libctx, rsa_padding_check_PKCS1_type_2_TLS,
rsa_pkey_method, rsa_pss_params_30_copy, rsa_pss_params_30_fromdata,
rsa_pss_params_30_hashalg, rsa_pss_params_30_is_unrestricted,
rsa_pss_params_30_maskgenalg, rsa_pss_params_30_maskgenhashalg,
rsa_pss_params_30_saltlen, rsa_pss_params_30_set_defaults,
rsa_pss_params_30_set_hashalg, rsa_pss_params_30_set_maskgenalg,
rsa_pss_params_30_set_maskgenhashalg, rsa_pss_params_30_set_saltlen,
rsa_pss_params_30_set_trailerfield, rsa_pss_params_30_todata,
rsa_pss_params_30_trailerfield, rsa_pss_pkey_method, rsa_set0_all_params,
rsa_sp800_56b_check_keypair, rsa_sp800_56b_check_private,
rsa_sp800_56b_check_public, rsa_sp800_56b_derive_params_from_pq,
rsa_sp800_56b_generate_key, rsa_sp800_56b_pairwise_test,
rsa_sp800_56b_validate_strength, rsa_todata, rsa_validate_pairwise,
rsa_validate_private and rsa_validate_public.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13040)
2020-09-30 12:20:14 +08:00
|
|
|
const char *ossl_rsa_mp_exp_names[] = {
|
2020-04-01 13:51:18 +08:00
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT1,
|
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT2,
|
2020-04-14 04:34:56 +08:00
|
|
|
#ifndef FIPS_MODULE
|
2020-04-01 13:51:18 +08:00
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT3,
|
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT4,
|
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT5,
|
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT6,
|
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT7,
|
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT8,
|
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT9,
|
|
|
|
OSSL_PKEY_PARAM_RSA_EXPONENT10,
|
|
|
|
#endif
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A fixed table of names for the RSA coefficients starting with
|
|
|
|
* QINV and up to 8 additional exponents.
|
|
|
|
*/
|
rsa: add ossl_ prefix to internal rsa_ calls.
The functions being:
rsa_check_crt_components, rsa_check_key, rsa_check_pminusq_diff,
rsa_check_prime_factor, rsa_check_prime_factor_range,
rsa_check_private_exponent, rsa_check_public_exponent,
rsa_digestinfo_encoding, rsa_fips186_4_gen_prob_primes, rsa_fromdata,
rsa_get0_all_params, rsa_get0_libctx, rsa_get0_pss_params_30,
rsa_get_lcm, rsa_mgf_nid2name, rsa_mp_coeff_names, rsa_mp_exp_names,
rsa_mp_factor_names, rsa_new_with_ctx, rsa_oaeppss_md2nid,
rsa_oaeppss_nid2name, rsa_padding_add_PKCS1_OAEP_mgf1_with_libctx,
rsa_padding_add_PKCS1_type_2_with_libctx,
rsa_padding_add_SSLv23_with_libctx, rsa_padding_check_PKCS1_type_2_TLS,
rsa_pkey_method, rsa_pss_params_30_copy, rsa_pss_params_30_fromdata,
rsa_pss_params_30_hashalg, rsa_pss_params_30_is_unrestricted,
rsa_pss_params_30_maskgenalg, rsa_pss_params_30_maskgenhashalg,
rsa_pss_params_30_saltlen, rsa_pss_params_30_set_defaults,
rsa_pss_params_30_set_hashalg, rsa_pss_params_30_set_maskgenalg,
rsa_pss_params_30_set_maskgenhashalg, rsa_pss_params_30_set_saltlen,
rsa_pss_params_30_set_trailerfield, rsa_pss_params_30_todata,
rsa_pss_params_30_trailerfield, rsa_pss_pkey_method, rsa_set0_all_params,
rsa_sp800_56b_check_keypair, rsa_sp800_56b_check_private,
rsa_sp800_56b_check_public, rsa_sp800_56b_derive_params_from_pq,
rsa_sp800_56b_generate_key, rsa_sp800_56b_pairwise_test,
rsa_sp800_56b_validate_strength, rsa_todata, rsa_validate_pairwise,
rsa_validate_private and rsa_validate_public.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13040)
2020-09-30 12:20:14 +08:00
|
|
|
const char *ossl_rsa_mp_coeff_names[] = {
|
2020-04-01 13:51:18 +08:00
|
|
|
OSSL_PKEY_PARAM_RSA_COEFFICIENT1,
|
2020-04-14 04:34:56 +08:00
|
|
|
#ifndef FIPS_MODULE
|
2020-09-28 05:46:29 +08:00
|
|
|
OSSL_PKEY_PARAM_RSA_COEFFICIENT2,
|
2020-04-01 13:51:18 +08:00
|
|
|
OSSL_PKEY_PARAM_RSA_COEFFICIENT3,
|
|
|
|
OSSL_PKEY_PARAM_RSA_COEFFICIENT4,
|
|
|
|
OSSL_PKEY_PARAM_RSA_COEFFICIENT5,
|
|
|
|
OSSL_PKEY_PARAM_RSA_COEFFICIENT6,
|
|
|
|
OSSL_PKEY_PARAM_RSA_COEFFICIENT7,
|
|
|
|
OSSL_PKEY_PARAM_RSA_COEFFICIENT8,
|
|
|
|
OSSL_PKEY_PARAM_RSA_COEFFICIENT9,
|
|
|
|
#endif
|
|
|
|
NULL
|
|
|
|
};
|