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 /** X.509 Digital Certificates */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 #define NX_SECURE_SOURCE_CODE 23 24 #include "nx_secure_x509.h" 25 26 /* Bring in externs for caller checking code. */ 27 28 NX_SECURE_CALLER_CHECKING_EXTERNS 29 30 31 /**************************************************************************/ 32 /* */ 33 /* FUNCTION RELEASE */ 34 /* */ 35 /* _nxe_secure_x509_key_usage_extension_parse PORTABLE C */ 36 /* 6.1.6 */ 37 /* AUTHOR */ 38 /* */ 39 /* Timothy Stapko, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* This function checks for errors in the call to get the KeyUsage */ 44 /* extension from an X.509 certificate. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* certificate Pointer to X.509 certificate */ 49 /* bitfield keyUsage bitfield return */ 50 /* */ 51 /* OUTPUT */ 52 /* */ 53 /* status Completion status */ 54 /* */ 55 /* CALLS */ 56 /* */ 57 /* _nx_secure_x509_key_usage_extension_parse */ 58 /* Actual KeyUsage extension get */ 59 /* 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_key_usage_extension_parse(NX_SECURE_X509_CERT * certificate,USHORT * bitfield)77UINT _nxe_secure_x509_key_usage_extension_parse(NX_SECURE_X509_CERT *certificate, USHORT *bitfield) 78 { 79 UINT status; 80 81 if (certificate == NX_CRYPTO_NULL || bitfield == NX_CRYPTO_NULL) 82 { 83 #ifdef NX_CRYPTO_STANDALONE_ENABLE 84 return(NX_CRYPTO_PTR_ERROR); 85 #else 86 return(NX_PTR_ERROR); 87 #endif /* NX_CRYPTO_STANDALONE_ENABLE */ 88 } 89 90 /* Check for appropriate caller. */ 91 NX_THREADS_ONLY_CALLER_CHECKING 92 93 /* The actual call. */ 94 status = _nx_secure_x509_key_usage_extension_parse(certificate, bitfield); 95 96 return(status); 97 } 98 99