property.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
  3. * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  4. *
  5. * Licensed under the Apache License 2.0 (the "License"). You may not use
  6. * this file except in compliance with the License. You can obtain a copy
  7. * in the file LICENSE in the source distribution or at
  8. * https://www.openssl.org/source/license.html
  9. */
  10. #ifndef OSSL_INTERNAL_PROPERTY_H
  11. # define OSSL_INTERNAL_PROPERTY_H
  12. # pragma once
  13. # include "internal/cryptlib.h"
  14. typedef struct ossl_method_store_st OSSL_METHOD_STORE;
  15. typedef struct ossl_property_list_st OSSL_PROPERTY_LIST;
  16. /* Initialisation */
  17. int ossl_property_parse_init(OSSL_LIB_CTX *ctx);
  18. /* Property definition parser */
  19. OSSL_PROPERTY_LIST *ossl_parse_property(OSSL_LIB_CTX *ctx, const char *defn);
  20. /* Property query parser */
  21. OSSL_PROPERTY_LIST *ossl_parse_query(OSSL_LIB_CTX *ctx, const char *s,
  22. int create_values);
  23. /* Property checker of query vs definition */
  24. int ossl_property_match_count(const OSSL_PROPERTY_LIST *query,
  25. const OSSL_PROPERTY_LIST *defn);
  26. int ossl_property_is_enabled(OSSL_LIB_CTX *ctx, const char *property_name,
  27. const OSSL_PROPERTY_LIST *prop_list);
  28. /* Free a parsed property list */
  29. void ossl_property_free(OSSL_PROPERTY_LIST *p);
  30. /* Implementation store functions */
  31. OSSL_METHOD_STORE *ossl_method_store_new(OSSL_LIB_CTX *ctx);
  32. void ossl_method_store_free(OSSL_METHOD_STORE *store);
  33. int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov,
  34. int nid, const char *properties, void *method,
  35. int (*method_up_ref)(void *),
  36. void (*method_destruct)(void *));
  37. int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid,
  38. const void *method);
  39. int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
  40. const char *prop_query, void **method);
  41. /* Get the global properties associate with the specified library context */
  42. OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *ctx,
  43. int loadconfig);
  44. /* property query cache functions */
  45. int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, int nid,
  46. const char *prop_query, void **result);
  47. int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, int nid,
  48. const char *prop_query, void *result,
  49. int (*method_up_ref)(void *),
  50. void (*method_destruct)(void *));
  51. __owur int ossl_method_store_flush_cache(OSSL_METHOD_STORE *store, int all);
  52. /* Merge two property queries together */
  53. OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
  54. const OSSL_PROPERTY_LIST *b);
  55. size_t ossl_property_list_to_string(OSSL_LIB_CTX *ctx,
  56. const OSSL_PROPERTY_LIST *list, char *buf,
  57. size_t bufsize);
  58. int ossl_global_properties_no_mirrored(OSSL_LIB_CTX *libctx);
  59. void ossl_global_properties_stop_mirroring(OSSL_LIB_CTX *libctx);
  60. #endif