1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** NetX Secure Component                                                 */
16 /**                                                                       */
17 /**    Transport Layer Security (TLS)                                     */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  COMPONENT DEFINITION                                   RELEASE        */
26 /*                                                                        */
27 /*    nx_secure_crypto_table_self_test.h                  PORTABLE C      */
28 /*                                                           6.1          */
29 /*  AUTHOR                                                                */
30 /*                                                                        */
31 /*    Timothy Stapko, Microsoft Corporation                               */
32 /*                                                                        */
33 /*  DESCRIPTION                                                           */
34 /*                                                                        */
35 /*    This file defines all services for module self-test.                */
36 /*                                                                        */
37 /*  RELEASE HISTORY                                                       */
38 /*                                                                        */
39 /*    DATE              NAME                      DESCRIPTION             */
40 /*                                                                        */
41 /*  05-19-2020     Timothy Stapko           Initial Version 6.0           */
42 /*  09-30-2020     Timothy Stapko           Modified comment(s),          */
43 /*                                            resulting in version 6.1    */
44 /*                                                                        */
45 /**************************************************************************/
46 
47 #ifndef NX_SECURE_CRYPTO_TABLE_SELF_TEST_H
48 #define NX_SECURE_CRYPTO_TABLE_SELF_TEST_H
49 
50 /* Determine if a C++ compiler is being used.  If so, ensure that standard
51    C is used to process the API information.  */
52 #ifdef __cplusplus
53 
54 /* Yes, C++ compiler is present.  Use standard C.  */
55 extern   "C" {
56 
57 #endif
58 
59 #include "nx_secure_tls.h"
60 
61 UINT _nx_secure_crypto_table_self_test(const NX_SECURE_TLS_CRYPTO *crypto_table,
62                                        VOID *metadata, UINT metadata_size);
63 
64 #ifdef NX_SECURE_POWER_ON_SELF_TEST_MODULE_INTEGRITY_CHECK
65 /* This structure is used for self test function lookup table. */
66 typedef struct NX_SECURE_CRYPTO_SELF_TEST_STRUCT
67 {
68 
69     /* Algorithm ID. */
70     UINT nx_crypto_algorithm;
71 
72     /* Function pointer to the self test function for the corresponding algorithm. */
73     UINT (*self_test_function)(NX_CRYPTO_METHOD *crypto_method, VOID *metadata, UINT metadata_size);
74 
75 } NX_SECURE_CRYPTO_SELF_TEST;
76 
77 UINT _nx_secure_crypto_method_self_test_aes(NX_CRYPTO_METHOD *crypto_method_aes,
78                                             VOID *metadata, UINT metadata_size);
79 UINT _nx_secure_crypto_method_self_test_des(NX_CRYPTO_METHOD *crypto_method_des,
80                                             VOID *metadata, UINT metadata_size);
81 UINT _nx_secure_crypto_method_self_test_3des(NX_CRYPTO_METHOD *crypto_method_3des,
82                                              VOID *metadata, UINT metadata_size);
83 UINT _nx_secure_crypto_method_self_test_sha(NX_CRYPTO_METHOD *crypto_method_sha,
84                                             VOID *metadata, UINT metadata_size);
85 UINT _nx_secure_crypto_method_self_test_md5(NX_CRYPTO_METHOD *crypto_method_md5,
86                                             VOID *metadata, UINT metadata_size);
87 UINT _nx_secure_crypto_method_self_test_rsa(NX_CRYPTO_METHOD *crypto_method,
88                                             VOID *metadata, UINT metadata_size);
89 UINT _nx_secure_crypto_method_self_test_hmac_sha(NX_CRYPTO_METHOD *crypto_method_hmac_sha,
90                                                  VOID *metadata, UINT metadata_size);
91 UINT _nx_secure_crypto_method_self_test_hmac_md5(NX_CRYPTO_METHOD *crypto_method_hmac_md5,
92                                                  VOID *metadata, UINT metadata_size);
93 UINT _nx_secure_crypto_method_self_test_prf(NX_CRYPTO_METHOD *crypto_method_prf,
94                                             VOID *metadata, UINT metadata_size);
95 #endif
96 #endif /* NX_SECURE_CRYPTO_TABLE_SELF_TEST_H */
97 
98