xref: /openssl/crypto/asn1/asn1_item_list.c (revision 7ed6de99)
1 /*
2  * Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 /* We need to use the low level ASN1 items until they are removed */
11 #define OPENSSL_SUPPRESS_DEPRECATED
12 
13 #include <stdio.h>
14 #include "internal/cryptlib.h"
15 #include <openssl/asn1.h>
16 #include <openssl/asn1t.h>
17 #include <openssl/cms.h>
18 #include <openssl/dh.h>
19 #include <openssl/ocsp.h>
20 #include <openssl/pkcs7.h>
21 #include <openssl/pkcs12.h>
22 #include <openssl/rsa.h>
23 #include <openssl/x509v3.h>
24 #include <openssl/x509_acert.h>
25 
26 #include "asn1_item_list.h"
27 
ASN1_ITEM_lookup(const char * name)28 const ASN1_ITEM *ASN1_ITEM_lookup(const char *name)
29 {
30     size_t i;
31 
32     for (i = 0; i < OSSL_NELEM(asn1_item_list); i++) {
33         const ASN1_ITEM *it = ASN1_ITEM_ptr(asn1_item_list[i]);
34 
35         if (strcmp(it->sname, name) == 0)
36             return it;
37     }
38     return NULL;
39 }
40 
ASN1_ITEM_get(size_t i)41 const ASN1_ITEM *ASN1_ITEM_get(size_t i)
42 {
43     if (i >= OSSL_NELEM(asn1_item_list))
44         return NULL;
45     return ASN1_ITEM_ptr(asn1_item_list[i]);
46 }
47