From 072bfcc90b6f7c206e39339da519567c4460250c Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Sat, 11 Feb 2017 02:33:18 +0100 Subject: STORE: Add the possibility to specify an expected info type Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/2688) --- include/openssl/store.h | 9 +++++++++ include/openssl/storeerr.h | 2 ++ 2 files changed, 11 insertions(+) (limited to 'include') diff --git a/include/openssl/store.h b/include/openssl/store.h index ff42953e6c..d4222512f7 100644 --- a/include/openssl/store.h +++ b/include/openssl/store.h @@ -151,6 +151,12 @@ const char *OSSL_STORE_INFO_type_string(int type); */ void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info); +/* + * Add expected return type (which can be unspecified) to the loading channel. + * This MUST happen before the first STORE_load(). + */ +int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type); + /*- * Function to register a loader for the given URI scheme. @@ -177,6 +183,9 @@ typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd, va_list args); int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader, OSSL_STORE_ctrl_fn ctrl_function); +typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected); +int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader, + OSSL_STORE_expect_fn expect_function); typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx, const UI_METHOD *ui_method, void *ui_data); diff --git a/include/openssl/storeerr.h b/include/openssl/storeerr.h index 5476d007bd..864a9070e3 100644 --- a/include/openssl/storeerr.h +++ b/include/openssl/storeerr.h @@ -26,6 +26,7 @@ int ERR_load_OSSL_STORE_strings(void); # define OSSL_STORE_F_FILE_NAME_TO_URI 126 # define OSSL_STORE_F_FILE_OPEN 120 # define OSSL_STORE_F_OSSL_STORE_ATTACH_PEM_BIO 127 +# define OSSL_STORE_F_OSSL_STORE_EXPECT 130 # define OSSL_STORE_F_OSSL_STORE_FILE_ATTACH_PEM_BIO_INT 128 # define OSSL_STORE_F_OSSL_STORE_GET0_LOADER_INT 100 # define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CERT 101 @@ -60,6 +61,7 @@ int ERR_load_OSSL_STORE_strings(void); # define OSSL_STORE_R_INVALID_SCHEME 106 # define OSSL_STORE_R_IS_NOT_A 112 # define OSSL_STORE_R_LOADER_INCOMPLETE 116 +# define OSSL_STORE_R_LOADING_STARTED 117 # define OSSL_STORE_R_NOT_A_CERTIFICATE 100 # define OSSL_STORE_R_NOT_A_CRL 101 # define OSSL_STORE_R_NOT_A_KEY 102 -- cgit v1.2.3