property_local.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #include <openssl/crypto.h>
  11. #include "internal/property.h"
  12. typedef int OSSL_PROPERTY_IDX;
  13. typedef enum {
  14. OSSL_PROPERTY_OPER_EQ, OSSL_PROPERTY_OPER_NE, OSSL_PROPERTY_OVERRIDE
  15. } OSSL_PROPERTY_OPER;
  16. struct ossl_property_definition_st {
  17. OSSL_PROPERTY_IDX name_idx;
  18. OSSL_PROPERTY_TYPE type;
  19. OSSL_PROPERTY_OPER oper;
  20. unsigned int optional : 1;
  21. union {
  22. int64_t int_val; /* Signed integer */
  23. OSSL_PROPERTY_IDX str_val; /* String */
  24. } v;
  25. };
  26. struct ossl_property_list_st {
  27. int num_properties;
  28. unsigned int has_optional : 1;
  29. OSSL_PROPERTY_DEFINITION properties[1];
  30. };
  31. #define OSSL_PROPERTY_TRUE 1
  32. #define OSSL_PROPERTY_FALSE 2
  33. /* Property string functions */
  34. OSSL_PROPERTY_IDX ossl_property_name(OSSL_LIB_CTX *ctx, const char *s,
  35. int create);
  36. const char *ossl_property_name_str(OSSL_LIB_CTX *ctx, OSSL_PROPERTY_IDX idx);
  37. OSSL_PROPERTY_IDX ossl_property_value(OSSL_LIB_CTX *ctx, const char *s,
  38. int create);
  39. const char *ossl_property_value_str(OSSL_LIB_CTX *ctx, OSSL_PROPERTY_IDX idx);
  40. /* Property list functions */
  41. void ossl_property_free(OSSL_PROPERTY_LIST *p);
  42. int ossl_property_has_optional(const OSSL_PROPERTY_LIST *query);
  43. /* Property definition cache functions */
  44. OSSL_PROPERTY_LIST *ossl_prop_defn_get(OSSL_LIB_CTX *ctx, const char *prop);
  45. int ossl_prop_defn_set(OSSL_LIB_CTX *ctx, const char *prop,
  46. OSSL_PROPERTY_LIST *pl);