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