securitycheck_default.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 "internal/deprecated.h"
  10. #include <openssl/rsa.h>
  11. #include <openssl/core.h>
  12. #include <openssl/core_names.h>
  13. #include <openssl/obj_mac.h>
  14. #include "prov/securitycheck.h"
  15. #include "internal/nelem.h"
  16. /* Disable the security checks in the default provider */
  17. int securitycheck_enabled(void)
  18. {
  19. return 0;
  20. }
  21. int digest_rsa_sign_get_md_nid(const EVP_MD *md, ossl_unused int sha1_allowed)
  22. {
  23. int mdnid;
  24. static const OSSL_ITEM name_to_nid[] = {
  25. { NID_md5, OSSL_DIGEST_NAME_MD5 },
  26. { NID_md5_sha1, OSSL_DIGEST_NAME_MD5_SHA1 },
  27. { NID_md2, OSSL_DIGEST_NAME_MD2 },
  28. { NID_md4, OSSL_DIGEST_NAME_MD4 },
  29. { NID_mdc2, OSSL_DIGEST_NAME_MDC2 },
  30. { NID_ripemd160, OSSL_DIGEST_NAME_RIPEMD160 },
  31. };
  32. mdnid = digest_get_approved_nid_with_sha1(md, 1);
  33. if (mdnid == NID_undef)
  34. mdnid = digest_md_to_nid(md, name_to_nid, OSSL_NELEM(name_to_nid));
  35. return mdnid;
  36. }