2020-09-04 15:55:28 +08:00
|
|
|
/*
|
2021-02-18 22:57:13 +08:00
|
|
|
* Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
|
2020-09-04 15:55:28 +08:00
|
|
|
*
|
|
|
|
* 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 "internal/deprecated.h"
|
|
|
|
|
|
|
|
#include <openssl/rsa.h>
|
|
|
|
#include <openssl/dsa.h>
|
|
|
|
#include <openssl/dh.h>
|
|
|
|
#include <openssl/ec.h>
|
|
|
|
#include <openssl/err.h>
|
2021-02-06 00:40:42 +08:00
|
|
|
#include <openssl/proverr.h>
|
2020-09-04 15:55:28 +08:00
|
|
|
#include <openssl/core_names.h>
|
|
|
|
#include <openssl/obj_mac.h>
|
|
|
|
#include "prov/securitycheck.h"
|
|
|
|
|
2021-04-10 00:26:34 +08:00
|
|
|
int FIPS_security_check_enabled(OSSL_LIB_CTX *libctx);
|
2020-09-05 11:08:27 +08:00
|
|
|
|
2021-04-10 00:26:34 +08:00
|
|
|
int ossl_securitycheck_enabled(OSSL_LIB_CTX *libctx)
|
2020-09-04 15:55:28 +08:00
|
|
|
{
|
|
|
|
#if !defined(OPENSSL_NO_FIPS_SECURITYCHECKS)
|
2021-04-10 00:26:34 +08:00
|
|
|
return FIPS_security_check_enabled(libctx);
|
2020-09-04 15:55:28 +08:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif /* OPENSSL_NO_FIPS_SECURITYCHECKS */
|
|
|
|
}
|
|
|
|
|
2021-04-10 00:26:34 +08:00
|
|
|
int ossl_digest_rsa_sign_get_md_nid(OSSL_LIB_CTX *ctx, const EVP_MD *md,
|
|
|
|
int sha1_allowed)
|
2020-09-04 15:55:28 +08:00
|
|
|
{
|
|
|
|
#if !defined(OPENSSL_NO_FIPS_SECURITYCHECKS)
|
2021-04-10 00:26:34 +08:00
|
|
|
if (ossl_securitycheck_enabled(ctx))
|
|
|
|
return ossl_digest_get_approved_nid_with_sha1(ctx, md, sha1_allowed);
|
2020-09-04 15:55:28 +08:00
|
|
|
#endif /* OPENSSL_NO_FIPS_SECURITYCHECKS */
|
2021-02-17 18:01:34 +08:00
|
|
|
return ossl_digest_get_approved_nid(md);
|
2020-09-04 15:55:28 +08:00
|
|
|
}
|