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_key_usage_extension_parse PORTABLE C */
37 /* 6.1.6 */
38 /* AUTHOR */
39 /* */
40 /* Timothy Stapko, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function checks for errors in the call to get the KeyUsage */
45 /* extension from an X.509 certificate. */
46 /* */
47 /* INPUT */
48 /* */
49 /* certificate Pointer to X.509 certificate */
50 /* bitfield keyUsage bitfield return */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* status Completion status */
55 /* */
56 /* CALLS */
57 /* */
58 /* _nx_secure_x509_key_usage_extension_parse */
59 /* Actual KeyUsage extension get */
60 /* call */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* Application Code */
65 /* */
66 /* RELEASE HISTORY */
67 /* */
68 /* DATE NAME DESCRIPTION */
69 /* */
70 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */
71 /* 09-30-2020 Timothy Stapko Modified comment(s), */
72 /* resulting in version 6.1 */
73 /* 04-02-2021 Timothy Stapko Modified comment(s), */
74 /* removed dependency on TLS, */
75 /* resulting in version 6.1.6 */
76 /* */
77 /**************************************************************************/
_nxe_secure_x509_key_usage_extension_parse(NX_SECURE_X509_CERT * certificate,USHORT * bitfield)78 UINT _nxe_secure_x509_key_usage_extension_parse(NX_SECURE_X509_CERT *certificate, USHORT *bitfield)
79 {
80 UINT status;
81
82 if (certificate == NX_CRYPTO_NULL || bitfield == 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 /* The actual call. */
95 status = _nx_secure_x509_key_usage_extension_parse(certificate, bitfield);
96
97 return(status);
98 }
99
100