summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/asn1_item_list.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-09-27 21:15:57 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-09-29 16:21:45 +0100
commit56501ebd09316941a6deba111e33ccc166641b25 (patch)
treef6854b9508d29e48df3818e5213a4f01ca2b108d /crypto/asn1/asn1_item_list.c
parent83ae4661315d3d0ad52ddaa8fa5c8f1055c6c6f6 (diff)
Add ASN1_ITEM lookup and enumerate functions.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/asn1/asn1_item_list.c')
-rw-r--r--crypto/asn1/asn1_item_list.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/crypto/asn1/asn1_item_list.c b/crypto/asn1/asn1_item_list.c
new file mode 100644
index 0000000000..eaeb34fcc9
--- /dev/null
+++ b/crypto/asn1/asn1_item_list.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <stdio.h>
+#include "internal/cryptlib.h"
+#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
+#include <openssl/cms.h>
+#include <openssl/ocsp.h>
+#include <openssl/pkcs7.h>
+#include <openssl/pkcs12.h>
+#include <openssl/x509v3.h>
+
+#include "asn1_item_list.h"
+
+const ASN1_ITEM *ASN1_ITEM_lookup(const char *name)
+{
+ size_t i;
+
+ for (i = 0; i < OSSL_NELEM(asn1_item_list); i++) {
+ const ASN1_ITEM *it = ASN1_ITEM_ptr(asn1_item_list[i]);
+
+ if (strcmp(it->sname, name) == 0)
+ return it;
+ }
+ return NULL;
+}
+
+const ASN1_ITEM *ASN1_ITEM_get(size_t i)
+{
+ if (i >= OSSL_NELEM(asn1_item_list))
+ return NULL;
+ return ASN1_ITEM_ptr(asn1_item_list[i]);
+}