Line data Source code
1 : /**
2 : * Copyright Notice:
3 : * Copyright 2023-2025 DMTF. All rights reserved.
4 : * License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
5 : **/
6 :
7 : #include "internal/libspdm_crypt_lib.h"
8 : #include "internal/libspdm_fips_lib.h"
9 : #include "internal/libspdm_common_lib.h"
10 :
11 : #if LIBSPDM_FIPS_MODE
12 :
13 : /*run all of the self-tests and returns the results.*/
14 1 : bool libspdm_fips_run_selftest(void *fips_selftest_context)
15 : {
16 : libspdm_fips_selftest_context_t *context;
17 1 : LIBSPDM_ASSERT(fips_selftest_context != NULL);
18 :
19 1 : context = fips_selftest_context;
20 :
21 1 : libspdm_fips_selftest_hmac_sha256(context);
22 1 : libspdm_fips_selftest_hmac_sha384(context);
23 1 : libspdm_fips_selftest_hmac_sha512(context);
24 :
25 1 : libspdm_fips_selftest_aes_gcm(context);
26 :
27 1 : libspdm_fips_selftest_rsa_ssa(context);
28 1 : libspdm_fips_selftest_rsa_pss(context);
29 :
30 1 : libspdm_fips_selftest_hkdf(context);
31 :
32 1 : libspdm_fips_selftest_ecdh(context);
33 :
34 1 : libspdm_fips_selftest_sha256(context);
35 1 : libspdm_fips_selftest_sha384(context);
36 1 : libspdm_fips_selftest_sha512(context);
37 :
38 1 : libspdm_fips_selftest_sha3_256(context);
39 1 : libspdm_fips_selftest_sha3_384(context);
40 1 : libspdm_fips_selftest_sha3_512(context);
41 :
42 1 : libspdm_fips_selftest_ffdh(context);
43 :
44 1 : libspdm_fips_selftest_ecdsa(context);
45 :
46 1 : libspdm_fips_selftest_eddsa(context);
47 :
48 1 : return (context->tested_algo == context->self_test_result);
49 : }
50 :
51 : #endif/*LIBSPDM_FIPS_MODE*/
|