fips.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* ====================================================================
  2. * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. *
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in
  13. * the documentation and/or other materials provided with the
  14. * distribution.
  15. *
  16. * 3. All advertising materials mentioning features or use of this
  17. * software must display the following acknowledgment:
  18. * "This product includes software developed by the OpenSSL Project
  19. * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
  20. *
  21. * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  22. * endorse or promote products derived from this software without
  23. * prior written permission. For written permission, please contact
  24. * openssl-core@openssl.org.
  25. *
  26. * 5. Products derived from this software may not be called "OpenSSL"
  27. * nor may "OpenSSL" appear in their names without prior written
  28. * permission of the OpenSSL Project.
  29. *
  30. * 6. Redistributions of any form whatsoever must retain the following
  31. * acknowledgment:
  32. * "This product includes software developed by the OpenSSL Project
  33. * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
  34. *
  35. * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  36. * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  37. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  38. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  39. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  41. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  42. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  43. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  44. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  45. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  46. * OF THE POSSIBILITY OF SUCH DAMAGE.
  47. *
  48. */
  49. #include <openssl/opensslconf.h>
  50. #ifdef OPENSSL_FIPS
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54. struct dsa_st;
  55. struct evp_pkey_st;
  56. struct env_md_st;
  57. struct evp_cipher_st;
  58. struct evp_cipher_ctx_st;
  59. int FIPS_mode_set(int onoff);
  60. int FIPS_mode(void);
  61. const void *FIPS_rand_check(void);
  62. int FIPS_selftest_failed(void);
  63. void FIPS_selftest_check(void);
  64. void FIPS_corrupt_sha1(void);
  65. int FIPS_selftest_sha1(void);
  66. void FIPS_corrupt_aes(void);
  67. int FIPS_selftest_aes(void);
  68. void FIPS_corrupt_des(void);
  69. int FIPS_selftest_des(void);
  70. void FIPS_corrupt_rsa(void);
  71. void FIPS_corrupt_rsa_keygen(void);
  72. int FIPS_selftest_rsa(void);
  73. void FIPS_corrupt_dsa(void);
  74. void FIPS_corrupt_dsa_keygen(void);
  75. int FIPS_selftest_dsa(void);
  76. void FIPS_corrupt_rng(void);
  77. void FIPS_rng_stick(void);
  78. int FIPS_selftest_rng(void);
  79. int FIPS_selftest_hmac(void);
  80. int fips_pkey_signature_test(struct evp_pkey_st *pkey,
  81. const unsigned char *tbs, int tbslen,
  82. const unsigned char *kat, unsigned int katlen,
  83. const struct env_md_st *digest, unsigned int md_flags,
  84. const char *fail_str);
  85. int fips_cipher_test(struct evp_cipher_ctx_st *ctx,
  86. const struct evp_cipher_st *cipher,
  87. const unsigned char *key,
  88. const unsigned char *iv,
  89. const unsigned char *plaintext,
  90. const unsigned char *ciphertext,
  91. int len);
  92. /* BEGIN ERROR CODES */
  93. /* The following lines are auto generated by the script mkerr.pl. Any changes
  94. * made after this point may be overwritten when the script is next run.
  95. */
  96. void ERR_load_FIPS_strings(void);
  97. /* Error codes for the FIPS functions. */
  98. /* Function codes. */
  99. #define FIPS_F_DH_BUILTIN_GENPARAMS 100
  100. #define FIPS_F_DSA_BUILTIN_PARAMGEN 101
  101. #define FIPS_F_DSA_DO_SIGN 102
  102. #define FIPS_F_DSA_DO_VERIFY 103
  103. #define FIPS_F_EVP_CIPHERINIT_EX 124
  104. #define FIPS_F_EVP_DIGESTINIT_EX 125
  105. #define FIPS_F_FIPS_CHECK_DSA 104
  106. #define FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT 105
  107. #define FIPS_F_FIPS_CHECK_RSA 106
  108. #define FIPS_F_FIPS_DSA_CHECK 107
  109. #define FIPS_F_FIPS_MODE_SET 108
  110. #define FIPS_F_FIPS_PKEY_SIGNATURE_TEST 109
  111. #define FIPS_F_FIPS_SELFTEST_AES 110
  112. #define FIPS_F_FIPS_SELFTEST_DES 111
  113. #define FIPS_F_FIPS_SELFTEST_DSA 112
  114. #define FIPS_F_FIPS_SELFTEST_HMAC 113
  115. #define FIPS_F_FIPS_SELFTEST_RNG 114
  116. #define FIPS_F_FIPS_SELFTEST_SHA1 115
  117. #define FIPS_F_HASH_FINAL 123
  118. #define FIPS_F_RSA_BUILTIN_KEYGEN 116
  119. #define FIPS_F_RSA_EAY_PRIVATE_DECRYPT 117
  120. #define FIPS_F_RSA_EAY_PRIVATE_ENCRYPT 118
  121. #define FIPS_F_RSA_EAY_PUBLIC_DECRYPT 119
  122. #define FIPS_F_RSA_EAY_PUBLIC_ENCRYPT 120
  123. #define FIPS_F_RSA_X931_GENERATE_KEY_EX 121
  124. #define FIPS_F_SSLEAY_RAND_BYTES 122
  125. /* Reason codes. */
  126. #define FIPS_R_CANNOT_READ_EXE 103
  127. #define FIPS_R_CANNOT_READ_EXE_DIGEST 104
  128. #define FIPS_R_CONTRADICTING_EVIDENCE 114
  129. #define FIPS_R_EXE_DIGEST_DOES_NOT_MATCH 105
  130. #define FIPS_R_FINGERPRINT_DOES_NOT_MATCH 110
  131. #define FIPS_R_FINGERPRINT_DOES_NOT_MATCH_NONPIC_RELOCATED 111
  132. #define FIPS_R_FINGERPRINT_DOES_NOT_MATCH_SEGMENT_ALIASING 112
  133. #define FIPS_R_FIPS_MODE_ALREADY_SET 102
  134. #define FIPS_R_FIPS_SELFTEST_FAILED 106
  135. #define FIPS_R_INVALID_KEY_LENGTH 109
  136. #define FIPS_R_KEY_TOO_SHORT 108
  137. #define FIPS_R_NON_FIPS_METHOD 100
  138. #define FIPS_R_PAIRWISE_TEST_FAILED 107
  139. #define FIPS_R_RSA_DECRYPT_ERROR 115
  140. #define FIPS_R_RSA_ENCRYPT_ERROR 116
  141. #define FIPS_R_SELFTEST_FAILED 101
  142. #define FIPS_R_TEST_FAILURE 117
  143. #define FIPS_R_UNSUPPORTED_PLATFORM 113
  144. #ifdef __cplusplus
  145. }
  146. #endif
  147. #endif