1/* 2 * Copyright 2019-2020 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#ifndef OSSL_PROV_PROVIDER_CTX_H 11# define OSSL_PROV_PROVIDER_CTX_H 12 13# include <openssl/types.h> 14# include <openssl/crypto.h> 15# include <openssl/bio.h> 16# include <openssl/core.h> 17 18typedef struct prov_ctx_st { 19 const OSSL_CORE_HANDLE *handle; 20 OSSL_LIB_CTX *libctx; /* For all provider modules */ 21 BIO_METHOD *corebiometh; 22} PROV_CTX; 23 24/* 25 * To be used anywhere the library context needs to be passed, such as to 26 * fetching functions. 27 */ 28# define PROV_LIBCTX_OF(provctx) \ 29 ossl_prov_ctx_get0_libctx((provctx)) 30 31PROV_CTX *ossl_prov_ctx_new(void); 32void ossl_prov_ctx_free(PROV_CTX *ctx); 33void ossl_prov_ctx_set0_libctx(PROV_CTX *ctx, OSSL_LIB_CTX *libctx); 34void ossl_prov_ctx_set0_handle(PROV_CTX *ctx, const OSSL_CORE_HANDLE *handle); 35void ossl_prov_ctx_set0_core_bio_method(PROV_CTX *ctx, BIO_METHOD *corebiometh); 36OSSL_LIB_CTX *ossl_prov_ctx_get0_libctx(PROV_CTX *ctx); 37const OSSL_CORE_HANDLE *ossl_prov_ctx_get0_handle(PROV_CTX *ctx); 38BIO_METHOD *ossl_prov_ctx_get0_core_bio_method(PROV_CTX *ctx); 39 40#endif 41