Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openssl/openssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-05-04 13:55:32 +0300
committerRichard Levitte <levitte@openssl.org>2019-05-12 23:43:38 +0300
commitf2182a4e6fef098014117eb4a4f35ca84cd2cf8e (patch)
tree9559cb125e86e497fe3baa042f9741d2fc1ca789 /include/internal
parentffa9bff8a2024bc8e6322be2cbff7d17fb8d828d (diff)
Create internal number<->name mapping API
This can be used as a general name to identity map. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8878)
Diffstat (limited to 'include/internal')
-rw-r--r--include/internal/cryptlib.h3
-rw-r--r--include/internal/namemap.h21
2 files changed, 23 insertions, 1 deletions
diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
index 46b5d344a4..1ce822dd1e 100644
--- a/include/internal/cryptlib.h
+++ b/include/internal/cryptlib.h
@@ -145,7 +145,8 @@ typedef struct ossl_ex_data_global_st {
# define OPENSSL_CTX_PROVIDER_STORE_INDEX 1
# define OPENSSL_CTX_PROPERTY_DEFN_INDEX 2
# define OPENSSL_CTX_PROPERTY_STRING_INDEX 3
-# define OPENSSL_CTX_MAX_INDEXES 4
+# define OPENSSL_CTX_NAMEMAP_INDEX 4
+# define OPENSSL_CTX_MAX_INDEXES 5
typedef struct openssl_ctx_method {
void *(*new_func)(OPENSSL_CTX *ctx);
diff --git a/include/internal/namemap.h b/include/internal/namemap.h
new file mode 100644
index 0000000000..30028182fd
--- /dev/null
+++ b/include/internal/namemap.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (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 "internal/cryptlib.h"
+
+typedef struct ossl_namemap_st OSSL_NAMEMAP;
+
+OSSL_NAMEMAP *ossl_namemap_stored(OPENSSL_CTX *libctx);
+
+OSSL_NAMEMAP *ossl_namemap_new(void);
+void ossl_namemap_free(OSSL_NAMEMAP *namemap);
+
+int ossl_namemap_add(OSSL_NAMEMAP *namemap, const char *name);
+const char *ossl_namemap_name(const OSSL_NAMEMAP *namemap, int number);
+int ossl_namemap_number(const OSSL_NAMEMAP *namemap, const char *name);