Print <ABSENT> if a STACK is NULL.
[openssl.git] / crypto / asn1 / asn1_item_list.c
1 /*
2  * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (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 #include <stdio.h>
11 #include "internal/cryptlib.h"
12 #include <openssl/asn1.h>
13 #include <openssl/asn1t.h>
14 #include <openssl/cms.h>
15 #include <openssl/ocsp.h>
16 #include <openssl/pkcs7.h>
17 #include <openssl/pkcs12.h>
18 #include <openssl/x509v3.h>
19
20 #include "asn1_item_list.h"
21
22 const ASN1_ITEM *ASN1_ITEM_lookup(const char *name)
23 {
24     size_t i;
25
26     for (i = 0; i < OSSL_NELEM(asn1_item_list); i++) {
27         const ASN1_ITEM *it = ASN1_ITEM_ptr(asn1_item_list[i]);
28
29         if (strcmp(it->sname, name) == 0)
30             return it;
31     }
32     return NULL;
33 }
34
35 const ASN1_ITEM *ASN1_ITEM_get(size_t i)
36 {
37     if (i >= OSSL_NELEM(asn1_item_list))
38         return NULL;
39     return ASN1_ITEM_ptr(asn1_item_list[i]);
40 }