#include <openssl/crypto.h>
#include <stdio.h>
#include <stdlib.h>
#include <openssl/aead.h>
#include <openssl/aes.h>
#include <openssl/bn.h>
#include <openssl/ctrdrbg.h>
#include <openssl/dh.h>
#include <openssl/digest.h>
#include <openssl/ec.h>
#include <openssl/ecdsa.h>
#include <openssl/ec_key.h>
#include <openssl/hkdf.h>
#include <openssl/hmac.h>
#include <openssl/nid.h>
#include <openssl/rsa.h>
#include <openssl/sha.h>
#include "../../internal.h"
#include "../dh/internal.h"
#include "../ec/internal.h"
#include "../ecdsa/internal.h"
#include "../rand/internal.h"
#include "../rsa/internal.h"
#include "../service_indicator/internal.h"
#include "../tls/internal.h"
#if defined(_MSC_VER)
int BORINGSSL_self_test(void) {
return 0;
}
#else
static void hexdump(const uint8_t *in, size_t len) { … }
static int check_test(const void *expected, const void *actual,
size_t expected_len, const char *name) { … }
static int set_bignum(BIGNUM **out, const uint8_t *in, size_t len) { … }
static RSA *self_test_rsa_key(void) { … }
static EC_KEY *self_test_ecdsa_key(void) { … }
static DH *self_test_dh(void) { … }
static int boringssl_self_test_rsa(void) { … }
static int boringssl_self_test_ecc(void) { … }
static int boringssl_self_test_ffdh(void) { … }
#if defined(BORINGSSL_FIPS)
static void run_self_test_rsa(void) {
FIPS_service_indicator_lock_state();
if (!boringssl_self_test_rsa()) {
BORINGSSL_FIPS_abort();
}
FIPS_service_indicator_unlock_state();
}
DEFINE_STATIC_ONCE(g_self_test_once_rsa);
void boringssl_ensure_rsa_self_test(void) {
CRYPTO_once(g_self_test_once_rsa_bss_get(), run_self_test_rsa);
}
static void run_self_test_ecc(void) {
FIPS_service_indicator_lock_state();
if (!boringssl_self_test_ecc()) {
BORINGSSL_FIPS_abort();
}
FIPS_service_indicator_unlock_state();
}
DEFINE_STATIC_ONCE(g_self_test_once_ecc);
void boringssl_ensure_ecc_self_test(void) {
CRYPTO_once(g_self_test_once_ecc_bss_get(), run_self_test_ecc);
}
static void run_self_test_ffdh(void) {
FIPS_service_indicator_lock_state();
if (!boringssl_self_test_ffdh()) {
BORINGSSL_FIPS_abort();
}
FIPS_service_indicator_unlock_state();
}
DEFINE_STATIC_ONCE(g_self_test_once_ffdh);
void boringssl_ensure_ffdh_self_test(void) {
CRYPTO_once(g_self_test_once_ffdh_bss_get(), run_self_test_ffdh);
}
#endif
int boringssl_self_test_sha256(void) { … }
int boringssl_self_test_sha512(void) { … }
int boringssl_self_test_hmac_sha256(void) { … }
static int boringssl_self_test_fast(void) { … }
int BORINGSSL_self_test(void) { … }
#if defined(BORINGSSL_FIPS)
int boringssl_self_test_startup(void) {
return boringssl_self_test_fast();
}
#endif
#endif