rsa_mp_names.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #include <openssl/core_names.h>
  10. #include "crypto/rsa.h"
  11. /*
  12. * The following tables are constants used during RSA parameter building
  13. * operations. It is easier to point to one of these fixed strings than have
  14. * to dynamically add and generate the names on the fly.
  15. */
  16. /*
  17. * A fixed table of names for the RSA prime factors starting with
  18. * P,Q and up to 8 additional primes.
  19. */
  20. const char *rsa_mp_factor_names[] = {
  21. OSSL_PKEY_PARAM_RSA_FACTOR1,
  22. OSSL_PKEY_PARAM_RSA_FACTOR2,
  23. #ifndef FIPS_MODULE
  24. OSSL_PKEY_PARAM_RSA_FACTOR3,
  25. OSSL_PKEY_PARAM_RSA_FACTOR4,
  26. OSSL_PKEY_PARAM_RSA_FACTOR5,
  27. OSSL_PKEY_PARAM_RSA_FACTOR6,
  28. OSSL_PKEY_PARAM_RSA_FACTOR7,
  29. OSSL_PKEY_PARAM_RSA_FACTOR8,
  30. OSSL_PKEY_PARAM_RSA_FACTOR9,
  31. OSSL_PKEY_PARAM_RSA_FACTOR10,
  32. #endif
  33. NULL
  34. };
  35. /*
  36. * A fixed table of names for the RSA exponents starting with
  37. * DP,DQ and up to 8 additional exponents.
  38. */
  39. const char *rsa_mp_exp_names[] = {
  40. OSSL_PKEY_PARAM_RSA_EXPONENT1,
  41. OSSL_PKEY_PARAM_RSA_EXPONENT2,
  42. #ifndef FIPS_MODULE
  43. OSSL_PKEY_PARAM_RSA_EXPONENT3,
  44. OSSL_PKEY_PARAM_RSA_EXPONENT4,
  45. OSSL_PKEY_PARAM_RSA_EXPONENT5,
  46. OSSL_PKEY_PARAM_RSA_EXPONENT6,
  47. OSSL_PKEY_PARAM_RSA_EXPONENT7,
  48. OSSL_PKEY_PARAM_RSA_EXPONENT8,
  49. OSSL_PKEY_PARAM_RSA_EXPONENT9,
  50. OSSL_PKEY_PARAM_RSA_EXPONENT10,
  51. #endif
  52. NULL
  53. };
  54. /*
  55. * A fixed table of names for the RSA coefficients starting with
  56. * QINV and up to 8 additional exponents.
  57. */
  58. const char *rsa_mp_coeff_names[] = {
  59. OSSL_PKEY_PARAM_RSA_COEFFICIENT1,
  60. OSSL_PKEY_PARAM_RSA_COEFFICIENT2,
  61. #ifndef FIPS_MODULE
  62. OSSL_PKEY_PARAM_RSA_COEFFICIENT3,
  63. OSSL_PKEY_PARAM_RSA_COEFFICIENT4,
  64. OSSL_PKEY_PARAM_RSA_COEFFICIENT5,
  65. OSSL_PKEY_PARAM_RSA_COEFFICIENT6,
  66. OSSL_PKEY_PARAM_RSA_COEFFICIENT7,
  67. OSSL_PKEY_PARAM_RSA_COEFFICIENT8,
  68. OSSL_PKEY_PARAM_RSA_COEFFICIENT9,
  69. #endif
  70. NULL
  71. };