2018-11-16 09:44:30 +08:00
|
|
|
/*
|
2021-02-18 22:57:13 +08:00
|
|
|
* Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
|
2018-11-16 09:44:30 +08:00
|
|
|
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
2019-09-28 06:45:57 +08:00
|
|
|
#ifndef OSSL_INTERNAL_PROPERTY_H
|
|
|
|
# define OSSL_INTERNAL_PROPERTY_H
|
2021-02-07 05:14:03 +08:00
|
|
|
# pragma once
|
2018-11-16 09:44:30 +08:00
|
|
|
|
2021-02-07 05:14:03 +08:00
|
|
|
# include "internal/cryptlib.h"
|
2019-05-01 18:02:43 +08:00
|
|
|
|
2018-11-16 09:44:30 +08:00
|
|
|
typedef struct ossl_method_store_st OSSL_METHOD_STORE;
|
2019-11-19 21:17:04 +08:00
|
|
|
typedef struct ossl_property_list_st OSSL_PROPERTY_LIST;
|
2018-11-16 09:44:30 +08:00
|
|
|
|
2019-08-14 22:00:35 +08:00
|
|
|
/* Initialisation */
|
2020-10-15 17:55:50 +08:00
|
|
|
int ossl_property_parse_init(OSSL_LIB_CTX *ctx);
|
2019-08-14 22:00:35 +08:00
|
|
|
|
2019-11-19 21:17:04 +08:00
|
|
|
/* Property definition parser */
|
2020-10-15 17:55:50 +08:00
|
|
|
OSSL_PROPERTY_LIST *ossl_parse_property(OSSL_LIB_CTX *ctx, const char *defn);
|
2019-11-19 21:17:04 +08:00
|
|
|
/* Property query parser */
|
2021-03-13 08:34:49 +08:00
|
|
|
OSSL_PROPERTY_LIST *ossl_parse_query(OSSL_LIB_CTX *ctx, const char *s,
|
|
|
|
int create_values);
|
2019-11-19 21:17:04 +08:00
|
|
|
/* Property checker of query vs definition */
|
|
|
|
int ossl_property_match_count(const OSSL_PROPERTY_LIST *query,
|
|
|
|
const OSSL_PROPERTY_LIST *defn);
|
2020-10-15 17:55:50 +08:00
|
|
|
int ossl_property_is_enabled(OSSL_LIB_CTX *ctx, const char *property_name,
|
2020-05-02 12:17:54 +08:00
|
|
|
const OSSL_PROPERTY_LIST *prop_list);
|
Redesign the KEYMGMT libcrypto <-> provider interface - the basics
The KEYMGMT libcrypto <-> provider interface currently makes a few
assumptions:
1. provider side domain parameters and key data isn't mutable. In
other words, as soon as a key has been created in any (loaded,
imported data, ...), it's set in stone.
2. provider side domain parameters can be strictly separated from the
key data.
This does work for the most part, but there are places where that's a
bit too rigid for the functionality that the EVP_PKEY API delivers.
Key data needs to be mutable to allow the flexibility that functions
like EVP_PKEY_copy_parameters promise, as well as to provide the
combinations of data that an EVP_PKEY is generally assumed to be able
to hold:
- domain parameters only
- public key only
- public key + private key
- domain parameters + public key
- domain parameters + public key + private key
To remedy all this, we:
1. let go of the distinction between domain parameters and key
material proper in the libcrypto <-> provider interface.
As a consequence, functions that still need it gain a selection
argument, which is a set of bits that indicate what parts of the
key object are to be considered in a specific call. This allows
a reduction of very similar functions into one.
2. Rework the libcrypto <-> provider interface so provider side key
objects are created and destructed with a separate function, and
get their data filled and extracted in through import and export.
(future work will see other key object constructors and other
functions to fill them with data)
Fixes #10979
squash! Redesign the KEYMGMT libcrypto <-> provider interface - the basics
Remedy 1 needs a rewrite:
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11006)
2020-02-03 01:56:07 +08:00
|
|
|
/* Free a parsed property list */
|
|
|
|
void ossl_property_free(OSSL_PROPERTY_LIST *p);
|
|
|
|
|
2019-11-19 21:17:04 +08:00
|
|
|
|
2018-11-16 09:44:30 +08:00
|
|
|
/* Implementation store functions */
|
2020-10-15 17:55:50 +08:00
|
|
|
OSSL_METHOD_STORE *ossl_method_store_new(OSSL_LIB_CTX *ctx);
|
2018-11-16 09:44:30 +08:00
|
|
|
void ossl_method_store_free(OSSL_METHOD_STORE *store);
|
2019-08-21 16:08:44 +08:00
|
|
|
int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov,
|
|
|
|
int nid, const char *properties, void *method,
|
|
|
|
int (*method_up_ref)(void *),
|
|
|
|
void (*method_destruct)(void *));
|
|
|
|
int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid,
|
|
|
|
const void *method);
|
2018-11-16 09:44:30 +08:00
|
|
|
int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
|
2020-06-12 08:34:46 +08:00
|
|
|
const char *prop_query, void **method);
|
|
|
|
|
|
|
|
/* Get the global properties associate with the specified library context */
|
2020-10-15 17:55:50 +08:00
|
|
|
OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *ctx,
|
|
|
|
int loadconfig);
|
2018-11-16 09:44:30 +08:00
|
|
|
|
2019-07-02 16:04:04 +08:00
|
|
|
/* property query cache functions */
|
2018-11-16 09:44:30 +08:00
|
|
|
int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, int nid,
|
|
|
|
const char *prop_query, void **result);
|
|
|
|
int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, int nid,
|
2019-11-11 09:17:32 +08:00
|
|
|
const char *prop_query, void *result,
|
|
|
|
int (*method_up_ref)(void *),
|
|
|
|
void (*method_destruct)(void *));
|
2020-08-09 16:06:52 +08:00
|
|
|
|
2021-03-30 08:29:01 +08:00
|
|
|
__owur int ossl_method_store_flush_cache(OSSL_METHOD_STORE *store, int all);
|
2020-06-12 08:34:46 +08:00
|
|
|
|
|
|
|
/* Merge two property queries together */
|
|
|
|
OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
|
|
|
|
const OSSL_PROPERTY_LIST *b);
|
|
|
|
|
2018-11-16 09:44:30 +08:00
|
|
|
#endif
|