serializer_local.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #include <openssl/core_dispatch.h>
  10. #include <openssl/types.h>
  11. #include "internal/cryptlib.h"
  12. #include "internal/refcount.h"
  13. struct ossl_serializer_st {
  14. OSSL_PROVIDER *prov;
  15. int id;
  16. const char *propdef;
  17. CRYPTO_REF_COUNT refcnt;
  18. CRYPTO_RWLOCK *lock;
  19. OSSL_FUNC_serializer_newctx_fn *newctx;
  20. OSSL_FUNC_serializer_freectx_fn *freectx;
  21. OSSL_FUNC_serializer_set_ctx_params_fn *set_ctx_params;
  22. OSSL_FUNC_serializer_settable_ctx_params_fn *settable_ctx_params;
  23. OSSL_FUNC_serializer_serialize_data_fn *serialize_data;
  24. OSSL_FUNC_serializer_serialize_object_fn *serialize_object;
  25. };
  26. struct ossl_serializer_ctx_st {
  27. OSSL_SERIALIZER *ser;
  28. void *serctx;
  29. int selection;
  30. /*
  31. * |object| is the libcrypto object to handle.
  32. * |do_output| must have intimate knowledge of this object.
  33. */
  34. const void *object;
  35. int (*do_output)(OSSL_SERIALIZER_CTX *ctx, BIO *out);
  36. /* For any function that needs a passphrase reader */
  37. const UI_METHOD *ui_method;
  38. void *ui_data;
  39. /*
  40. * if caller used OSSL_SERIALIZER_CTX_set_passphrase_cb(), we need
  41. * intermediary storage.
  42. */
  43. UI_METHOD *allocated_ui_method;
  44. };