Home | History | Annotate | Line # | Download | only in internal
      1      1.1  christos /*
      2      1.1  christos  * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
      3      1.1  christos  * Copyright (c) 2019, Oracle and/or its affiliates.  All rights reserved.
      4      1.1  christos  *
      5      1.1  christos  * Licensed under the Apache License 2.0 (the "License").  You may not use
      6      1.1  christos  * this file except in compliance with the License.  You can obtain a copy
      7      1.1  christos  * in the file LICENSE in the source distribution or at
      8      1.1  christos  * https://www.openssl.org/source/license.html
      9      1.1  christos  */
     10      1.1  christos 
     11      1.1  christos #ifndef OSSL_INTERNAL_PROPERTY_H
     12  1.1.1.2  christos #define OSSL_INTERNAL_PROPERTY_H
     13  1.1.1.2  christos #pragma once
     14      1.1  christos 
     15  1.1.1.2  christos #include "internal/cryptlib.h"
     16      1.1  christos 
     17      1.1  christos typedef struct ossl_method_store_st OSSL_METHOD_STORE;
     18      1.1  christos typedef struct ossl_property_list_st OSSL_PROPERTY_LIST;
     19      1.1  christos 
     20      1.1  christos typedef enum {
     21  1.1.1.2  christos     OSSL_PROPERTY_TYPE_STRING,
     22  1.1.1.2  christos     OSSL_PROPERTY_TYPE_NUMBER,
     23      1.1  christos     OSSL_PROPERTY_TYPE_VALUE_UNDEFINED
     24      1.1  christos } OSSL_PROPERTY_TYPE;
     25      1.1  christos typedef struct ossl_property_definition_st OSSL_PROPERTY_DEFINITION;
     26      1.1  christos 
     27      1.1  christos /* Initialisation */
     28      1.1  christos int ossl_property_parse_init(OSSL_LIB_CTX *ctx);
     29      1.1  christos 
     30      1.1  christos /* Property definition parser */
     31      1.1  christos OSSL_PROPERTY_LIST *ossl_parse_property(OSSL_LIB_CTX *ctx, const char *defn);
     32      1.1  christos /* Property query parser */
     33      1.1  christos OSSL_PROPERTY_LIST *ossl_parse_query(OSSL_LIB_CTX *ctx, const char *s,
     34  1.1.1.2  christos     int create_values);
     35      1.1  christos /* Property checker of query vs definition */
     36      1.1  christos int ossl_property_match_count(const OSSL_PROPERTY_LIST *query,
     37  1.1.1.2  christos     const OSSL_PROPERTY_LIST *defn);
     38  1.1.1.2  christos int ossl_property_is_enabled(OSSL_LIB_CTX *ctx, const char *property_name,
     39  1.1.1.2  christos     const OSSL_PROPERTY_LIST *prop_list);
     40      1.1  christos /* Free a parsed property list */
     41      1.1  christos void ossl_property_free(OSSL_PROPERTY_LIST *p);
     42      1.1  christos 
     43      1.1  christos /* Get a property from a property list */
     44      1.1  christos const OSSL_PROPERTY_DEFINITION *
     45      1.1  christos ossl_property_find_property(const OSSL_PROPERTY_LIST *list,
     46  1.1.1.2  christos     OSSL_LIB_CTX *libctx, const char *name);
     47      1.1  christos OSSL_PROPERTY_TYPE ossl_property_get_type(const OSSL_PROPERTY_DEFINITION *prop);
     48      1.1  christos const char *ossl_property_get_string_value(OSSL_LIB_CTX *libctx,
     49  1.1.1.2  christos     const OSSL_PROPERTY_DEFINITION *prop);
     50      1.1  christos int64_t ossl_property_get_number_value(const OSSL_PROPERTY_DEFINITION *prop);
     51      1.1  christos 
     52      1.1  christos /* Implementation store functions */
     53      1.1  christos OSSL_METHOD_STORE *ossl_method_store_new(OSSL_LIB_CTX *ctx);
     54      1.1  christos void ossl_method_store_free(OSSL_METHOD_STORE *store);
     55      1.1  christos 
     56      1.1  christos int ossl_method_lock_store(OSSL_METHOD_STORE *store);
     57      1.1  christos int ossl_method_unlock_store(OSSL_METHOD_STORE *store);
     58      1.1  christos 
     59      1.1  christos int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov,
     60  1.1.1.2  christos     int nid, const char *properties, void *method,
     61  1.1.1.2  christos     int (*method_up_ref)(void *),
     62  1.1.1.2  christos     void (*method_destruct)(void *));
     63      1.1  christos int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid,
     64  1.1.1.2  christos     const void *method);
     65      1.1  christos void ossl_method_store_do_all(OSSL_METHOD_STORE *store,
     66  1.1.1.2  christos     void (*fn)(int id, void *method, void *fnarg),
     67  1.1.1.2  christos     void *fnarg);
     68      1.1  christos int ossl_method_store_fetch(OSSL_METHOD_STORE *store,
     69  1.1.1.2  christos     int nid, const char *prop_query,
     70  1.1.1.2  christos     const OSSL_PROVIDER **prov, void **method);
     71      1.1  christos int ossl_method_store_remove_all_provided(OSSL_METHOD_STORE *store,
     72  1.1.1.2  christos     const OSSL_PROVIDER *prov);
     73      1.1  christos 
     74      1.1  christos /* Get the global properties associate with the specified library context */
     75      1.1  christos OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *ctx,
     76  1.1.1.2  christos     int loadconfig);
     77      1.1  christos 
     78      1.1  christos /* property query cache functions */
     79      1.1  christos int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,
     80  1.1.1.2  christos     int nid, const char *prop_query, void **result);
     81      1.1  christos int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,
     82  1.1.1.2  christos     int nid, const char *prop_query, void *result,
     83  1.1.1.2  christos     int (*method_up_ref)(void *),
     84  1.1.1.2  christos     void (*method_destruct)(void *));
     85      1.1  christos 
     86      1.1  christos __owur int ossl_method_store_cache_flush_all(OSSL_METHOD_STORE *store);
     87      1.1  christos 
     88      1.1  christos /* Merge two property queries together */
     89      1.1  christos OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
     90  1.1.1.2  christos     const OSSL_PROPERTY_LIST *b);
     91      1.1  christos 
     92      1.1  christos size_t ossl_property_list_to_string(OSSL_LIB_CTX *ctx,
     93  1.1.1.2  christos     const OSSL_PROPERTY_LIST *list, char *buf,
     94  1.1.1.2  christos     size_t bufsize);
     95      1.1  christos 
     96      1.1  christos int ossl_global_properties_no_mirrored(OSSL_LIB_CTX *libctx);
     97      1.1  christos void ossl_global_properties_stop_mirroring(OSSL_LIB_CTX *libctx);
     98      1.1  christos 
     99      1.1  christos #endif
    100