1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * 4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci */ 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci#ifndef OSSL_PROV_PROVIDER_CTX_H 11e1051a39Sopenharmony_ci# define OSSL_PROV_PROVIDER_CTX_H 12e1051a39Sopenharmony_ci 13e1051a39Sopenharmony_ci# include <openssl/types.h> 14e1051a39Sopenharmony_ci# include <openssl/crypto.h> 15e1051a39Sopenharmony_ci# include <openssl/bio.h> 16e1051a39Sopenharmony_ci# include <openssl/core.h> 17e1051a39Sopenharmony_ci 18e1051a39Sopenharmony_citypedef struct prov_ctx_st { 19e1051a39Sopenharmony_ci const OSSL_CORE_HANDLE *handle; 20e1051a39Sopenharmony_ci OSSL_LIB_CTX *libctx; /* For all provider modules */ 21e1051a39Sopenharmony_ci BIO_METHOD *corebiometh; 22e1051a39Sopenharmony_ci} PROV_CTX; 23e1051a39Sopenharmony_ci 24e1051a39Sopenharmony_ci/* 25e1051a39Sopenharmony_ci * To be used anywhere the library context needs to be passed, such as to 26e1051a39Sopenharmony_ci * fetching functions. 27e1051a39Sopenharmony_ci */ 28e1051a39Sopenharmony_ci# define PROV_LIBCTX_OF(provctx) \ 29e1051a39Sopenharmony_ci ossl_prov_ctx_get0_libctx((provctx)) 30e1051a39Sopenharmony_ci 31e1051a39Sopenharmony_ciPROV_CTX *ossl_prov_ctx_new(void); 32e1051a39Sopenharmony_civoid ossl_prov_ctx_free(PROV_CTX *ctx); 33e1051a39Sopenharmony_civoid ossl_prov_ctx_set0_libctx(PROV_CTX *ctx, OSSL_LIB_CTX *libctx); 34e1051a39Sopenharmony_civoid ossl_prov_ctx_set0_handle(PROV_CTX *ctx, const OSSL_CORE_HANDLE *handle); 35e1051a39Sopenharmony_civoid ossl_prov_ctx_set0_core_bio_method(PROV_CTX *ctx, BIO_METHOD *corebiometh); 36e1051a39Sopenharmony_ciOSSL_LIB_CTX *ossl_prov_ctx_get0_libctx(PROV_CTX *ctx); 37e1051a39Sopenharmony_ciconst OSSL_CORE_HANDLE *ossl_prov_ctx_get0_handle(PROV_CTX *ctx); 38e1051a39Sopenharmony_ciBIO_METHOD *ossl_prov_ctx_get0_core_bio_method(PROV_CTX *ctx); 39e1051a39Sopenharmony_ci 40e1051a39Sopenharmony_ci#endif 41