2
0

provider_ctx.h 1.3 KB

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