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 /** X.509 Digital Certificates */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define NX_SECURE_SOURCE_CODE
24
25 #include "nx_secure_x509.h"
26
27 /* Bring in externs for caller checking code. */
28
29 NX_SECURE_CALLER_CHECKING_EXTERNS
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _nxe_secure_x509_extension_find PORTABLE C */
37 /* 6.1.6 */
38 /* AUTHOR */
39 /* */
40 /* Timothy Stapko, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function checks for errors when attempting to parse through an */
45 /* X.509 certificate for a specific extension. */
46 /* */
47 /* INPUT */
48 /* */
49 /* certificate Certificate to search */
50 /* extension Return instruction data */
51 /* extension_id Extension to search for */
52 /* */
53 /* OUTPUT */
54 /* */
55 /* status Completion status */
56 /* */
57 /* CALLS */
58 /* */
59 /* _nx_secure_x509_extension_find Actual extensions find call */
60 /* */
61 /* CALLED BY */
62 /* */
63 /* Application code */
64 /* */
65 /* RELEASE HISTORY */
66 /* */
67 /* DATE NAME DESCRIPTION */
68 /* */
69 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */
70 /* 09-30-2020 Timothy Stapko Modified comment(s), */
71 /* resulting in version 6.1 */
72 /* 04-02-2021 Timothy Stapko Modified comment(s), */
73 /* removed dependency on TLS, */
74 /* resulting in version 6.1.6 */
75 /* */
76 /**************************************************************************/
_nxe_secure_x509_extension_find(NX_SECURE_X509_CERT * certificate,NX_SECURE_X509_EXTENSION * extension,USHORT extension_id)77 UINT _nxe_secure_x509_extension_find(NX_SECURE_X509_CERT *certificate,
78 NX_SECURE_X509_EXTENSION *extension, USHORT extension_id)
79 {
80 UINT status;
81
82 if (certificate == NX_CRYPTO_NULL || extension == NX_CRYPTO_NULL)
83 {
84 #ifdef NX_CRYPTO_STANDALONE_ENABLE
85 return(NX_CRYPTO_PTR_ERROR);
86 #else
87 return(NX_PTR_ERROR);
88 #endif /* NX_CRYPTO_STANDALONE_ENABLE */
89 }
90
91 /* Check for appropriate caller. */
92 NX_THREADS_ONLY_CALLER_CHECKING
93
94 status = _nx_secure_x509_extension_find(certificate, extension, extension_id);
95
96 return(status);
97 }
98
99