mbed os with nrf51 internal bandgap enabled to read battery level

Dependents:   BLE_file_test BLE_Blink ExternalEncoder

Committer:
elessair
Date:
Sun Oct 23 15:10:02 2016 +0000
Revision:
0:f269e3021894
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elessair 0:f269e3021894 1 /*
elessair 0:f269e3021894 2 * Generic ASN.1 parsing
elessair 0:f269e3021894 3 *
elessair 0:f269e3021894 4 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
elessair 0:f269e3021894 5 * SPDX-License-Identifier: Apache-2.0
elessair 0:f269e3021894 6 *
elessair 0:f269e3021894 7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
elessair 0:f269e3021894 8 * not use this file except in compliance with the License.
elessair 0:f269e3021894 9 * You may obtain a copy of the License at
elessair 0:f269e3021894 10 *
elessair 0:f269e3021894 11 * http://www.apache.org/licenses/LICENSE-2.0
elessair 0:f269e3021894 12 *
elessair 0:f269e3021894 13 * Unless required by applicable law or agreed to in writing, software
elessair 0:f269e3021894 14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
elessair 0:f269e3021894 15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
elessair 0:f269e3021894 16 * See the License for the specific language governing permissions and
elessair 0:f269e3021894 17 * limitations under the License.
elessair 0:f269e3021894 18 *
elessair 0:f269e3021894 19 * This file is part of mbed TLS (https://tls.mbed.org)
elessair 0:f269e3021894 20 */
elessair 0:f269e3021894 21
elessair 0:f269e3021894 22 #if !defined(MBEDTLS_CONFIG_FILE)
elessair 0:f269e3021894 23 #include "mbedtls/config.h"
elessair 0:f269e3021894 24 #else
elessair 0:f269e3021894 25 #include MBEDTLS_CONFIG_FILE
elessair 0:f269e3021894 26 #endif
elessair 0:f269e3021894 27
elessair 0:f269e3021894 28 #if defined(MBEDTLS_ASN1_PARSE_C)
elessair 0:f269e3021894 29
elessair 0:f269e3021894 30 #include "mbedtls/asn1.h"
elessair 0:f269e3021894 31
elessair 0:f269e3021894 32 #include <string.h>
elessair 0:f269e3021894 33
elessair 0:f269e3021894 34 #if defined(MBEDTLS_BIGNUM_C)
elessair 0:f269e3021894 35 #include "mbedtls/bignum.h"
elessair 0:f269e3021894 36 #endif
elessair 0:f269e3021894 37
elessair 0:f269e3021894 38 #if defined(MBEDTLS_PLATFORM_C)
elessair 0:f269e3021894 39 #include "mbedtls/platform.h"
elessair 0:f269e3021894 40 #else
elessair 0:f269e3021894 41 #include <stdlib.h>
elessair 0:f269e3021894 42 #define mbedtls_calloc calloc
elessair 0:f269e3021894 43 #define mbedtls_free free
elessair 0:f269e3021894 44 #endif
elessair 0:f269e3021894 45
elessair 0:f269e3021894 46 /* Implementation that should never be optimized out by the compiler */
elessair 0:f269e3021894 47 static void mbedtls_zeroize( void *v, size_t n ) {
elessair 0:f269e3021894 48 volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
elessair 0:f269e3021894 49 }
elessair 0:f269e3021894 50
elessair 0:f269e3021894 51 /*
elessair 0:f269e3021894 52 * ASN.1 DER decoding routines
elessair 0:f269e3021894 53 */
elessair 0:f269e3021894 54 int mbedtls_asn1_get_len( unsigned char **p,
elessair 0:f269e3021894 55 const unsigned char *end,
elessair 0:f269e3021894 56 size_t *len )
elessair 0:f269e3021894 57 {
elessair 0:f269e3021894 58 if( ( end - *p ) < 1 )
elessair 0:f269e3021894 59 return( MBEDTLS_ERR_ASN1_OUT_OF_DATA );
elessair 0:f269e3021894 60
elessair 0:f269e3021894 61 if( ( **p & 0x80 ) == 0 )
elessair 0:f269e3021894 62 *len = *(*p)++;
elessair 0:f269e3021894 63 else
elessair 0:f269e3021894 64 {
elessair 0:f269e3021894 65 switch( **p & 0x7F )
elessair 0:f269e3021894 66 {
elessair 0:f269e3021894 67 case 1:
elessair 0:f269e3021894 68 if( ( end - *p ) < 2 )
elessair 0:f269e3021894 69 return( MBEDTLS_ERR_ASN1_OUT_OF_DATA );
elessair 0:f269e3021894 70
elessair 0:f269e3021894 71 *len = (*p)[1];
elessair 0:f269e3021894 72 (*p) += 2;
elessair 0:f269e3021894 73 break;
elessair 0:f269e3021894 74
elessair 0:f269e3021894 75 case 2:
elessair 0:f269e3021894 76 if( ( end - *p ) < 3 )
elessair 0:f269e3021894 77 return( MBEDTLS_ERR_ASN1_OUT_OF_DATA );
elessair 0:f269e3021894 78
elessair 0:f269e3021894 79 *len = ( (size_t)(*p)[1] << 8 ) | (*p)[2];
elessair 0:f269e3021894 80 (*p) += 3;
elessair 0:f269e3021894 81 break;
elessair 0:f269e3021894 82
elessair 0:f269e3021894 83 case 3:
elessair 0:f269e3021894 84 if( ( end - *p ) < 4 )
elessair 0:f269e3021894 85 return( MBEDTLS_ERR_ASN1_OUT_OF_DATA );
elessair 0:f269e3021894 86
elessair 0:f269e3021894 87 *len = ( (size_t)(*p)[1] << 16 ) |
elessair 0:f269e3021894 88 ( (size_t)(*p)[2] << 8 ) | (*p)[3];
elessair 0:f269e3021894 89 (*p) += 4;
elessair 0:f269e3021894 90 break;
elessair 0:f269e3021894 91
elessair 0:f269e3021894 92 case 4:
elessair 0:f269e3021894 93 if( ( end - *p ) < 5 )
elessair 0:f269e3021894 94 return( MBEDTLS_ERR_ASN1_OUT_OF_DATA );
elessair 0:f269e3021894 95
elessair 0:f269e3021894 96 *len = ( (size_t)(*p)[1] << 24 ) | ( (size_t)(*p)[2] << 16 ) |
elessair 0:f269e3021894 97 ( (size_t)(*p)[3] << 8 ) | (*p)[4];
elessair 0:f269e3021894 98 (*p) += 5;
elessair 0:f269e3021894 99 break;
elessair 0:f269e3021894 100
elessair 0:f269e3021894 101 default:
elessair 0:f269e3021894 102 return( MBEDTLS_ERR_ASN1_INVALID_LENGTH );
elessair 0:f269e3021894 103 }
elessair 0:f269e3021894 104 }
elessair 0:f269e3021894 105
elessair 0:f269e3021894 106 if( *len > (size_t) ( end - *p ) )
elessair 0:f269e3021894 107 return( MBEDTLS_ERR_ASN1_OUT_OF_DATA );
elessair 0:f269e3021894 108
elessair 0:f269e3021894 109 return( 0 );
elessair 0:f269e3021894 110 }
elessair 0:f269e3021894 111
elessair 0:f269e3021894 112 int mbedtls_asn1_get_tag( unsigned char **p,
elessair 0:f269e3021894 113 const unsigned char *end,
elessair 0:f269e3021894 114 size_t *len, int tag )
elessair 0:f269e3021894 115 {
elessair 0:f269e3021894 116 if( ( end - *p ) < 1 )
elessair 0:f269e3021894 117 return( MBEDTLS_ERR_ASN1_OUT_OF_DATA );
elessair 0:f269e3021894 118
elessair 0:f269e3021894 119 if( **p != tag )
elessair 0:f269e3021894 120 return( MBEDTLS_ERR_ASN1_UNEXPECTED_TAG );
elessair 0:f269e3021894 121
elessair 0:f269e3021894 122 (*p)++;
elessair 0:f269e3021894 123
elessair 0:f269e3021894 124 return( mbedtls_asn1_get_len( p, end, len ) );
elessair 0:f269e3021894 125 }
elessair 0:f269e3021894 126
elessair 0:f269e3021894 127 int mbedtls_asn1_get_bool( unsigned char **p,
elessair 0:f269e3021894 128 const unsigned char *end,
elessair 0:f269e3021894 129 int *val )
elessair 0:f269e3021894 130 {
elessair 0:f269e3021894 131 int ret;
elessair 0:f269e3021894 132 size_t len;
elessair 0:f269e3021894 133
elessair 0:f269e3021894 134 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, MBEDTLS_ASN1_BOOLEAN ) ) != 0 )
elessair 0:f269e3021894 135 return( ret );
elessair 0:f269e3021894 136
elessair 0:f269e3021894 137 if( len != 1 )
elessair 0:f269e3021894 138 return( MBEDTLS_ERR_ASN1_INVALID_LENGTH );
elessair 0:f269e3021894 139
elessair 0:f269e3021894 140 *val = ( **p != 0 ) ? 1 : 0;
elessair 0:f269e3021894 141 (*p)++;
elessair 0:f269e3021894 142
elessair 0:f269e3021894 143 return( 0 );
elessair 0:f269e3021894 144 }
elessair 0:f269e3021894 145
elessair 0:f269e3021894 146 int mbedtls_asn1_get_int( unsigned char **p,
elessair 0:f269e3021894 147 const unsigned char *end,
elessair 0:f269e3021894 148 int *val )
elessair 0:f269e3021894 149 {
elessair 0:f269e3021894 150 int ret;
elessair 0:f269e3021894 151 size_t len;
elessair 0:f269e3021894 152
elessair 0:f269e3021894 153 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, MBEDTLS_ASN1_INTEGER ) ) != 0 )
elessair 0:f269e3021894 154 return( ret );
elessair 0:f269e3021894 155
elessair 0:f269e3021894 156 if( len == 0 || len > sizeof( int ) || ( **p & 0x80 ) != 0 )
elessair 0:f269e3021894 157 return( MBEDTLS_ERR_ASN1_INVALID_LENGTH );
elessair 0:f269e3021894 158
elessair 0:f269e3021894 159 *val = 0;
elessair 0:f269e3021894 160
elessair 0:f269e3021894 161 while( len-- > 0 )
elessair 0:f269e3021894 162 {
elessair 0:f269e3021894 163 *val = ( *val << 8 ) | **p;
elessair 0:f269e3021894 164 (*p)++;
elessair 0:f269e3021894 165 }
elessair 0:f269e3021894 166
elessair 0:f269e3021894 167 return( 0 );
elessair 0:f269e3021894 168 }
elessair 0:f269e3021894 169
elessair 0:f269e3021894 170 #if defined(MBEDTLS_BIGNUM_C)
elessair 0:f269e3021894 171 int mbedtls_asn1_get_mpi( unsigned char **p,
elessair 0:f269e3021894 172 const unsigned char *end,
elessair 0:f269e3021894 173 mbedtls_mpi *X )
elessair 0:f269e3021894 174 {
elessair 0:f269e3021894 175 int ret;
elessair 0:f269e3021894 176 size_t len;
elessair 0:f269e3021894 177
elessair 0:f269e3021894 178 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, MBEDTLS_ASN1_INTEGER ) ) != 0 )
elessair 0:f269e3021894 179 return( ret );
elessair 0:f269e3021894 180
elessair 0:f269e3021894 181 ret = mbedtls_mpi_read_binary( X, *p, len );
elessair 0:f269e3021894 182
elessair 0:f269e3021894 183 *p += len;
elessair 0:f269e3021894 184
elessair 0:f269e3021894 185 return( ret );
elessair 0:f269e3021894 186 }
elessair 0:f269e3021894 187 #endif /* MBEDTLS_BIGNUM_C */
elessair 0:f269e3021894 188
elessair 0:f269e3021894 189 int mbedtls_asn1_get_bitstring( unsigned char **p, const unsigned char *end,
elessair 0:f269e3021894 190 mbedtls_asn1_bitstring *bs)
elessair 0:f269e3021894 191 {
elessair 0:f269e3021894 192 int ret;
elessair 0:f269e3021894 193
elessair 0:f269e3021894 194 /* Certificate type is a single byte bitstring */
elessair 0:f269e3021894 195 if( ( ret = mbedtls_asn1_get_tag( p, end, &bs->len, MBEDTLS_ASN1_BIT_STRING ) ) != 0 )
elessair 0:f269e3021894 196 return( ret );
elessair 0:f269e3021894 197
elessair 0:f269e3021894 198 /* Check length, subtract one for actual bit string length */
elessair 0:f269e3021894 199 if( bs->len < 1 )
elessair 0:f269e3021894 200 return( MBEDTLS_ERR_ASN1_OUT_OF_DATA );
elessair 0:f269e3021894 201 bs->len -= 1;
elessair 0:f269e3021894 202
elessair 0:f269e3021894 203 /* Get number of unused bits, ensure unused bits <= 7 */
elessair 0:f269e3021894 204 bs->unused_bits = **p;
elessair 0:f269e3021894 205 if( bs->unused_bits > 7 )
elessair 0:f269e3021894 206 return( MBEDTLS_ERR_ASN1_INVALID_LENGTH );
elessair 0:f269e3021894 207 (*p)++;
elessair 0:f269e3021894 208
elessair 0:f269e3021894 209 /* Get actual bitstring */
elessair 0:f269e3021894 210 bs->p = *p;
elessair 0:f269e3021894 211 *p += bs->len;
elessair 0:f269e3021894 212
elessair 0:f269e3021894 213 if( *p != end )
elessair 0:f269e3021894 214 return( MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
elessair 0:f269e3021894 215
elessair 0:f269e3021894 216 return( 0 );
elessair 0:f269e3021894 217 }
elessair 0:f269e3021894 218
elessair 0:f269e3021894 219 /*
elessair 0:f269e3021894 220 * Get a bit string without unused bits
elessair 0:f269e3021894 221 */
elessair 0:f269e3021894 222 int mbedtls_asn1_get_bitstring_null( unsigned char **p, const unsigned char *end,
elessair 0:f269e3021894 223 size_t *len )
elessair 0:f269e3021894 224 {
elessair 0:f269e3021894 225 int ret;
elessair 0:f269e3021894 226
elessair 0:f269e3021894 227 if( ( ret = mbedtls_asn1_get_tag( p, end, len, MBEDTLS_ASN1_BIT_STRING ) ) != 0 )
elessair 0:f269e3021894 228 return( ret );
elessair 0:f269e3021894 229
elessair 0:f269e3021894 230 if( (*len)-- < 2 || *(*p)++ != 0 )
elessair 0:f269e3021894 231 return( MBEDTLS_ERR_ASN1_INVALID_DATA );
elessair 0:f269e3021894 232
elessair 0:f269e3021894 233 return( 0 );
elessair 0:f269e3021894 234 }
elessair 0:f269e3021894 235
elessair 0:f269e3021894 236
elessair 0:f269e3021894 237
elessair 0:f269e3021894 238 /*
elessair 0:f269e3021894 239 * Parses and splits an ASN.1 "SEQUENCE OF <tag>"
elessair 0:f269e3021894 240 */
elessair 0:f269e3021894 241 int mbedtls_asn1_get_sequence_of( unsigned char **p,
elessair 0:f269e3021894 242 const unsigned char *end,
elessair 0:f269e3021894 243 mbedtls_asn1_sequence *cur,
elessair 0:f269e3021894 244 int tag)
elessair 0:f269e3021894 245 {
elessair 0:f269e3021894 246 int ret;
elessair 0:f269e3021894 247 size_t len;
elessair 0:f269e3021894 248 mbedtls_asn1_buf *buf;
elessair 0:f269e3021894 249
elessair 0:f269e3021894 250 /* Get main sequence tag */
elessair 0:f269e3021894 251 if( ( ret = mbedtls_asn1_get_tag( p, end, &len,
elessair 0:f269e3021894 252 MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
elessair 0:f269e3021894 253 return( ret );
elessair 0:f269e3021894 254
elessair 0:f269e3021894 255 if( *p + len != end )
elessair 0:f269e3021894 256 return( MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
elessair 0:f269e3021894 257
elessair 0:f269e3021894 258 while( *p < end )
elessair 0:f269e3021894 259 {
elessair 0:f269e3021894 260 buf = &(cur->buf);
elessair 0:f269e3021894 261 buf->tag = **p;
elessair 0:f269e3021894 262
elessair 0:f269e3021894 263 if( ( ret = mbedtls_asn1_get_tag( p, end, &buf->len, tag ) ) != 0 )
elessair 0:f269e3021894 264 return( ret );
elessair 0:f269e3021894 265
elessair 0:f269e3021894 266 buf->p = *p;
elessair 0:f269e3021894 267 *p += buf->len;
elessair 0:f269e3021894 268
elessair 0:f269e3021894 269 /* Allocate and assign next pointer */
elessair 0:f269e3021894 270 if( *p < end )
elessair 0:f269e3021894 271 {
elessair 0:f269e3021894 272 cur->next = (mbedtls_asn1_sequence*)mbedtls_calloc( 1,
elessair 0:f269e3021894 273 sizeof( mbedtls_asn1_sequence ) );
elessair 0:f269e3021894 274
elessair 0:f269e3021894 275 if( cur->next == NULL )
elessair 0:f269e3021894 276 return( MBEDTLS_ERR_ASN1_ALLOC_FAILED );
elessair 0:f269e3021894 277
elessair 0:f269e3021894 278 cur = cur->next;
elessair 0:f269e3021894 279 }
elessair 0:f269e3021894 280 }
elessair 0:f269e3021894 281
elessair 0:f269e3021894 282 /* Set final sequence entry's next pointer to NULL */
elessair 0:f269e3021894 283 cur->next = NULL;
elessair 0:f269e3021894 284
elessair 0:f269e3021894 285 if( *p != end )
elessair 0:f269e3021894 286 return( MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
elessair 0:f269e3021894 287
elessair 0:f269e3021894 288 return( 0 );
elessair 0:f269e3021894 289 }
elessair 0:f269e3021894 290
elessair 0:f269e3021894 291 int mbedtls_asn1_get_alg( unsigned char **p,
elessair 0:f269e3021894 292 const unsigned char *end,
elessair 0:f269e3021894 293 mbedtls_asn1_buf *alg, mbedtls_asn1_buf *params )
elessair 0:f269e3021894 294 {
elessair 0:f269e3021894 295 int ret;
elessair 0:f269e3021894 296 size_t len;
elessair 0:f269e3021894 297
elessair 0:f269e3021894 298 if( ( ret = mbedtls_asn1_get_tag( p, end, &len,
elessair 0:f269e3021894 299 MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
elessair 0:f269e3021894 300 return( ret );
elessair 0:f269e3021894 301
elessair 0:f269e3021894 302 if( ( end - *p ) < 1 )
elessair 0:f269e3021894 303 return( MBEDTLS_ERR_ASN1_OUT_OF_DATA );
elessair 0:f269e3021894 304
elessair 0:f269e3021894 305 alg->tag = **p;
elessair 0:f269e3021894 306 end = *p + len;
elessair 0:f269e3021894 307
elessair 0:f269e3021894 308 if( ( ret = mbedtls_asn1_get_tag( p, end, &alg->len, MBEDTLS_ASN1_OID ) ) != 0 )
elessair 0:f269e3021894 309 return( ret );
elessair 0:f269e3021894 310
elessair 0:f269e3021894 311 alg->p = *p;
elessair 0:f269e3021894 312 *p += alg->len;
elessair 0:f269e3021894 313
elessair 0:f269e3021894 314 if( *p == end )
elessair 0:f269e3021894 315 {
elessair 0:f269e3021894 316 mbedtls_zeroize( params, sizeof(mbedtls_asn1_buf) );
elessair 0:f269e3021894 317 return( 0 );
elessair 0:f269e3021894 318 }
elessair 0:f269e3021894 319
elessair 0:f269e3021894 320 params->tag = **p;
elessair 0:f269e3021894 321 (*p)++;
elessair 0:f269e3021894 322
elessair 0:f269e3021894 323 if( ( ret = mbedtls_asn1_get_len( p, end, &params->len ) ) != 0 )
elessair 0:f269e3021894 324 return( ret );
elessair 0:f269e3021894 325
elessair 0:f269e3021894 326 params->p = *p;
elessair 0:f269e3021894 327 *p += params->len;
elessair 0:f269e3021894 328
elessair 0:f269e3021894 329 if( *p != end )
elessair 0:f269e3021894 330 return( MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
elessair 0:f269e3021894 331
elessair 0:f269e3021894 332 return( 0 );
elessair 0:f269e3021894 333 }
elessair 0:f269e3021894 334
elessair 0:f269e3021894 335 int mbedtls_asn1_get_alg_null( unsigned char **p,
elessair 0:f269e3021894 336 const unsigned char *end,
elessair 0:f269e3021894 337 mbedtls_asn1_buf *alg )
elessair 0:f269e3021894 338 {
elessair 0:f269e3021894 339 int ret;
elessair 0:f269e3021894 340 mbedtls_asn1_buf params;
elessair 0:f269e3021894 341
elessair 0:f269e3021894 342 memset( &params, 0, sizeof(mbedtls_asn1_buf) );
elessair 0:f269e3021894 343
elessair 0:f269e3021894 344 if( ( ret = mbedtls_asn1_get_alg( p, end, alg, &params ) ) != 0 )
elessair 0:f269e3021894 345 return( ret );
elessair 0:f269e3021894 346
elessair 0:f269e3021894 347 if( ( params.tag != MBEDTLS_ASN1_NULL && params.tag != 0 ) || params.len != 0 )
elessair 0:f269e3021894 348 return( MBEDTLS_ERR_ASN1_INVALID_DATA );
elessair 0:f269e3021894 349
elessair 0:f269e3021894 350 return( 0 );
elessair 0:f269e3021894 351 }
elessair 0:f269e3021894 352
elessair 0:f269e3021894 353 void mbedtls_asn1_free_named_data( mbedtls_asn1_named_data *cur )
elessair 0:f269e3021894 354 {
elessair 0:f269e3021894 355 if( cur == NULL )
elessair 0:f269e3021894 356 return;
elessair 0:f269e3021894 357
elessair 0:f269e3021894 358 mbedtls_free( cur->oid.p );
elessair 0:f269e3021894 359 mbedtls_free( cur->val.p );
elessair 0:f269e3021894 360
elessair 0:f269e3021894 361 mbedtls_zeroize( cur, sizeof( mbedtls_asn1_named_data ) );
elessair 0:f269e3021894 362 }
elessair 0:f269e3021894 363
elessair 0:f269e3021894 364 void mbedtls_asn1_free_named_data_list( mbedtls_asn1_named_data **head )
elessair 0:f269e3021894 365 {
elessair 0:f269e3021894 366 mbedtls_asn1_named_data *cur;
elessair 0:f269e3021894 367
elessair 0:f269e3021894 368 while( ( cur = *head ) != NULL )
elessair 0:f269e3021894 369 {
elessair 0:f269e3021894 370 *head = cur->next;
elessair 0:f269e3021894 371 mbedtls_asn1_free_named_data( cur );
elessair 0:f269e3021894 372 mbedtls_free( cur );
elessair 0:f269e3021894 373 }
elessair 0:f269e3021894 374 }
elessair 0:f269e3021894 375
elessair 0:f269e3021894 376 mbedtls_asn1_named_data *mbedtls_asn1_find_named_data( mbedtls_asn1_named_data *list,
elessair 0:f269e3021894 377 const char *oid, size_t len )
elessair 0:f269e3021894 378 {
elessair 0:f269e3021894 379 while( list != NULL )
elessair 0:f269e3021894 380 {
elessair 0:f269e3021894 381 if( list->oid.len == len &&
elessair 0:f269e3021894 382 memcmp( list->oid.p, oid, len ) == 0 )
elessair 0:f269e3021894 383 {
elessair 0:f269e3021894 384 break;
elessair 0:f269e3021894 385 }
elessair 0:f269e3021894 386
elessair 0:f269e3021894 387 list = list->next;
elessair 0:f269e3021894 388 }
elessair 0:f269e3021894 389
elessair 0:f269e3021894 390 return( list );
elessair 0:f269e3021894 391 }
elessair 0:f269e3021894 392
elessair 0:f269e3021894 393 #endif /* MBEDTLS_ASN1_PARSE_C */