Nicolas Borla
/
BBR_1Ebene
BBR 1 Ebene
mbed-os/features/mbedtls/src/oid.c@0:fbdae7e6d805, 2018-05-14 (annotated)
- Committer:
- borlanic
- Date:
- Mon May 14 11:29:06 2018 +0000
- Revision:
- 0:fbdae7e6d805
BBR
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
borlanic | 0:fbdae7e6d805 | 1 | /** |
borlanic | 0:fbdae7e6d805 | 2 | * \file oid.c |
borlanic | 0:fbdae7e6d805 | 3 | * |
borlanic | 0:fbdae7e6d805 | 4 | * \brief Object Identifier (OID) database |
borlanic | 0:fbdae7e6d805 | 5 | * |
borlanic | 0:fbdae7e6d805 | 6 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved |
borlanic | 0:fbdae7e6d805 | 7 | * SPDX-License-Identifier: Apache-2.0 |
borlanic | 0:fbdae7e6d805 | 8 | * |
borlanic | 0:fbdae7e6d805 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
borlanic | 0:fbdae7e6d805 | 10 | * not use this file except in compliance with the License. |
borlanic | 0:fbdae7e6d805 | 11 | * You may obtain a copy of the License at |
borlanic | 0:fbdae7e6d805 | 12 | * |
borlanic | 0:fbdae7e6d805 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
borlanic | 0:fbdae7e6d805 | 14 | * |
borlanic | 0:fbdae7e6d805 | 15 | * Unless required by applicable law or agreed to in writing, software |
borlanic | 0:fbdae7e6d805 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
borlanic | 0:fbdae7e6d805 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
borlanic | 0:fbdae7e6d805 | 18 | * See the License for the specific language governing permissions and |
borlanic | 0:fbdae7e6d805 | 19 | * limitations under the License. |
borlanic | 0:fbdae7e6d805 | 20 | * |
borlanic | 0:fbdae7e6d805 | 21 | * This file is part of mbed TLS (https://tls.mbed.org) |
borlanic | 0:fbdae7e6d805 | 22 | */ |
borlanic | 0:fbdae7e6d805 | 23 | |
borlanic | 0:fbdae7e6d805 | 24 | #if !defined(MBEDTLS_CONFIG_FILE) |
borlanic | 0:fbdae7e6d805 | 25 | #include "mbedtls/config.h" |
borlanic | 0:fbdae7e6d805 | 26 | #else |
borlanic | 0:fbdae7e6d805 | 27 | #include MBEDTLS_CONFIG_FILE |
borlanic | 0:fbdae7e6d805 | 28 | #endif |
borlanic | 0:fbdae7e6d805 | 29 | |
borlanic | 0:fbdae7e6d805 | 30 | #if defined(MBEDTLS_OID_C) |
borlanic | 0:fbdae7e6d805 | 31 | |
borlanic | 0:fbdae7e6d805 | 32 | #include "mbedtls/oid.h" |
borlanic | 0:fbdae7e6d805 | 33 | #include "mbedtls/rsa.h" |
borlanic | 0:fbdae7e6d805 | 34 | |
borlanic | 0:fbdae7e6d805 | 35 | #include <stdio.h> |
borlanic | 0:fbdae7e6d805 | 36 | #include <string.h> |
borlanic | 0:fbdae7e6d805 | 37 | |
borlanic | 0:fbdae7e6d805 | 38 | #if defined(MBEDTLS_PLATFORM_C) |
borlanic | 0:fbdae7e6d805 | 39 | #include "mbedtls/platform.h" |
borlanic | 0:fbdae7e6d805 | 40 | #else |
borlanic | 0:fbdae7e6d805 | 41 | #define mbedtls_snprintf snprintf |
borlanic | 0:fbdae7e6d805 | 42 | #endif |
borlanic | 0:fbdae7e6d805 | 43 | |
borlanic | 0:fbdae7e6d805 | 44 | #if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C) |
borlanic | 0:fbdae7e6d805 | 45 | #include "mbedtls/x509.h" |
borlanic | 0:fbdae7e6d805 | 46 | #endif |
borlanic | 0:fbdae7e6d805 | 47 | |
borlanic | 0:fbdae7e6d805 | 48 | /* |
borlanic | 0:fbdae7e6d805 | 49 | * Macro to automatically add the size of #define'd OIDs |
borlanic | 0:fbdae7e6d805 | 50 | */ |
borlanic | 0:fbdae7e6d805 | 51 | #define ADD_LEN(s) s, MBEDTLS_OID_SIZE(s) |
borlanic | 0:fbdae7e6d805 | 52 | |
borlanic | 0:fbdae7e6d805 | 53 | /* |
borlanic | 0:fbdae7e6d805 | 54 | * Macro to generate an internal function for oid_XXX_from_asn1() (used by |
borlanic | 0:fbdae7e6d805 | 55 | * the other functions) |
borlanic | 0:fbdae7e6d805 | 56 | */ |
borlanic | 0:fbdae7e6d805 | 57 | #define FN_OID_TYPED_FROM_ASN1( TYPE_T, NAME, LIST ) \ |
borlanic | 0:fbdae7e6d805 | 58 | static const TYPE_T * oid_ ## NAME ## _from_asn1( const mbedtls_asn1_buf *oid ) \ |
borlanic | 0:fbdae7e6d805 | 59 | { \ |
borlanic | 0:fbdae7e6d805 | 60 | const TYPE_T *p = LIST; \ |
borlanic | 0:fbdae7e6d805 | 61 | const mbedtls_oid_descriptor_t *cur = (const mbedtls_oid_descriptor_t *) p; \ |
borlanic | 0:fbdae7e6d805 | 62 | if( p == NULL || oid == NULL ) return( NULL ); \ |
borlanic | 0:fbdae7e6d805 | 63 | while( cur->asn1 != NULL ) { \ |
borlanic | 0:fbdae7e6d805 | 64 | if( cur->asn1_len == oid->len && \ |
borlanic | 0:fbdae7e6d805 | 65 | memcmp( cur->asn1, oid->p, oid->len ) == 0 ) { \ |
borlanic | 0:fbdae7e6d805 | 66 | return( p ); \ |
borlanic | 0:fbdae7e6d805 | 67 | } \ |
borlanic | 0:fbdae7e6d805 | 68 | p++; \ |
borlanic | 0:fbdae7e6d805 | 69 | cur = (const mbedtls_oid_descriptor_t *) p; \ |
borlanic | 0:fbdae7e6d805 | 70 | } \ |
borlanic | 0:fbdae7e6d805 | 71 | return( NULL ); \ |
borlanic | 0:fbdae7e6d805 | 72 | } |
borlanic | 0:fbdae7e6d805 | 73 | |
borlanic | 0:fbdae7e6d805 | 74 | /* |
borlanic | 0:fbdae7e6d805 | 75 | * Macro to generate a function for retrieving a single attribute from the |
borlanic | 0:fbdae7e6d805 | 76 | * descriptor of an mbedtls_oid_descriptor_t wrapper. |
borlanic | 0:fbdae7e6d805 | 77 | */ |
borlanic | 0:fbdae7e6d805 | 78 | #define FN_OID_GET_DESCRIPTOR_ATTR1(FN_NAME, TYPE_T, TYPE_NAME, ATTR1_TYPE, ATTR1) \ |
borlanic | 0:fbdae7e6d805 | 79 | int FN_NAME( const mbedtls_asn1_buf *oid, ATTR1_TYPE * ATTR1 ) \ |
borlanic | 0:fbdae7e6d805 | 80 | { \ |
borlanic | 0:fbdae7e6d805 | 81 | const TYPE_T *data = oid_ ## TYPE_NAME ## _from_asn1( oid ); \ |
borlanic | 0:fbdae7e6d805 | 82 | if( data == NULL ) return( MBEDTLS_ERR_OID_NOT_FOUND ); \ |
borlanic | 0:fbdae7e6d805 | 83 | *ATTR1 = data->descriptor.ATTR1; \ |
borlanic | 0:fbdae7e6d805 | 84 | return( 0 ); \ |
borlanic | 0:fbdae7e6d805 | 85 | } |
borlanic | 0:fbdae7e6d805 | 86 | |
borlanic | 0:fbdae7e6d805 | 87 | /* |
borlanic | 0:fbdae7e6d805 | 88 | * Macro to generate a function for retrieving a single attribute from an |
borlanic | 0:fbdae7e6d805 | 89 | * mbedtls_oid_descriptor_t wrapper. |
borlanic | 0:fbdae7e6d805 | 90 | */ |
borlanic | 0:fbdae7e6d805 | 91 | #define FN_OID_GET_ATTR1(FN_NAME, TYPE_T, TYPE_NAME, ATTR1_TYPE, ATTR1) \ |
borlanic | 0:fbdae7e6d805 | 92 | int FN_NAME( const mbedtls_asn1_buf *oid, ATTR1_TYPE * ATTR1 ) \ |
borlanic | 0:fbdae7e6d805 | 93 | { \ |
borlanic | 0:fbdae7e6d805 | 94 | const TYPE_T *data = oid_ ## TYPE_NAME ## _from_asn1( oid ); \ |
borlanic | 0:fbdae7e6d805 | 95 | if( data == NULL ) return( MBEDTLS_ERR_OID_NOT_FOUND ); \ |
borlanic | 0:fbdae7e6d805 | 96 | *ATTR1 = data->ATTR1; \ |
borlanic | 0:fbdae7e6d805 | 97 | return( 0 ); \ |
borlanic | 0:fbdae7e6d805 | 98 | } |
borlanic | 0:fbdae7e6d805 | 99 | |
borlanic | 0:fbdae7e6d805 | 100 | /* |
borlanic | 0:fbdae7e6d805 | 101 | * Macro to generate a function for retrieving two attributes from an |
borlanic | 0:fbdae7e6d805 | 102 | * mbedtls_oid_descriptor_t wrapper. |
borlanic | 0:fbdae7e6d805 | 103 | */ |
borlanic | 0:fbdae7e6d805 | 104 | #define FN_OID_GET_ATTR2(FN_NAME, TYPE_T, TYPE_NAME, ATTR1_TYPE, ATTR1, \ |
borlanic | 0:fbdae7e6d805 | 105 | ATTR2_TYPE, ATTR2) \ |
borlanic | 0:fbdae7e6d805 | 106 | int FN_NAME( const mbedtls_asn1_buf *oid, ATTR1_TYPE * ATTR1, ATTR2_TYPE * ATTR2 ) \ |
borlanic | 0:fbdae7e6d805 | 107 | { \ |
borlanic | 0:fbdae7e6d805 | 108 | const TYPE_T *data = oid_ ## TYPE_NAME ## _from_asn1( oid ); \ |
borlanic | 0:fbdae7e6d805 | 109 | if( data == NULL ) return( MBEDTLS_ERR_OID_NOT_FOUND ); \ |
borlanic | 0:fbdae7e6d805 | 110 | *ATTR1 = data->ATTR1; \ |
borlanic | 0:fbdae7e6d805 | 111 | *ATTR2 = data->ATTR2; \ |
borlanic | 0:fbdae7e6d805 | 112 | return( 0 ); \ |
borlanic | 0:fbdae7e6d805 | 113 | } |
borlanic | 0:fbdae7e6d805 | 114 | |
borlanic | 0:fbdae7e6d805 | 115 | /* |
borlanic | 0:fbdae7e6d805 | 116 | * Macro to generate a function for retrieving the OID based on a single |
borlanic | 0:fbdae7e6d805 | 117 | * attribute from a mbedtls_oid_descriptor_t wrapper. |
borlanic | 0:fbdae7e6d805 | 118 | */ |
borlanic | 0:fbdae7e6d805 | 119 | #define FN_OID_GET_OID_BY_ATTR1(FN_NAME, TYPE_T, LIST, ATTR1_TYPE, ATTR1) \ |
borlanic | 0:fbdae7e6d805 | 120 | int FN_NAME( ATTR1_TYPE ATTR1, const char **oid, size_t *olen ) \ |
borlanic | 0:fbdae7e6d805 | 121 | { \ |
borlanic | 0:fbdae7e6d805 | 122 | const TYPE_T *cur = LIST; \ |
borlanic | 0:fbdae7e6d805 | 123 | while( cur->descriptor.asn1 != NULL ) { \ |
borlanic | 0:fbdae7e6d805 | 124 | if( cur->ATTR1 == ATTR1 ) { \ |
borlanic | 0:fbdae7e6d805 | 125 | *oid = cur->descriptor.asn1; \ |
borlanic | 0:fbdae7e6d805 | 126 | *olen = cur->descriptor.asn1_len; \ |
borlanic | 0:fbdae7e6d805 | 127 | return( 0 ); \ |
borlanic | 0:fbdae7e6d805 | 128 | } \ |
borlanic | 0:fbdae7e6d805 | 129 | cur++; \ |
borlanic | 0:fbdae7e6d805 | 130 | } \ |
borlanic | 0:fbdae7e6d805 | 131 | return( MBEDTLS_ERR_OID_NOT_FOUND ); \ |
borlanic | 0:fbdae7e6d805 | 132 | } |
borlanic | 0:fbdae7e6d805 | 133 | |
borlanic | 0:fbdae7e6d805 | 134 | /* |
borlanic | 0:fbdae7e6d805 | 135 | * Macro to generate a function for retrieving the OID based on two |
borlanic | 0:fbdae7e6d805 | 136 | * attributes from a mbedtls_oid_descriptor_t wrapper. |
borlanic | 0:fbdae7e6d805 | 137 | */ |
borlanic | 0:fbdae7e6d805 | 138 | #define FN_OID_GET_OID_BY_ATTR2(FN_NAME, TYPE_T, LIST, ATTR1_TYPE, ATTR1, \ |
borlanic | 0:fbdae7e6d805 | 139 | ATTR2_TYPE, ATTR2) \ |
borlanic | 0:fbdae7e6d805 | 140 | int FN_NAME( ATTR1_TYPE ATTR1, ATTR2_TYPE ATTR2, const char **oid , \ |
borlanic | 0:fbdae7e6d805 | 141 | size_t *olen ) \ |
borlanic | 0:fbdae7e6d805 | 142 | { \ |
borlanic | 0:fbdae7e6d805 | 143 | const TYPE_T *cur = LIST; \ |
borlanic | 0:fbdae7e6d805 | 144 | while( cur->descriptor.asn1 != NULL ) { \ |
borlanic | 0:fbdae7e6d805 | 145 | if( cur->ATTR1 == ATTR1 && cur->ATTR2 == ATTR2 ) { \ |
borlanic | 0:fbdae7e6d805 | 146 | *oid = cur->descriptor.asn1; \ |
borlanic | 0:fbdae7e6d805 | 147 | *olen = cur->descriptor.asn1_len; \ |
borlanic | 0:fbdae7e6d805 | 148 | return( 0 ); \ |
borlanic | 0:fbdae7e6d805 | 149 | } \ |
borlanic | 0:fbdae7e6d805 | 150 | cur++; \ |
borlanic | 0:fbdae7e6d805 | 151 | } \ |
borlanic | 0:fbdae7e6d805 | 152 | return( MBEDTLS_ERR_OID_NOT_FOUND ); \ |
borlanic | 0:fbdae7e6d805 | 153 | } |
borlanic | 0:fbdae7e6d805 | 154 | |
borlanic | 0:fbdae7e6d805 | 155 | #if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C) |
borlanic | 0:fbdae7e6d805 | 156 | /* |
borlanic | 0:fbdae7e6d805 | 157 | * For X520 attribute types |
borlanic | 0:fbdae7e6d805 | 158 | */ |
borlanic | 0:fbdae7e6d805 | 159 | typedef struct { |
borlanic | 0:fbdae7e6d805 | 160 | mbedtls_oid_descriptor_t descriptor; |
borlanic | 0:fbdae7e6d805 | 161 | const char *short_name; |
borlanic | 0:fbdae7e6d805 | 162 | } oid_x520_attr_t; |
borlanic | 0:fbdae7e6d805 | 163 | |
borlanic | 0:fbdae7e6d805 | 164 | static const oid_x520_attr_t oid_x520_attr_type[] = |
borlanic | 0:fbdae7e6d805 | 165 | { |
borlanic | 0:fbdae7e6d805 | 166 | { |
borlanic | 0:fbdae7e6d805 | 167 | { ADD_LEN( MBEDTLS_OID_AT_CN ), "id-at-commonName", "Common Name" }, |
borlanic | 0:fbdae7e6d805 | 168 | "CN", |
borlanic | 0:fbdae7e6d805 | 169 | }, |
borlanic | 0:fbdae7e6d805 | 170 | { |
borlanic | 0:fbdae7e6d805 | 171 | { ADD_LEN( MBEDTLS_OID_AT_COUNTRY ), "id-at-countryName", "Country" }, |
borlanic | 0:fbdae7e6d805 | 172 | "C", |
borlanic | 0:fbdae7e6d805 | 173 | }, |
borlanic | 0:fbdae7e6d805 | 174 | { |
borlanic | 0:fbdae7e6d805 | 175 | { ADD_LEN( MBEDTLS_OID_AT_LOCALITY ), "id-at-locality", "Locality" }, |
borlanic | 0:fbdae7e6d805 | 176 | "L", |
borlanic | 0:fbdae7e6d805 | 177 | }, |
borlanic | 0:fbdae7e6d805 | 178 | { |
borlanic | 0:fbdae7e6d805 | 179 | { ADD_LEN( MBEDTLS_OID_AT_STATE ), "id-at-state", "State" }, |
borlanic | 0:fbdae7e6d805 | 180 | "ST", |
borlanic | 0:fbdae7e6d805 | 181 | }, |
borlanic | 0:fbdae7e6d805 | 182 | { |
borlanic | 0:fbdae7e6d805 | 183 | { ADD_LEN( MBEDTLS_OID_AT_ORGANIZATION ),"id-at-organizationName", "Organization" }, |
borlanic | 0:fbdae7e6d805 | 184 | "O", |
borlanic | 0:fbdae7e6d805 | 185 | }, |
borlanic | 0:fbdae7e6d805 | 186 | { |
borlanic | 0:fbdae7e6d805 | 187 | { ADD_LEN( MBEDTLS_OID_AT_ORG_UNIT ), "id-at-organizationalUnitName", "Org Unit" }, |
borlanic | 0:fbdae7e6d805 | 188 | "OU", |
borlanic | 0:fbdae7e6d805 | 189 | }, |
borlanic | 0:fbdae7e6d805 | 190 | { |
borlanic | 0:fbdae7e6d805 | 191 | { ADD_LEN( MBEDTLS_OID_PKCS9_EMAIL ), "emailAddress", "E-mail address" }, |
borlanic | 0:fbdae7e6d805 | 192 | "emailAddress", |
borlanic | 0:fbdae7e6d805 | 193 | }, |
borlanic | 0:fbdae7e6d805 | 194 | { |
borlanic | 0:fbdae7e6d805 | 195 | { ADD_LEN( MBEDTLS_OID_AT_SERIAL_NUMBER ),"id-at-serialNumber", "Serial number" }, |
borlanic | 0:fbdae7e6d805 | 196 | "serialNumber", |
borlanic | 0:fbdae7e6d805 | 197 | }, |
borlanic | 0:fbdae7e6d805 | 198 | { |
borlanic | 0:fbdae7e6d805 | 199 | { ADD_LEN( MBEDTLS_OID_AT_POSTAL_ADDRESS ),"id-at-postalAddress", "Postal address" }, |
borlanic | 0:fbdae7e6d805 | 200 | "postalAddress", |
borlanic | 0:fbdae7e6d805 | 201 | }, |
borlanic | 0:fbdae7e6d805 | 202 | { |
borlanic | 0:fbdae7e6d805 | 203 | { ADD_LEN( MBEDTLS_OID_AT_POSTAL_CODE ), "id-at-postalCode", "Postal code" }, |
borlanic | 0:fbdae7e6d805 | 204 | "postalCode", |
borlanic | 0:fbdae7e6d805 | 205 | }, |
borlanic | 0:fbdae7e6d805 | 206 | { |
borlanic | 0:fbdae7e6d805 | 207 | { ADD_LEN( MBEDTLS_OID_AT_SUR_NAME ), "id-at-surName", "Surname" }, |
borlanic | 0:fbdae7e6d805 | 208 | "SN", |
borlanic | 0:fbdae7e6d805 | 209 | }, |
borlanic | 0:fbdae7e6d805 | 210 | { |
borlanic | 0:fbdae7e6d805 | 211 | { ADD_LEN( MBEDTLS_OID_AT_GIVEN_NAME ), "id-at-givenName", "Given name" }, |
borlanic | 0:fbdae7e6d805 | 212 | "GN", |
borlanic | 0:fbdae7e6d805 | 213 | }, |
borlanic | 0:fbdae7e6d805 | 214 | { |
borlanic | 0:fbdae7e6d805 | 215 | { ADD_LEN( MBEDTLS_OID_AT_INITIALS ), "id-at-initials", "Initials" }, |
borlanic | 0:fbdae7e6d805 | 216 | "initials", |
borlanic | 0:fbdae7e6d805 | 217 | }, |
borlanic | 0:fbdae7e6d805 | 218 | { |
borlanic | 0:fbdae7e6d805 | 219 | { ADD_LEN( MBEDTLS_OID_AT_GENERATION_QUALIFIER ), "id-at-generationQualifier", "Generation qualifier" }, |
borlanic | 0:fbdae7e6d805 | 220 | "generationQualifier", |
borlanic | 0:fbdae7e6d805 | 221 | }, |
borlanic | 0:fbdae7e6d805 | 222 | { |
borlanic | 0:fbdae7e6d805 | 223 | { ADD_LEN( MBEDTLS_OID_AT_TITLE ), "id-at-title", "Title" }, |
borlanic | 0:fbdae7e6d805 | 224 | "title", |
borlanic | 0:fbdae7e6d805 | 225 | }, |
borlanic | 0:fbdae7e6d805 | 226 | { |
borlanic | 0:fbdae7e6d805 | 227 | { ADD_LEN( MBEDTLS_OID_AT_DN_QUALIFIER ),"id-at-dnQualifier", "Distinguished Name qualifier" }, |
borlanic | 0:fbdae7e6d805 | 228 | "dnQualifier", |
borlanic | 0:fbdae7e6d805 | 229 | }, |
borlanic | 0:fbdae7e6d805 | 230 | { |
borlanic | 0:fbdae7e6d805 | 231 | { ADD_LEN( MBEDTLS_OID_AT_PSEUDONYM ), "id-at-pseudonym", "Pseudonym" }, |
borlanic | 0:fbdae7e6d805 | 232 | "pseudonym", |
borlanic | 0:fbdae7e6d805 | 233 | }, |
borlanic | 0:fbdae7e6d805 | 234 | { |
borlanic | 0:fbdae7e6d805 | 235 | { ADD_LEN( MBEDTLS_OID_DOMAIN_COMPONENT ), "id-domainComponent", "Domain component" }, |
borlanic | 0:fbdae7e6d805 | 236 | "DC", |
borlanic | 0:fbdae7e6d805 | 237 | }, |
borlanic | 0:fbdae7e6d805 | 238 | { |
borlanic | 0:fbdae7e6d805 | 239 | { ADD_LEN( MBEDTLS_OID_AT_UNIQUE_IDENTIFIER ), "id-at-uniqueIdentifier", "Unique Identifier" }, |
borlanic | 0:fbdae7e6d805 | 240 | "uniqueIdentifier", |
borlanic | 0:fbdae7e6d805 | 241 | }, |
borlanic | 0:fbdae7e6d805 | 242 | { |
borlanic | 0:fbdae7e6d805 | 243 | { NULL, 0, NULL, NULL }, |
borlanic | 0:fbdae7e6d805 | 244 | NULL, |
borlanic | 0:fbdae7e6d805 | 245 | } |
borlanic | 0:fbdae7e6d805 | 246 | }; |
borlanic | 0:fbdae7e6d805 | 247 | |
borlanic | 0:fbdae7e6d805 | 248 | FN_OID_TYPED_FROM_ASN1(oid_x520_attr_t, x520_attr, oid_x520_attr_type) |
borlanic | 0:fbdae7e6d805 | 249 | FN_OID_GET_ATTR1(mbedtls_oid_get_attr_short_name, oid_x520_attr_t, x520_attr, const char *, short_name) |
borlanic | 0:fbdae7e6d805 | 250 | |
borlanic | 0:fbdae7e6d805 | 251 | /* |
borlanic | 0:fbdae7e6d805 | 252 | * For X509 extensions |
borlanic | 0:fbdae7e6d805 | 253 | */ |
borlanic | 0:fbdae7e6d805 | 254 | typedef struct { |
borlanic | 0:fbdae7e6d805 | 255 | mbedtls_oid_descriptor_t descriptor; |
borlanic | 0:fbdae7e6d805 | 256 | int ext_type; |
borlanic | 0:fbdae7e6d805 | 257 | } oid_x509_ext_t; |
borlanic | 0:fbdae7e6d805 | 258 | |
borlanic | 0:fbdae7e6d805 | 259 | static const oid_x509_ext_t oid_x509_ext[] = |
borlanic | 0:fbdae7e6d805 | 260 | { |
borlanic | 0:fbdae7e6d805 | 261 | { |
borlanic | 0:fbdae7e6d805 | 262 | { ADD_LEN( MBEDTLS_OID_BASIC_CONSTRAINTS ), "id-ce-basicConstraints", "Basic Constraints" }, |
borlanic | 0:fbdae7e6d805 | 263 | MBEDTLS_X509_EXT_BASIC_CONSTRAINTS, |
borlanic | 0:fbdae7e6d805 | 264 | }, |
borlanic | 0:fbdae7e6d805 | 265 | { |
borlanic | 0:fbdae7e6d805 | 266 | { ADD_LEN( MBEDTLS_OID_KEY_USAGE ), "id-ce-keyUsage", "Key Usage" }, |
borlanic | 0:fbdae7e6d805 | 267 | MBEDTLS_X509_EXT_KEY_USAGE, |
borlanic | 0:fbdae7e6d805 | 268 | }, |
borlanic | 0:fbdae7e6d805 | 269 | { |
borlanic | 0:fbdae7e6d805 | 270 | { ADD_LEN( MBEDTLS_OID_EXTENDED_KEY_USAGE ), "id-ce-extKeyUsage", "Extended Key Usage" }, |
borlanic | 0:fbdae7e6d805 | 271 | MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE, |
borlanic | 0:fbdae7e6d805 | 272 | }, |
borlanic | 0:fbdae7e6d805 | 273 | { |
borlanic | 0:fbdae7e6d805 | 274 | { ADD_LEN( MBEDTLS_OID_SUBJECT_ALT_NAME ), "id-ce-subjectAltName", "Subject Alt Name" }, |
borlanic | 0:fbdae7e6d805 | 275 | MBEDTLS_X509_EXT_SUBJECT_ALT_NAME, |
borlanic | 0:fbdae7e6d805 | 276 | }, |
borlanic | 0:fbdae7e6d805 | 277 | { |
borlanic | 0:fbdae7e6d805 | 278 | { ADD_LEN( MBEDTLS_OID_NS_CERT_TYPE ), "id-netscape-certtype", "Netscape Certificate Type" }, |
borlanic | 0:fbdae7e6d805 | 279 | MBEDTLS_X509_EXT_NS_CERT_TYPE, |
borlanic | 0:fbdae7e6d805 | 280 | }, |
borlanic | 0:fbdae7e6d805 | 281 | { |
borlanic | 0:fbdae7e6d805 | 282 | { NULL, 0, NULL, NULL }, |
borlanic | 0:fbdae7e6d805 | 283 | 0, |
borlanic | 0:fbdae7e6d805 | 284 | }, |
borlanic | 0:fbdae7e6d805 | 285 | }; |
borlanic | 0:fbdae7e6d805 | 286 | |
borlanic | 0:fbdae7e6d805 | 287 | FN_OID_TYPED_FROM_ASN1(oid_x509_ext_t, x509_ext, oid_x509_ext) |
borlanic | 0:fbdae7e6d805 | 288 | FN_OID_GET_ATTR1(mbedtls_oid_get_x509_ext_type, oid_x509_ext_t, x509_ext, int, ext_type) |
borlanic | 0:fbdae7e6d805 | 289 | |
borlanic | 0:fbdae7e6d805 | 290 | static const mbedtls_oid_descriptor_t oid_ext_key_usage[] = |
borlanic | 0:fbdae7e6d805 | 291 | { |
borlanic | 0:fbdae7e6d805 | 292 | { ADD_LEN( MBEDTLS_OID_SERVER_AUTH ), "id-kp-serverAuth", "TLS Web Server Authentication" }, |
borlanic | 0:fbdae7e6d805 | 293 | { ADD_LEN( MBEDTLS_OID_CLIENT_AUTH ), "id-kp-clientAuth", "TLS Web Client Authentication" }, |
borlanic | 0:fbdae7e6d805 | 294 | { ADD_LEN( MBEDTLS_OID_CODE_SIGNING ), "id-kp-codeSigning", "Code Signing" }, |
borlanic | 0:fbdae7e6d805 | 295 | { ADD_LEN( MBEDTLS_OID_EMAIL_PROTECTION ), "id-kp-emailProtection", "E-mail Protection" }, |
borlanic | 0:fbdae7e6d805 | 296 | { ADD_LEN( MBEDTLS_OID_TIME_STAMPING ), "id-kp-timeStamping", "Time Stamping" }, |
borlanic | 0:fbdae7e6d805 | 297 | { ADD_LEN( MBEDTLS_OID_OCSP_SIGNING ), "id-kp-OCSPSigning", "OCSP Signing" }, |
borlanic | 0:fbdae7e6d805 | 298 | { NULL, 0, NULL, NULL }, |
borlanic | 0:fbdae7e6d805 | 299 | }; |
borlanic | 0:fbdae7e6d805 | 300 | |
borlanic | 0:fbdae7e6d805 | 301 | FN_OID_TYPED_FROM_ASN1(mbedtls_oid_descriptor_t, ext_key_usage, oid_ext_key_usage) |
borlanic | 0:fbdae7e6d805 | 302 | FN_OID_GET_ATTR1(mbedtls_oid_get_extended_key_usage, mbedtls_oid_descriptor_t, ext_key_usage, const char *, description) |
borlanic | 0:fbdae7e6d805 | 303 | #endif /* MBEDTLS_X509_USE_C || MBEDTLS_X509_CREATE_C */ |
borlanic | 0:fbdae7e6d805 | 304 | |
borlanic | 0:fbdae7e6d805 | 305 | #if defined(MBEDTLS_MD_C) |
borlanic | 0:fbdae7e6d805 | 306 | /* |
borlanic | 0:fbdae7e6d805 | 307 | * For SignatureAlgorithmIdentifier |
borlanic | 0:fbdae7e6d805 | 308 | */ |
borlanic | 0:fbdae7e6d805 | 309 | typedef struct { |
borlanic | 0:fbdae7e6d805 | 310 | mbedtls_oid_descriptor_t descriptor; |
borlanic | 0:fbdae7e6d805 | 311 | mbedtls_md_type_t md_alg; |
borlanic | 0:fbdae7e6d805 | 312 | mbedtls_pk_type_t pk_alg; |
borlanic | 0:fbdae7e6d805 | 313 | } oid_sig_alg_t; |
borlanic | 0:fbdae7e6d805 | 314 | |
borlanic | 0:fbdae7e6d805 | 315 | static const oid_sig_alg_t oid_sig_alg[] = |
borlanic | 0:fbdae7e6d805 | 316 | { |
borlanic | 0:fbdae7e6d805 | 317 | #if defined(MBEDTLS_RSA_C) |
borlanic | 0:fbdae7e6d805 | 318 | #if defined(MBEDTLS_MD2_C) |
borlanic | 0:fbdae7e6d805 | 319 | { |
borlanic | 0:fbdae7e6d805 | 320 | { ADD_LEN( MBEDTLS_OID_PKCS1_MD2 ), "md2WithRSAEncryption", "RSA with MD2" }, |
borlanic | 0:fbdae7e6d805 | 321 | MBEDTLS_MD_MD2, MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 322 | }, |
borlanic | 0:fbdae7e6d805 | 323 | #endif /* MBEDTLS_MD2_C */ |
borlanic | 0:fbdae7e6d805 | 324 | #if defined(MBEDTLS_MD4_C) |
borlanic | 0:fbdae7e6d805 | 325 | { |
borlanic | 0:fbdae7e6d805 | 326 | { ADD_LEN( MBEDTLS_OID_PKCS1_MD4 ), "md4WithRSAEncryption", "RSA with MD4" }, |
borlanic | 0:fbdae7e6d805 | 327 | MBEDTLS_MD_MD4, MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 328 | }, |
borlanic | 0:fbdae7e6d805 | 329 | #endif /* MBEDTLS_MD4_C */ |
borlanic | 0:fbdae7e6d805 | 330 | #if defined(MBEDTLS_MD5_C) |
borlanic | 0:fbdae7e6d805 | 331 | { |
borlanic | 0:fbdae7e6d805 | 332 | { ADD_LEN( MBEDTLS_OID_PKCS1_MD5 ), "md5WithRSAEncryption", "RSA with MD5" }, |
borlanic | 0:fbdae7e6d805 | 333 | MBEDTLS_MD_MD5, MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 334 | }, |
borlanic | 0:fbdae7e6d805 | 335 | #endif /* MBEDTLS_MD5_C */ |
borlanic | 0:fbdae7e6d805 | 336 | #if defined(MBEDTLS_SHA1_C) |
borlanic | 0:fbdae7e6d805 | 337 | { |
borlanic | 0:fbdae7e6d805 | 338 | { ADD_LEN( MBEDTLS_OID_PKCS1_SHA1 ), "sha-1WithRSAEncryption", "RSA with SHA1" }, |
borlanic | 0:fbdae7e6d805 | 339 | MBEDTLS_MD_SHA1, MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 340 | }, |
borlanic | 0:fbdae7e6d805 | 341 | #endif /* MBEDTLS_SHA1_C */ |
borlanic | 0:fbdae7e6d805 | 342 | #if defined(MBEDTLS_SHA256_C) |
borlanic | 0:fbdae7e6d805 | 343 | { |
borlanic | 0:fbdae7e6d805 | 344 | { ADD_LEN( MBEDTLS_OID_PKCS1_SHA224 ), "sha224WithRSAEncryption", "RSA with SHA-224" }, |
borlanic | 0:fbdae7e6d805 | 345 | MBEDTLS_MD_SHA224, MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 346 | }, |
borlanic | 0:fbdae7e6d805 | 347 | { |
borlanic | 0:fbdae7e6d805 | 348 | { ADD_LEN( MBEDTLS_OID_PKCS1_SHA256 ), "sha256WithRSAEncryption", "RSA with SHA-256" }, |
borlanic | 0:fbdae7e6d805 | 349 | MBEDTLS_MD_SHA256, MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 350 | }, |
borlanic | 0:fbdae7e6d805 | 351 | #endif /* MBEDTLS_SHA256_C */ |
borlanic | 0:fbdae7e6d805 | 352 | #if defined(MBEDTLS_SHA512_C) |
borlanic | 0:fbdae7e6d805 | 353 | { |
borlanic | 0:fbdae7e6d805 | 354 | { ADD_LEN( MBEDTLS_OID_PKCS1_SHA384 ), "sha384WithRSAEncryption", "RSA with SHA-384" }, |
borlanic | 0:fbdae7e6d805 | 355 | MBEDTLS_MD_SHA384, MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 356 | }, |
borlanic | 0:fbdae7e6d805 | 357 | { |
borlanic | 0:fbdae7e6d805 | 358 | { ADD_LEN( MBEDTLS_OID_PKCS1_SHA512 ), "sha512WithRSAEncryption", "RSA with SHA-512" }, |
borlanic | 0:fbdae7e6d805 | 359 | MBEDTLS_MD_SHA512, MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 360 | }, |
borlanic | 0:fbdae7e6d805 | 361 | #endif /* MBEDTLS_SHA512_C */ |
borlanic | 0:fbdae7e6d805 | 362 | #if defined(MBEDTLS_SHA1_C) |
borlanic | 0:fbdae7e6d805 | 363 | { |
borlanic | 0:fbdae7e6d805 | 364 | { ADD_LEN( MBEDTLS_OID_RSA_SHA_OBS ), "sha-1WithRSAEncryption", "RSA with SHA1" }, |
borlanic | 0:fbdae7e6d805 | 365 | MBEDTLS_MD_SHA1, MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 366 | }, |
borlanic | 0:fbdae7e6d805 | 367 | #endif /* MBEDTLS_SHA1_C */ |
borlanic | 0:fbdae7e6d805 | 368 | #endif /* MBEDTLS_RSA_C */ |
borlanic | 0:fbdae7e6d805 | 369 | #if defined(MBEDTLS_ECDSA_C) |
borlanic | 0:fbdae7e6d805 | 370 | #if defined(MBEDTLS_SHA1_C) |
borlanic | 0:fbdae7e6d805 | 371 | { |
borlanic | 0:fbdae7e6d805 | 372 | { ADD_LEN( MBEDTLS_OID_ECDSA_SHA1 ), "ecdsa-with-SHA1", "ECDSA with SHA1" }, |
borlanic | 0:fbdae7e6d805 | 373 | MBEDTLS_MD_SHA1, MBEDTLS_PK_ECDSA, |
borlanic | 0:fbdae7e6d805 | 374 | }, |
borlanic | 0:fbdae7e6d805 | 375 | #endif /* MBEDTLS_SHA1_C */ |
borlanic | 0:fbdae7e6d805 | 376 | #if defined(MBEDTLS_SHA256_C) |
borlanic | 0:fbdae7e6d805 | 377 | { |
borlanic | 0:fbdae7e6d805 | 378 | { ADD_LEN( MBEDTLS_OID_ECDSA_SHA224 ), "ecdsa-with-SHA224", "ECDSA with SHA224" }, |
borlanic | 0:fbdae7e6d805 | 379 | MBEDTLS_MD_SHA224, MBEDTLS_PK_ECDSA, |
borlanic | 0:fbdae7e6d805 | 380 | }, |
borlanic | 0:fbdae7e6d805 | 381 | { |
borlanic | 0:fbdae7e6d805 | 382 | { ADD_LEN( MBEDTLS_OID_ECDSA_SHA256 ), "ecdsa-with-SHA256", "ECDSA with SHA256" }, |
borlanic | 0:fbdae7e6d805 | 383 | MBEDTLS_MD_SHA256, MBEDTLS_PK_ECDSA, |
borlanic | 0:fbdae7e6d805 | 384 | }, |
borlanic | 0:fbdae7e6d805 | 385 | #endif /* MBEDTLS_SHA256_C */ |
borlanic | 0:fbdae7e6d805 | 386 | #if defined(MBEDTLS_SHA512_C) |
borlanic | 0:fbdae7e6d805 | 387 | { |
borlanic | 0:fbdae7e6d805 | 388 | { ADD_LEN( MBEDTLS_OID_ECDSA_SHA384 ), "ecdsa-with-SHA384", "ECDSA with SHA384" }, |
borlanic | 0:fbdae7e6d805 | 389 | MBEDTLS_MD_SHA384, MBEDTLS_PK_ECDSA, |
borlanic | 0:fbdae7e6d805 | 390 | }, |
borlanic | 0:fbdae7e6d805 | 391 | { |
borlanic | 0:fbdae7e6d805 | 392 | { ADD_LEN( MBEDTLS_OID_ECDSA_SHA512 ), "ecdsa-with-SHA512", "ECDSA with SHA512" }, |
borlanic | 0:fbdae7e6d805 | 393 | MBEDTLS_MD_SHA512, MBEDTLS_PK_ECDSA, |
borlanic | 0:fbdae7e6d805 | 394 | }, |
borlanic | 0:fbdae7e6d805 | 395 | #endif /* MBEDTLS_SHA512_C */ |
borlanic | 0:fbdae7e6d805 | 396 | #endif /* MBEDTLS_ECDSA_C */ |
borlanic | 0:fbdae7e6d805 | 397 | #if defined(MBEDTLS_RSA_C) |
borlanic | 0:fbdae7e6d805 | 398 | { |
borlanic | 0:fbdae7e6d805 | 399 | { ADD_LEN( MBEDTLS_OID_RSASSA_PSS ), "RSASSA-PSS", "RSASSA-PSS" }, |
borlanic | 0:fbdae7e6d805 | 400 | MBEDTLS_MD_NONE, MBEDTLS_PK_RSASSA_PSS, |
borlanic | 0:fbdae7e6d805 | 401 | }, |
borlanic | 0:fbdae7e6d805 | 402 | #endif /* MBEDTLS_RSA_C */ |
borlanic | 0:fbdae7e6d805 | 403 | { |
borlanic | 0:fbdae7e6d805 | 404 | { NULL, 0, NULL, NULL }, |
borlanic | 0:fbdae7e6d805 | 405 | MBEDTLS_MD_NONE, MBEDTLS_PK_NONE, |
borlanic | 0:fbdae7e6d805 | 406 | }, |
borlanic | 0:fbdae7e6d805 | 407 | }; |
borlanic | 0:fbdae7e6d805 | 408 | |
borlanic | 0:fbdae7e6d805 | 409 | FN_OID_TYPED_FROM_ASN1(oid_sig_alg_t, sig_alg, oid_sig_alg) |
borlanic | 0:fbdae7e6d805 | 410 | FN_OID_GET_DESCRIPTOR_ATTR1(mbedtls_oid_get_sig_alg_desc, oid_sig_alg_t, sig_alg, const char *, description) |
borlanic | 0:fbdae7e6d805 | 411 | FN_OID_GET_ATTR2(mbedtls_oid_get_sig_alg, oid_sig_alg_t, sig_alg, mbedtls_md_type_t, md_alg, mbedtls_pk_type_t, pk_alg) |
borlanic | 0:fbdae7e6d805 | 412 | FN_OID_GET_OID_BY_ATTR2(mbedtls_oid_get_oid_by_sig_alg, oid_sig_alg_t, oid_sig_alg, mbedtls_pk_type_t, pk_alg, mbedtls_md_type_t, md_alg) |
borlanic | 0:fbdae7e6d805 | 413 | #endif /* MBEDTLS_MD_C */ |
borlanic | 0:fbdae7e6d805 | 414 | |
borlanic | 0:fbdae7e6d805 | 415 | /* |
borlanic | 0:fbdae7e6d805 | 416 | * For PublicKeyInfo (PKCS1, RFC 5480) |
borlanic | 0:fbdae7e6d805 | 417 | */ |
borlanic | 0:fbdae7e6d805 | 418 | typedef struct { |
borlanic | 0:fbdae7e6d805 | 419 | mbedtls_oid_descriptor_t descriptor; |
borlanic | 0:fbdae7e6d805 | 420 | mbedtls_pk_type_t pk_alg; |
borlanic | 0:fbdae7e6d805 | 421 | } oid_pk_alg_t; |
borlanic | 0:fbdae7e6d805 | 422 | |
borlanic | 0:fbdae7e6d805 | 423 | static const oid_pk_alg_t oid_pk_alg[] = |
borlanic | 0:fbdae7e6d805 | 424 | { |
borlanic | 0:fbdae7e6d805 | 425 | { |
borlanic | 0:fbdae7e6d805 | 426 | { ADD_LEN( MBEDTLS_OID_PKCS1_RSA ), "rsaEncryption", "RSA" }, |
borlanic | 0:fbdae7e6d805 | 427 | MBEDTLS_PK_RSA, |
borlanic | 0:fbdae7e6d805 | 428 | }, |
borlanic | 0:fbdae7e6d805 | 429 | { |
borlanic | 0:fbdae7e6d805 | 430 | { ADD_LEN( MBEDTLS_OID_EC_ALG_UNRESTRICTED ), "id-ecPublicKey", "Generic EC key" }, |
borlanic | 0:fbdae7e6d805 | 431 | MBEDTLS_PK_ECKEY, |
borlanic | 0:fbdae7e6d805 | 432 | }, |
borlanic | 0:fbdae7e6d805 | 433 | { |
borlanic | 0:fbdae7e6d805 | 434 | { ADD_LEN( MBEDTLS_OID_EC_ALG_ECDH ), "id-ecDH", "EC key for ECDH" }, |
borlanic | 0:fbdae7e6d805 | 435 | MBEDTLS_PK_ECKEY_DH, |
borlanic | 0:fbdae7e6d805 | 436 | }, |
borlanic | 0:fbdae7e6d805 | 437 | { |
borlanic | 0:fbdae7e6d805 | 438 | { NULL, 0, NULL, NULL }, |
borlanic | 0:fbdae7e6d805 | 439 | MBEDTLS_PK_NONE, |
borlanic | 0:fbdae7e6d805 | 440 | }, |
borlanic | 0:fbdae7e6d805 | 441 | }; |
borlanic | 0:fbdae7e6d805 | 442 | |
borlanic | 0:fbdae7e6d805 | 443 | FN_OID_TYPED_FROM_ASN1(oid_pk_alg_t, pk_alg, oid_pk_alg) |
borlanic | 0:fbdae7e6d805 | 444 | FN_OID_GET_ATTR1(mbedtls_oid_get_pk_alg, oid_pk_alg_t, pk_alg, mbedtls_pk_type_t, pk_alg) |
borlanic | 0:fbdae7e6d805 | 445 | FN_OID_GET_OID_BY_ATTR1(mbedtls_oid_get_oid_by_pk_alg, oid_pk_alg_t, oid_pk_alg, mbedtls_pk_type_t, pk_alg) |
borlanic | 0:fbdae7e6d805 | 446 | |
borlanic | 0:fbdae7e6d805 | 447 | #if defined(MBEDTLS_ECP_C) |
borlanic | 0:fbdae7e6d805 | 448 | /* |
borlanic | 0:fbdae7e6d805 | 449 | * For namedCurve (RFC 5480) |
borlanic | 0:fbdae7e6d805 | 450 | */ |
borlanic | 0:fbdae7e6d805 | 451 | typedef struct { |
borlanic | 0:fbdae7e6d805 | 452 | mbedtls_oid_descriptor_t descriptor; |
borlanic | 0:fbdae7e6d805 | 453 | mbedtls_ecp_group_id grp_id; |
borlanic | 0:fbdae7e6d805 | 454 | } oid_ecp_grp_t; |
borlanic | 0:fbdae7e6d805 | 455 | |
borlanic | 0:fbdae7e6d805 | 456 | static const oid_ecp_grp_t oid_ecp_grp[] = |
borlanic | 0:fbdae7e6d805 | 457 | { |
borlanic | 0:fbdae7e6d805 | 458 | #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 459 | { |
borlanic | 0:fbdae7e6d805 | 460 | { ADD_LEN( MBEDTLS_OID_EC_GRP_SECP192R1 ), "secp192r1", "secp192r1" }, |
borlanic | 0:fbdae7e6d805 | 461 | MBEDTLS_ECP_DP_SECP192R1, |
borlanic | 0:fbdae7e6d805 | 462 | }, |
borlanic | 0:fbdae7e6d805 | 463 | #endif /* MBEDTLS_ECP_DP_SECP192R1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 464 | #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 465 | { |
borlanic | 0:fbdae7e6d805 | 466 | { ADD_LEN( MBEDTLS_OID_EC_GRP_SECP224R1 ), "secp224r1", "secp224r1" }, |
borlanic | 0:fbdae7e6d805 | 467 | MBEDTLS_ECP_DP_SECP224R1, |
borlanic | 0:fbdae7e6d805 | 468 | }, |
borlanic | 0:fbdae7e6d805 | 469 | #endif /* MBEDTLS_ECP_DP_SECP224R1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 470 | #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 471 | { |
borlanic | 0:fbdae7e6d805 | 472 | { ADD_LEN( MBEDTLS_OID_EC_GRP_SECP256R1 ), "secp256r1", "secp256r1" }, |
borlanic | 0:fbdae7e6d805 | 473 | MBEDTLS_ECP_DP_SECP256R1, |
borlanic | 0:fbdae7e6d805 | 474 | }, |
borlanic | 0:fbdae7e6d805 | 475 | #endif /* MBEDTLS_ECP_DP_SECP256R1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 476 | #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 477 | { |
borlanic | 0:fbdae7e6d805 | 478 | { ADD_LEN( MBEDTLS_OID_EC_GRP_SECP384R1 ), "secp384r1", "secp384r1" }, |
borlanic | 0:fbdae7e6d805 | 479 | MBEDTLS_ECP_DP_SECP384R1, |
borlanic | 0:fbdae7e6d805 | 480 | }, |
borlanic | 0:fbdae7e6d805 | 481 | #endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 482 | #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 483 | { |
borlanic | 0:fbdae7e6d805 | 484 | { ADD_LEN( MBEDTLS_OID_EC_GRP_SECP521R1 ), "secp521r1", "secp521r1" }, |
borlanic | 0:fbdae7e6d805 | 485 | MBEDTLS_ECP_DP_SECP521R1, |
borlanic | 0:fbdae7e6d805 | 486 | }, |
borlanic | 0:fbdae7e6d805 | 487 | #endif /* MBEDTLS_ECP_DP_SECP521R1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 488 | #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 489 | { |
borlanic | 0:fbdae7e6d805 | 490 | { ADD_LEN( MBEDTLS_OID_EC_GRP_SECP192K1 ), "secp192k1", "secp192k1" }, |
borlanic | 0:fbdae7e6d805 | 491 | MBEDTLS_ECP_DP_SECP192K1, |
borlanic | 0:fbdae7e6d805 | 492 | }, |
borlanic | 0:fbdae7e6d805 | 493 | #endif /* MBEDTLS_ECP_DP_SECP192K1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 494 | #if defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 495 | { |
borlanic | 0:fbdae7e6d805 | 496 | { ADD_LEN( MBEDTLS_OID_EC_GRP_SECP224K1 ), "secp224k1", "secp224k1" }, |
borlanic | 0:fbdae7e6d805 | 497 | MBEDTLS_ECP_DP_SECP224K1, |
borlanic | 0:fbdae7e6d805 | 498 | }, |
borlanic | 0:fbdae7e6d805 | 499 | #endif /* MBEDTLS_ECP_DP_SECP224K1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 500 | #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 501 | { |
borlanic | 0:fbdae7e6d805 | 502 | { ADD_LEN( MBEDTLS_OID_EC_GRP_SECP256K1 ), "secp256k1", "secp256k1" }, |
borlanic | 0:fbdae7e6d805 | 503 | MBEDTLS_ECP_DP_SECP256K1, |
borlanic | 0:fbdae7e6d805 | 504 | }, |
borlanic | 0:fbdae7e6d805 | 505 | #endif /* MBEDTLS_ECP_DP_SECP256K1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 506 | #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 507 | { |
borlanic | 0:fbdae7e6d805 | 508 | { ADD_LEN( MBEDTLS_OID_EC_GRP_BP256R1 ), "brainpoolP256r1","brainpool256r1" }, |
borlanic | 0:fbdae7e6d805 | 509 | MBEDTLS_ECP_DP_BP256R1, |
borlanic | 0:fbdae7e6d805 | 510 | }, |
borlanic | 0:fbdae7e6d805 | 511 | #endif /* MBEDTLS_ECP_DP_BP256R1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 512 | #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 513 | { |
borlanic | 0:fbdae7e6d805 | 514 | { ADD_LEN( MBEDTLS_OID_EC_GRP_BP384R1 ), "brainpoolP384r1","brainpool384r1" }, |
borlanic | 0:fbdae7e6d805 | 515 | MBEDTLS_ECP_DP_BP384R1, |
borlanic | 0:fbdae7e6d805 | 516 | }, |
borlanic | 0:fbdae7e6d805 | 517 | #endif /* MBEDTLS_ECP_DP_BP384R1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 518 | #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) |
borlanic | 0:fbdae7e6d805 | 519 | { |
borlanic | 0:fbdae7e6d805 | 520 | { ADD_LEN( MBEDTLS_OID_EC_GRP_BP512R1 ), "brainpoolP512r1","brainpool512r1" }, |
borlanic | 0:fbdae7e6d805 | 521 | MBEDTLS_ECP_DP_BP512R1, |
borlanic | 0:fbdae7e6d805 | 522 | }, |
borlanic | 0:fbdae7e6d805 | 523 | #endif /* MBEDTLS_ECP_DP_BP512R1_ENABLED */ |
borlanic | 0:fbdae7e6d805 | 524 | { |
borlanic | 0:fbdae7e6d805 | 525 | { NULL, 0, NULL, NULL }, |
borlanic | 0:fbdae7e6d805 | 526 | MBEDTLS_ECP_DP_NONE, |
borlanic | 0:fbdae7e6d805 | 527 | }, |
borlanic | 0:fbdae7e6d805 | 528 | }; |
borlanic | 0:fbdae7e6d805 | 529 | |
borlanic | 0:fbdae7e6d805 | 530 | FN_OID_TYPED_FROM_ASN1(oid_ecp_grp_t, grp_id, oid_ecp_grp) |
borlanic | 0:fbdae7e6d805 | 531 | FN_OID_GET_ATTR1(mbedtls_oid_get_ec_grp, oid_ecp_grp_t, grp_id, mbedtls_ecp_group_id, grp_id) |
borlanic | 0:fbdae7e6d805 | 532 | FN_OID_GET_OID_BY_ATTR1(mbedtls_oid_get_oid_by_ec_grp, oid_ecp_grp_t, oid_ecp_grp, mbedtls_ecp_group_id, grp_id) |
borlanic | 0:fbdae7e6d805 | 533 | #endif /* MBEDTLS_ECP_C */ |
borlanic | 0:fbdae7e6d805 | 534 | |
borlanic | 0:fbdae7e6d805 | 535 | #if defined(MBEDTLS_CIPHER_C) |
borlanic | 0:fbdae7e6d805 | 536 | /* |
borlanic | 0:fbdae7e6d805 | 537 | * For PKCS#5 PBES2 encryption algorithm |
borlanic | 0:fbdae7e6d805 | 538 | */ |
borlanic | 0:fbdae7e6d805 | 539 | typedef struct { |
borlanic | 0:fbdae7e6d805 | 540 | mbedtls_oid_descriptor_t descriptor; |
borlanic | 0:fbdae7e6d805 | 541 | mbedtls_cipher_type_t cipher_alg; |
borlanic | 0:fbdae7e6d805 | 542 | } oid_cipher_alg_t; |
borlanic | 0:fbdae7e6d805 | 543 | |
borlanic | 0:fbdae7e6d805 | 544 | static const oid_cipher_alg_t oid_cipher_alg[] = |
borlanic | 0:fbdae7e6d805 | 545 | { |
borlanic | 0:fbdae7e6d805 | 546 | { |
borlanic | 0:fbdae7e6d805 | 547 | { ADD_LEN( MBEDTLS_OID_DES_CBC ), "desCBC", "DES-CBC" }, |
borlanic | 0:fbdae7e6d805 | 548 | MBEDTLS_CIPHER_DES_CBC, |
borlanic | 0:fbdae7e6d805 | 549 | }, |
borlanic | 0:fbdae7e6d805 | 550 | { |
borlanic | 0:fbdae7e6d805 | 551 | { ADD_LEN( MBEDTLS_OID_DES_EDE3_CBC ), "des-ede3-cbc", "DES-EDE3-CBC" }, |
borlanic | 0:fbdae7e6d805 | 552 | MBEDTLS_CIPHER_DES_EDE3_CBC, |
borlanic | 0:fbdae7e6d805 | 553 | }, |
borlanic | 0:fbdae7e6d805 | 554 | { |
borlanic | 0:fbdae7e6d805 | 555 | { NULL, 0, NULL, NULL }, |
borlanic | 0:fbdae7e6d805 | 556 | MBEDTLS_CIPHER_NONE, |
borlanic | 0:fbdae7e6d805 | 557 | }, |
borlanic | 0:fbdae7e6d805 | 558 | }; |
borlanic | 0:fbdae7e6d805 | 559 | |
borlanic | 0:fbdae7e6d805 | 560 | FN_OID_TYPED_FROM_ASN1(oid_cipher_alg_t, cipher_alg, oid_cipher_alg) |
borlanic | 0:fbdae7e6d805 | 561 | FN_OID_GET_ATTR1(mbedtls_oid_get_cipher_alg, oid_cipher_alg_t, cipher_alg, mbedtls_cipher_type_t, cipher_alg) |
borlanic | 0:fbdae7e6d805 | 562 | #endif /* MBEDTLS_CIPHER_C */ |
borlanic | 0:fbdae7e6d805 | 563 | |
borlanic | 0:fbdae7e6d805 | 564 | #if defined(MBEDTLS_MD_C) |
borlanic | 0:fbdae7e6d805 | 565 | /* |
borlanic | 0:fbdae7e6d805 | 566 | * For digestAlgorithm |
borlanic | 0:fbdae7e6d805 | 567 | */ |
borlanic | 0:fbdae7e6d805 | 568 | typedef struct { |
borlanic | 0:fbdae7e6d805 | 569 | mbedtls_oid_descriptor_t descriptor; |
borlanic | 0:fbdae7e6d805 | 570 | mbedtls_md_type_t md_alg; |
borlanic | 0:fbdae7e6d805 | 571 | } oid_md_alg_t; |
borlanic | 0:fbdae7e6d805 | 572 | |
borlanic | 0:fbdae7e6d805 | 573 | static const oid_md_alg_t oid_md_alg[] = |
borlanic | 0:fbdae7e6d805 | 574 | { |
borlanic | 0:fbdae7e6d805 | 575 | #if defined(MBEDTLS_MD2_C) |
borlanic | 0:fbdae7e6d805 | 576 | { |
borlanic | 0:fbdae7e6d805 | 577 | { ADD_LEN( MBEDTLS_OID_DIGEST_ALG_MD2 ), "id-md2", "MD2" }, |
borlanic | 0:fbdae7e6d805 | 578 | MBEDTLS_MD_MD2, |
borlanic | 0:fbdae7e6d805 | 579 | }, |
borlanic | 0:fbdae7e6d805 | 580 | #endif /* MBEDTLS_MD2_C */ |
borlanic | 0:fbdae7e6d805 | 581 | #if defined(MBEDTLS_MD4_C) |
borlanic | 0:fbdae7e6d805 | 582 | { |
borlanic | 0:fbdae7e6d805 | 583 | { ADD_LEN( MBEDTLS_OID_DIGEST_ALG_MD4 ), "id-md4", "MD4" }, |
borlanic | 0:fbdae7e6d805 | 584 | MBEDTLS_MD_MD4, |
borlanic | 0:fbdae7e6d805 | 585 | }, |
borlanic | 0:fbdae7e6d805 | 586 | #endif /* MBEDTLS_MD4_C */ |
borlanic | 0:fbdae7e6d805 | 587 | #if defined(MBEDTLS_MD5_C) |
borlanic | 0:fbdae7e6d805 | 588 | { |
borlanic | 0:fbdae7e6d805 | 589 | { ADD_LEN( MBEDTLS_OID_DIGEST_ALG_MD5 ), "id-md5", "MD5" }, |
borlanic | 0:fbdae7e6d805 | 590 | MBEDTLS_MD_MD5, |
borlanic | 0:fbdae7e6d805 | 591 | }, |
borlanic | 0:fbdae7e6d805 | 592 | #endif /* MBEDTLS_MD5_C */ |
borlanic | 0:fbdae7e6d805 | 593 | #if defined(MBEDTLS_SHA1_C) |
borlanic | 0:fbdae7e6d805 | 594 | { |
borlanic | 0:fbdae7e6d805 | 595 | { ADD_LEN( MBEDTLS_OID_DIGEST_ALG_SHA1 ), "id-sha1", "SHA-1" }, |
borlanic | 0:fbdae7e6d805 | 596 | MBEDTLS_MD_SHA1, |
borlanic | 0:fbdae7e6d805 | 597 | }, |
borlanic | 0:fbdae7e6d805 | 598 | #endif /* MBEDTLS_SHA1_C */ |
borlanic | 0:fbdae7e6d805 | 599 | #if defined(MBEDTLS_SHA256_C) |
borlanic | 0:fbdae7e6d805 | 600 | { |
borlanic | 0:fbdae7e6d805 | 601 | { ADD_LEN( MBEDTLS_OID_DIGEST_ALG_SHA224 ), "id-sha224", "SHA-224" }, |
borlanic | 0:fbdae7e6d805 | 602 | MBEDTLS_MD_SHA224, |
borlanic | 0:fbdae7e6d805 | 603 | }, |
borlanic | 0:fbdae7e6d805 | 604 | { |
borlanic | 0:fbdae7e6d805 | 605 | { ADD_LEN( MBEDTLS_OID_DIGEST_ALG_SHA256 ), "id-sha256", "SHA-256" }, |
borlanic | 0:fbdae7e6d805 | 606 | MBEDTLS_MD_SHA256, |
borlanic | 0:fbdae7e6d805 | 607 | }, |
borlanic | 0:fbdae7e6d805 | 608 | #endif /* MBEDTLS_SHA256_C */ |
borlanic | 0:fbdae7e6d805 | 609 | #if defined(MBEDTLS_SHA512_C) |
borlanic | 0:fbdae7e6d805 | 610 | { |
borlanic | 0:fbdae7e6d805 | 611 | { ADD_LEN( MBEDTLS_OID_DIGEST_ALG_SHA384 ), "id-sha384", "SHA-384" }, |
borlanic | 0:fbdae7e6d805 | 612 | MBEDTLS_MD_SHA384, |
borlanic | 0:fbdae7e6d805 | 613 | }, |
borlanic | 0:fbdae7e6d805 | 614 | { |
borlanic | 0:fbdae7e6d805 | 615 | { ADD_LEN( MBEDTLS_OID_DIGEST_ALG_SHA512 ), "id-sha512", "SHA-512" }, |
borlanic | 0:fbdae7e6d805 | 616 | MBEDTLS_MD_SHA512, |
borlanic | 0:fbdae7e6d805 | 617 | }, |
borlanic | 0:fbdae7e6d805 | 618 | #endif /* MBEDTLS_SHA512_C */ |
borlanic | 0:fbdae7e6d805 | 619 | { |
borlanic | 0:fbdae7e6d805 | 620 | { NULL, 0, NULL, NULL }, |
borlanic | 0:fbdae7e6d805 | 621 | MBEDTLS_MD_NONE, |
borlanic | 0:fbdae7e6d805 | 622 | }, |
borlanic | 0:fbdae7e6d805 | 623 | }; |
borlanic | 0:fbdae7e6d805 | 624 | |
borlanic | 0:fbdae7e6d805 | 625 | FN_OID_TYPED_FROM_ASN1(oid_md_alg_t, md_alg, oid_md_alg) |
borlanic | 0:fbdae7e6d805 | 626 | FN_OID_GET_ATTR1(mbedtls_oid_get_md_alg, oid_md_alg_t, md_alg, mbedtls_md_type_t, md_alg) |
borlanic | 0:fbdae7e6d805 | 627 | FN_OID_GET_OID_BY_ATTR1(mbedtls_oid_get_oid_by_md, oid_md_alg_t, oid_md_alg, mbedtls_md_type_t, md_alg) |
borlanic | 0:fbdae7e6d805 | 628 | #endif /* MBEDTLS_MD_C */ |
borlanic | 0:fbdae7e6d805 | 629 | |
borlanic | 0:fbdae7e6d805 | 630 | #if defined(MBEDTLS_PKCS12_C) |
borlanic | 0:fbdae7e6d805 | 631 | /* |
borlanic | 0:fbdae7e6d805 | 632 | * For PKCS#12 PBEs |
borlanic | 0:fbdae7e6d805 | 633 | */ |
borlanic | 0:fbdae7e6d805 | 634 | typedef struct { |
borlanic | 0:fbdae7e6d805 | 635 | mbedtls_oid_descriptor_t descriptor; |
borlanic | 0:fbdae7e6d805 | 636 | mbedtls_md_type_t md_alg; |
borlanic | 0:fbdae7e6d805 | 637 | mbedtls_cipher_type_t cipher_alg; |
borlanic | 0:fbdae7e6d805 | 638 | } oid_pkcs12_pbe_alg_t; |
borlanic | 0:fbdae7e6d805 | 639 | |
borlanic | 0:fbdae7e6d805 | 640 | static const oid_pkcs12_pbe_alg_t oid_pkcs12_pbe_alg[] = |
borlanic | 0:fbdae7e6d805 | 641 | { |
borlanic | 0:fbdae7e6d805 | 642 | { |
borlanic | 0:fbdae7e6d805 | 643 | { ADD_LEN( MBEDTLS_OID_PKCS12_PBE_SHA1_DES3_EDE_CBC ), "pbeWithSHAAnd3-KeyTripleDES-CBC", "PBE with SHA1 and 3-Key 3DES" }, |
borlanic | 0:fbdae7e6d805 | 644 | MBEDTLS_MD_SHA1, MBEDTLS_CIPHER_DES_EDE3_CBC, |
borlanic | 0:fbdae7e6d805 | 645 | }, |
borlanic | 0:fbdae7e6d805 | 646 | { |
borlanic | 0:fbdae7e6d805 | 647 | { ADD_LEN( MBEDTLS_OID_PKCS12_PBE_SHA1_DES2_EDE_CBC ), "pbeWithSHAAnd2-KeyTripleDES-CBC", "PBE with SHA1 and 2-Key 3DES" }, |
borlanic | 0:fbdae7e6d805 | 648 | MBEDTLS_MD_SHA1, MBEDTLS_CIPHER_DES_EDE_CBC, |
borlanic | 0:fbdae7e6d805 | 649 | }, |
borlanic | 0:fbdae7e6d805 | 650 | { |
borlanic | 0:fbdae7e6d805 | 651 | { NULL, 0, NULL, NULL }, |
borlanic | 0:fbdae7e6d805 | 652 | MBEDTLS_MD_NONE, MBEDTLS_CIPHER_NONE, |
borlanic | 0:fbdae7e6d805 | 653 | }, |
borlanic | 0:fbdae7e6d805 | 654 | }; |
borlanic | 0:fbdae7e6d805 | 655 | |
borlanic | 0:fbdae7e6d805 | 656 | FN_OID_TYPED_FROM_ASN1(oid_pkcs12_pbe_alg_t, pkcs12_pbe_alg, oid_pkcs12_pbe_alg) |
borlanic | 0:fbdae7e6d805 | 657 | FN_OID_GET_ATTR2(mbedtls_oid_get_pkcs12_pbe_alg, oid_pkcs12_pbe_alg_t, pkcs12_pbe_alg, mbedtls_md_type_t, md_alg, mbedtls_cipher_type_t, cipher_alg) |
borlanic | 0:fbdae7e6d805 | 658 | #endif /* MBEDTLS_PKCS12_C */ |
borlanic | 0:fbdae7e6d805 | 659 | |
borlanic | 0:fbdae7e6d805 | 660 | #define OID_SAFE_SNPRINTF \ |
borlanic | 0:fbdae7e6d805 | 661 | do { \ |
borlanic | 0:fbdae7e6d805 | 662 | if( ret < 0 || (size_t) ret >= n ) \ |
borlanic | 0:fbdae7e6d805 | 663 | return( MBEDTLS_ERR_OID_BUF_TOO_SMALL ); \ |
borlanic | 0:fbdae7e6d805 | 664 | \ |
borlanic | 0:fbdae7e6d805 | 665 | n -= (size_t) ret; \ |
borlanic | 0:fbdae7e6d805 | 666 | p += (size_t) ret; \ |
borlanic | 0:fbdae7e6d805 | 667 | } while( 0 ) |
borlanic | 0:fbdae7e6d805 | 668 | |
borlanic | 0:fbdae7e6d805 | 669 | /* Return the x.y.z.... style numeric string for the given OID */ |
borlanic | 0:fbdae7e6d805 | 670 | int mbedtls_oid_get_numeric_string( char *buf, size_t size, |
borlanic | 0:fbdae7e6d805 | 671 | const mbedtls_asn1_buf *oid ) |
borlanic | 0:fbdae7e6d805 | 672 | { |
borlanic | 0:fbdae7e6d805 | 673 | int ret; |
borlanic | 0:fbdae7e6d805 | 674 | size_t i, n; |
borlanic | 0:fbdae7e6d805 | 675 | unsigned int value; |
borlanic | 0:fbdae7e6d805 | 676 | char *p; |
borlanic | 0:fbdae7e6d805 | 677 | |
borlanic | 0:fbdae7e6d805 | 678 | p = buf; |
borlanic | 0:fbdae7e6d805 | 679 | n = size; |
borlanic | 0:fbdae7e6d805 | 680 | |
borlanic | 0:fbdae7e6d805 | 681 | /* First byte contains first two dots */ |
borlanic | 0:fbdae7e6d805 | 682 | if( oid->len > 0 ) |
borlanic | 0:fbdae7e6d805 | 683 | { |
borlanic | 0:fbdae7e6d805 | 684 | ret = mbedtls_snprintf( p, n, "%d.%d", oid->p[0] / 40, oid->p[0] % 40 ); |
borlanic | 0:fbdae7e6d805 | 685 | OID_SAFE_SNPRINTF; |
borlanic | 0:fbdae7e6d805 | 686 | } |
borlanic | 0:fbdae7e6d805 | 687 | |
borlanic | 0:fbdae7e6d805 | 688 | value = 0; |
borlanic | 0:fbdae7e6d805 | 689 | for( i = 1; i < oid->len; i++ ) |
borlanic | 0:fbdae7e6d805 | 690 | { |
borlanic | 0:fbdae7e6d805 | 691 | /* Prevent overflow in value. */ |
borlanic | 0:fbdae7e6d805 | 692 | if( ( ( value << 7 ) >> 7 ) != value ) |
borlanic | 0:fbdae7e6d805 | 693 | return( MBEDTLS_ERR_OID_BUF_TOO_SMALL ); |
borlanic | 0:fbdae7e6d805 | 694 | |
borlanic | 0:fbdae7e6d805 | 695 | value <<= 7; |
borlanic | 0:fbdae7e6d805 | 696 | value += oid->p[i] & 0x7F; |
borlanic | 0:fbdae7e6d805 | 697 | |
borlanic | 0:fbdae7e6d805 | 698 | if( !( oid->p[i] & 0x80 ) ) |
borlanic | 0:fbdae7e6d805 | 699 | { |
borlanic | 0:fbdae7e6d805 | 700 | /* Last byte */ |
borlanic | 0:fbdae7e6d805 | 701 | ret = mbedtls_snprintf( p, n, ".%d", value ); |
borlanic | 0:fbdae7e6d805 | 702 | OID_SAFE_SNPRINTF; |
borlanic | 0:fbdae7e6d805 | 703 | value = 0; |
borlanic | 0:fbdae7e6d805 | 704 | } |
borlanic | 0:fbdae7e6d805 | 705 | } |
borlanic | 0:fbdae7e6d805 | 706 | |
borlanic | 0:fbdae7e6d805 | 707 | return( (int) ( size - n ) ); |
borlanic | 0:fbdae7e6d805 | 708 | } |
borlanic | 0:fbdae7e6d805 | 709 | |
borlanic | 0:fbdae7e6d805 | 710 | #endif /* MBEDTLS_OID_C */ |