1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 4e1051a39Sopenharmony_ci * 5e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 6e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 7e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 8e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 9e1051a39Sopenharmony_ci */ 10e1051a39Sopenharmony_ci 11e1051a39Sopenharmony_ci#include <openssl/crypto.h> 12e1051a39Sopenharmony_ci#include "internal/property.h" 13e1051a39Sopenharmony_ci 14e1051a39Sopenharmony_citypedef int OSSL_PROPERTY_IDX; 15e1051a39Sopenharmony_ci 16e1051a39Sopenharmony_citypedef enum { 17e1051a39Sopenharmony_ci OSSL_PROPERTY_OPER_EQ, OSSL_PROPERTY_OPER_NE, OSSL_PROPERTY_OVERRIDE 18e1051a39Sopenharmony_ci} OSSL_PROPERTY_OPER; 19e1051a39Sopenharmony_ci 20e1051a39Sopenharmony_cistruct ossl_property_definition_st { 21e1051a39Sopenharmony_ci OSSL_PROPERTY_IDX name_idx; 22e1051a39Sopenharmony_ci OSSL_PROPERTY_TYPE type; 23e1051a39Sopenharmony_ci OSSL_PROPERTY_OPER oper; 24e1051a39Sopenharmony_ci unsigned int optional : 1; 25e1051a39Sopenharmony_ci union { 26e1051a39Sopenharmony_ci int64_t int_val; /* Signed integer */ 27e1051a39Sopenharmony_ci OSSL_PROPERTY_IDX str_val; /* String */ 28e1051a39Sopenharmony_ci } v; 29e1051a39Sopenharmony_ci}; 30e1051a39Sopenharmony_ci 31e1051a39Sopenharmony_cistruct ossl_property_list_st { 32e1051a39Sopenharmony_ci int num_properties; 33e1051a39Sopenharmony_ci unsigned int has_optional : 1; 34e1051a39Sopenharmony_ci OSSL_PROPERTY_DEFINITION properties[1]; 35e1051a39Sopenharmony_ci}; 36e1051a39Sopenharmony_ci 37e1051a39Sopenharmony_ci#define OSSL_PROPERTY_TRUE 1 38e1051a39Sopenharmony_ci#define OSSL_PROPERTY_FALSE 2 39e1051a39Sopenharmony_ci 40e1051a39Sopenharmony_ci/* Property string functions */ 41e1051a39Sopenharmony_ciOSSL_PROPERTY_IDX ossl_property_name(OSSL_LIB_CTX *ctx, const char *s, 42e1051a39Sopenharmony_ci int create); 43e1051a39Sopenharmony_ciconst char *ossl_property_name_str(OSSL_LIB_CTX *ctx, OSSL_PROPERTY_IDX idx); 44e1051a39Sopenharmony_ciOSSL_PROPERTY_IDX ossl_property_value(OSSL_LIB_CTX *ctx, const char *s, 45e1051a39Sopenharmony_ci int create); 46e1051a39Sopenharmony_ciconst char *ossl_property_value_str(OSSL_LIB_CTX *ctx, OSSL_PROPERTY_IDX idx); 47e1051a39Sopenharmony_ci 48e1051a39Sopenharmony_ci/* Property list functions */ 49e1051a39Sopenharmony_civoid ossl_property_free(OSSL_PROPERTY_LIST *p); 50e1051a39Sopenharmony_ciint ossl_property_has_optional(const OSSL_PROPERTY_LIST *query); 51e1051a39Sopenharmony_ci 52e1051a39Sopenharmony_ci/* Property definition cache functions */ 53e1051a39Sopenharmony_ciOSSL_PROPERTY_LIST *ossl_prop_defn_get(OSSL_LIB_CTX *ctx, const char *prop); 54e1051a39Sopenharmony_ciint ossl_prop_defn_set(OSSL_LIB_CTX *ctx, const char *prop, 55e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST **pl); 56