1 /*
2  * Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 #include <openssl/core_names.h>
11 #include "crypto/rsa.h"
12 
13 /*
14  * The following tables are constants used during RSA parameter building
15  * operations. It is easier to point to one of these fixed strings than have
16  * to dynamically add and generate the names on the fly.
17  */
18 
19 /*
20  * A fixed table of names for the RSA prime factors starting with
21  * P,Q and up to 8 additional primes.
22  */
23 const char *ossl_rsa_mp_factor_names[] = {
24     OSSL_PKEY_PARAM_RSA_FACTOR1,
25     OSSL_PKEY_PARAM_RSA_FACTOR2,
26 #ifndef FIPS_MODULE
27     OSSL_PKEY_PARAM_RSA_FACTOR3,
28     OSSL_PKEY_PARAM_RSA_FACTOR4,
29     OSSL_PKEY_PARAM_RSA_FACTOR5,
30     OSSL_PKEY_PARAM_RSA_FACTOR6,
31     OSSL_PKEY_PARAM_RSA_FACTOR7,
32     OSSL_PKEY_PARAM_RSA_FACTOR8,
33     OSSL_PKEY_PARAM_RSA_FACTOR9,
34     OSSL_PKEY_PARAM_RSA_FACTOR10,
35 #endif
36     NULL
37 };
38 
39 /*
40  * A fixed table of names for the RSA exponents starting with
41  * DP,DQ and up to 8 additional exponents.
42  */
43 const char *ossl_rsa_mp_exp_names[] = {
44     OSSL_PKEY_PARAM_RSA_EXPONENT1,
45     OSSL_PKEY_PARAM_RSA_EXPONENT2,
46 #ifndef FIPS_MODULE
47     OSSL_PKEY_PARAM_RSA_EXPONENT3,
48     OSSL_PKEY_PARAM_RSA_EXPONENT4,
49     OSSL_PKEY_PARAM_RSA_EXPONENT5,
50     OSSL_PKEY_PARAM_RSA_EXPONENT6,
51     OSSL_PKEY_PARAM_RSA_EXPONENT7,
52     OSSL_PKEY_PARAM_RSA_EXPONENT8,
53     OSSL_PKEY_PARAM_RSA_EXPONENT9,
54     OSSL_PKEY_PARAM_RSA_EXPONENT10,
55 #endif
56     NULL
57 };
58 
59 /*
60  * A fixed table of names for the RSA coefficients starting with
61  * QINV and up to 8 additional exponents.
62  */
63 const char *ossl_rsa_mp_coeff_names[] = {
64     OSSL_PKEY_PARAM_RSA_COEFFICIENT1,
65 #ifndef FIPS_MODULE
66     OSSL_PKEY_PARAM_RSA_COEFFICIENT2,
67     OSSL_PKEY_PARAM_RSA_COEFFICIENT3,
68     OSSL_PKEY_PARAM_RSA_COEFFICIENT4,
69     OSSL_PKEY_PARAM_RSA_COEFFICIENT5,
70     OSSL_PKEY_PARAM_RSA_COEFFICIENT6,
71     OSSL_PKEY_PARAM_RSA_COEFFICIENT7,
72     OSSL_PKEY_PARAM_RSA_COEFFICIENT8,
73     OSSL_PKEY_PARAM_RSA_COEFFICIENT9,
74 #endif
75     NULL
76 };
77