Latest update.
This commit is contained in:
@@ -29,8 +29,6 @@ typedef struct {
|
||||
|
||||
DEFINE_LHASH_OF(PROPERTY_DEFN_ELEM);
|
||||
|
||||
static LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns = NULL;
|
||||
|
||||
static unsigned long property_defn_hash(const PROPERTY_DEFN_ELEM *a)
|
||||
{
|
||||
return OPENSSL_LH_strhash(a->prop);
|
||||
@@ -48,35 +46,52 @@ static void property_defn_free(PROPERTY_DEFN_ELEM *elem)
|
||||
OPENSSL_free(elem);
|
||||
}
|
||||
|
||||
int ossl_prop_defn_init(void)
|
||||
static void property_defns_free(void *vproperty_defns)
|
||||
{
|
||||
property_defns = lh_PROPERTY_DEFN_ELEM_new(&property_defn_hash,
|
||||
&property_defn_cmp);
|
||||
return property_defns != NULL;
|
||||
}
|
||||
LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns = vproperty_defns;
|
||||
|
||||
void ossl_prop_defn_cleanup(void)
|
||||
{
|
||||
if (property_defns != NULL) {
|
||||
lh_PROPERTY_DEFN_ELEM_doall(property_defns, &property_defn_free);
|
||||
lh_PROPERTY_DEFN_ELEM_doall(property_defns,
|
||||
&property_defn_free);
|
||||
lh_PROPERTY_DEFN_ELEM_free(property_defns);
|
||||
property_defns = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
OSSL_PROPERTY_LIST *ossl_prop_defn_get(const char *prop)
|
||||
static void *property_defns_new(OPENSSL_CTX *ctx) {
|
||||
return lh_PROPERTY_DEFN_ELEM_new(&property_defn_hash, &property_defn_cmp);
|
||||
}
|
||||
|
||||
static const OPENSSL_CTX_METHOD property_defns_method = {
|
||||
property_defns_new,
|
||||
property_defns_free,
|
||||
};
|
||||
|
||||
OSSL_PROPERTY_LIST *ossl_prop_defn_get(OPENSSL_CTX *ctx, const char *prop)
|
||||
{
|
||||
PROPERTY_DEFN_ELEM elem, *r;
|
||||
LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns;
|
||||
|
||||
property_defns = openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_DEFN_INDEX,
|
||||
&property_defns_method);
|
||||
if (property_defns == NULL)
|
||||
return NULL;
|
||||
|
||||
elem.prop = prop;
|
||||
r = lh_PROPERTY_DEFN_ELEM_retrieve(property_defns, &elem);
|
||||
return r != NULL ? r->defn : NULL;
|
||||
}
|
||||
|
||||
int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl)
|
||||
int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop,
|
||||
OSSL_PROPERTY_LIST *pl)
|
||||
{
|
||||
PROPERTY_DEFN_ELEM elem, *old, *p = NULL;
|
||||
size_t len;
|
||||
LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns;
|
||||
|
||||
property_defns = openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_DEFN_INDEX,
|
||||
&property_defns_method);
|
||||
if (property_defns == NULL)
|
||||
return 0;
|
||||
|
||||
if (prop == NULL)
|
||||
return 1;
|
||||
|
||||
@@ -2,16 +2,17 @@
|
||||
|
||||
Definition
|
||||
::= PropertyName ( '=' Value )? ( ',' PropertyName ( '=' Value )? )*
|
||||
Query ::= ( '-'? PropertyName | PropertyName ( '=' | '!=' ) Value )
|
||||
( ',' ( '-'? PropertyName | PropertyName ( '=' | '!=' ) Value ) )*
|
||||
Query ::= PropertyQuery ( ',' PropertyQuery )*
|
||||
PropertyQuery ::= '-'? PropertyName
|
||||
| '?' ( PropertyName (( '=' | '!=' ) Value)?)
|
||||
Value ::= NumberLiteral
|
||||
| StringLiteral
|
||||
StringLiteral ::= QuotedString | UnquotedString
|
||||
QuotedString ::= '"' [^"]* '"'
|
||||
| "'" [^']* "'"
|
||||
| "'" [^']* "'"
|
||||
UnquotedString ::= [^{space},]+
|
||||
NumberLiteral
|
||||
::= '0' ( [0-7]* | 'x' [0-9A-Fa-f]+ )
|
||||
| '-'? [1-9] [0-9]+
|
||||
| '-'? [1-9] [0-9]+
|
||||
PropertyName
|
||||
::= [A-Z] [A-Z0-9_]* ( '.' [A-Z] [A-Z0-9_]* )*
|
||||
Regular → Executable
+76
-28
@@ -2,7 +2,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
|
||||
<meta name="generator" content="Railroad Diagram Generator 1.56.1774" />
|
||||
<meta name="generator" content="Railroad Diagram Generator 1.59.1797" />
|
||||
<style type="text/css">
|
||||
::-moz-selection
|
||||
{
|
||||
@@ -133,7 +133,7 @@
|
||||
display: block;
|
||||
padding: 10px;
|
||||
background: #FFF6D1;
|
||||
width: 1000px;
|
||||
width: 992px;
|
||||
}
|
||||
#divs div.grammar
|
||||
{
|
||||
@@ -268,7 +268,7 @@
|
||||
<div><a href="#Definition" title="Definition">Definition</a></div>
|
||||
<div> ::= <a href="#PropertyName" title="PropertyName">PropertyName</a> ( '=' <a href="#Value" title="Value">Value</a> )? ( ',' <a href="#PropertyName" title="PropertyName">PropertyName</a> ( '=' <a href="#Value" title="Value">Value</a> )? )*</div></xhtml:code></xhtml:div>
|
||||
</xhtml:p>
|
||||
<xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">no references</xhtml:p><xhtml:br xmlns:xhtml="http://www.w3.org/1999/xhtml" /><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml" style="font-size: 14px; font-weight:bold"><xhtml:a name="Query">Query:</xhtml:a></xhtml:p><svg xmlns="http://www.w3.org/2000/svg" width="419" height="201">
|
||||
<xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">no references</xhtml:p><xhtml:br xmlns:xhtml="http://www.w3.org/1999/xhtml" /><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml" style="font-size: 14px; font-weight:bold"><xhtml:a name="Query">Query:</xhtml:a></xhtml:p><svg xmlns="http://www.w3.org/2000/svg" width="211" height="81">
|
||||
<defs>
|
||||
<style type="text/css">
|
||||
@namespace "http://www.w3.org/2000/svg";
|
||||
@@ -299,33 +299,81 @@
|
||||
</style>
|
||||
</defs>
|
||||
<polygon points="9 61 1 57 1 65"/>
|
||||
<polygon points="17 61 9 57 9 65"/>
|
||||
<rect x="91" y="79" width="26" height="32" rx="10"/>
|
||||
<rect x="89" y="77" width="26" height="32" class="terminal" rx="10"/>
|
||||
<text class="terminal" x="99" y="97">-</text><a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#PropertyName" xlink:title="PropertyName">
|
||||
<rect x="157" y="47" width="110" height="32"/>
|
||||
<rect x="155" y="45" width="110" height="32" class="nonterminal"/>
|
||||
<text class="nonterminal" x="165" y="65">PropertyName</text></a><a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#PropertyName" xlink:title="PropertyName">
|
||||
<rect x="71" y="123" width="110" height="32"/>
|
||||
<rect x="69" y="121" width="110" height="32" class="nonterminal"/>
|
||||
<text class="nonterminal" x="79" y="141">PropertyName</text></a><rect x="221" y="123" width="30" height="32" rx="10"/>
|
||||
<rect x="219" y="121" width="30" height="32" class="terminal" rx="10"/>
|
||||
<text class="terminal" x="229" y="141">=</text>
|
||||
<rect x="221" y="167" width="34" height="32" rx="10"/>
|
||||
<rect x="219" y="165" width="34" height="32" class="terminal" rx="10"/>
|
||||
<text class="terminal" x="229" y="185">!=</text><a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#Value" xlink:title="Value">
|
||||
<rect x="295" y="123" width="56" height="32"/>
|
||||
<rect x="293" y="121" width="56" height="32" class="nonterminal"/>
|
||||
<text class="nonterminal" x="303" y="141">Value</text></a><rect x="51" y="3" width="24" height="32" rx="10"/>
|
||||
<polygon points="17 61 9 57 9 65"/><a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#PropertyQuery" xlink:title="PropertyQuery">
|
||||
<rect x="51" y="47" width="112" height="32"/>
|
||||
<rect x="49" y="45" width="112" height="32" class="nonterminal"/>
|
||||
<text class="nonterminal" x="59" y="65">PropertyQuery</text></a><rect x="51" y="3" width="24" height="32" rx="10"/>
|
||||
<rect x="49" y="1" width="24" height="32" class="terminal" rx="10"/>
|
||||
<text class="terminal" x="59" y="21">,</text>
|
||||
<svg:path xmlns:svg="http://www.w3.org/2000/svg" class="line" d="m17 61 h2 m60 0 h10 m0 0 h36 m-66 0 h20 m46 0 h20 m-86 0 q10 0 10 10 m66 0 q0 -10 10 -10 m-76 10 v12 m66 0 v-12 m-66 12 q0 10 10 10 m46 0 q10 0 10 -10 m-56 10 h10 m26 0 h10 m20 -32 h10 m110 0 h10 m0 0 h84 m-320 0 h20 m300 0 h20 m-340 0 q10 0 10 10 m320 0 q0 -10 10 -10 m-330 10 v56 m320 0 v-56 m-320 56 q0 10 10 10 m300 0 q10 0 10 -10 m-310 10 h10 m110 0 h10 m20 0 h10 m30 0 h10 m0 0 h4 m-74 0 h20 m54 0 h20 m-94 0 q10 0 10 10 m74 0 q0 -10 10 -10 m-84 10 v24 m74 0 v-24 m-74 24 q0 10 10 10 m54 0 q10 0 10 -10 m-64 10 h10 m34 0 h10 m20 -44 h10 m56 0 h10 m-340 -76 l20 0 m-1 0 q-9 0 -9 -10 l0 -24 q0 -10 10 -10 m340 44 l20 0 m-20 0 q10 0 10 -10 l0 -24 q0 -10 -10 -10 m-340 0 h10 m24 0 h10 m0 0 h296 m23 44 h-3"/>
|
||||
<polygon points="409 61 417 57 417 65"/>
|
||||
<polygon points="409 61 401 57 401 65"/></svg><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<svg:path xmlns:svg="http://www.w3.org/2000/svg" class="line" d="m17 61 h2 m20 0 h10 m112 0 h10 m-152 0 l20 0 m-1 0 q-9 0 -9 -10 l0 -24 q0 -10 10 -10 m132 44 l20 0 m-20 0 q10 0 10 -10 l0 -24 q0 -10 -10 -10 m-132 0 h10 m24 0 h10 m0 0 h88 m23 44 h-3"/>
|
||||
<polygon points="201 61 209 57 209 65"/>
|
||||
<polygon points="201 61 193 57 193 65"/></svg><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<xhtml:div class="ebnf"><xhtml:code>
|
||||
<div><a href="#Query" title="Query">Query</a> ::= ( '-'? <a href="#PropertyName" title="PropertyName">PropertyName</a> | <a href="#PropertyName" title="PropertyName">PropertyName</a> ( '=' | '!=' ) <a href="#Value" title="Value">Value</a> ) ( ',' ( '-'? <a href="#PropertyName" title="PropertyName">PropertyName</a> | <a href="#PropertyName" title="PropertyName">PropertyName</a> ( '=' | '!=' ) <a href="#Value" title="Value">Value</a> ) )*</div></xhtml:code></xhtml:div>
|
||||
<div><a href="#Query" title="Query">Query</a> ::= <a href="#PropertyQuery" title="PropertyQuery">PropertyQuery</a> ( ',' <a href="#PropertyQuery" title="PropertyQuery">PropertyQuery</a> )*</div></xhtml:code></xhtml:div>
|
||||
</xhtml:p>
|
||||
<xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">no references</xhtml:p><xhtml:br xmlns:xhtml="http://www.w3.org/1999/xhtml" /><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml" style="font-size: 14px; font-weight:bold"><xhtml:a name="Value">Value:</xhtml:a></xhtml:p><svg xmlns="http://www.w3.org/2000/svg" width="207" height="81">
|
||||
<xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">no references</xhtml:p><xhtml:br xmlns:xhtml="http://www.w3.org/1999/xhtml" /><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml" style="font-size: 14px; font-weight:bold"><xhtml:a name="PropertyQuery">PropertyQuery:</xhtml:a></xhtml:p><svg xmlns="http://www.w3.org/2000/svg" width="465" height="189">
|
||||
<defs>
|
||||
<style type="text/css">
|
||||
@namespace "http://www.w3.org/2000/svg";
|
||||
.line {fill: none; stroke: #332900;}
|
||||
.bold-line {stroke: #141000; shape-rendering: crispEdges; stroke-width: 2; }
|
||||
.thin-line {stroke: #1F1800; shape-rendering: crispEdges}
|
||||
.filled {fill: #332900; stroke: none;}
|
||||
text.terminal {font-family: Verdana, Sans-serif;
|
||||
font-size: 12px;
|
||||
fill: #141000;
|
||||
font-weight: bold;
|
||||
}
|
||||
text.nonterminal {font-family: Verdana, Sans-serif;
|
||||
font-size: 12px;
|
||||
fill: #1A1400;
|
||||
font-weight: normal;
|
||||
}
|
||||
text.regexp {font-family: Verdana, Sans-serif;
|
||||
font-size: 12px;
|
||||
fill: #1F1800;
|
||||
font-weight: normal;
|
||||
}
|
||||
rect, circle, polygon {fill: #332900; stroke: #332900;}
|
||||
rect.terminal {fill: #FFDB4D; stroke: #332900;}
|
||||
rect.nonterminal {fill: #FFEC9E; stroke: #332900;}
|
||||
rect.text {fill: none; stroke: none;}
|
||||
polygon.regexp {fill: #FFF4C7; stroke: #332900;}
|
||||
</style>
|
||||
</defs>
|
||||
<polygon points="9 17 1 13 1 21"/>
|
||||
<polygon points="17 17 9 13 9 21"/>
|
||||
<rect x="71" y="35" width="26" height="32" rx="10"/>
|
||||
<rect x="69" y="33" width="26" height="32" class="terminal" rx="10"/>
|
||||
<text class="terminal" x="79" y="53">-</text><a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#PropertyName" xlink:title="PropertyName">
|
||||
<rect x="137" y="3" width="110" height="32"/>
|
||||
<rect x="135" y="1" width="110" height="32" class="nonterminal"/>
|
||||
<text class="nonterminal" x="145" y="21">PropertyName</text></a><rect x="51" y="79" width="26" height="32" rx="10"/>
|
||||
<rect x="49" y="77" width="26" height="32" class="terminal" rx="10"/>
|
||||
<text class="terminal" x="59" y="97">?</text><a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#PropertyName" xlink:title="PropertyName">
|
||||
<rect x="97" y="79" width="110" height="32"/>
|
||||
<rect x="95" y="77" width="110" height="32" class="nonterminal"/>
|
||||
<text class="nonterminal" x="105" y="97">PropertyName</text></a><rect x="267" y="111" width="30" height="32" rx="10"/>
|
||||
<rect x="265" y="109" width="30" height="32" class="terminal" rx="10"/>
|
||||
<text class="terminal" x="275" y="129">=</text>
|
||||
<rect x="267" y="155" width="34" height="32" rx="10"/>
|
||||
<rect x="265" y="153" width="34" height="32" class="terminal" rx="10"/>
|
||||
<text class="terminal" x="275" y="173">!=</text><a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#Value" xlink:title="Value">
|
||||
<rect x="341" y="111" width="56" height="32"/>
|
||||
<rect x="339" y="109" width="56" height="32" class="nonterminal"/>
|
||||
<text class="nonterminal" x="349" y="129">Value</text></a><svg:path xmlns:svg="http://www.w3.org/2000/svg" class="line" d="m17 17 h2 m40 0 h10 m0 0 h36 m-66 0 h20 m46 0 h20 m-86 0 q10 0 10 10 m66 0 q0 -10 10 -10 m-76 10 v12 m66 0 v-12 m-66 12 q0 10 10 10 m46 0 q10 0 10 -10 m-56 10 h10 m26 0 h10 m20 -32 h10 m110 0 h10 m0 0 h170 m-406 0 h20 m386 0 h20 m-426 0 q10 0 10 10 m406 0 q0 -10 10 -10 m-416 10 v56 m406 0 v-56 m-406 56 q0 10 10 10 m386 0 q10 0 10 -10 m-396 10 h10 m26 0 h10 m0 0 h10 m110 0 h10 m20 0 h10 m0 0 h160 m-190 0 h20 m170 0 h20 m-210 0 q10 0 10 10 m190 0 q0 -10 10 -10 m-200 10 v12 m190 0 v-12 m-190 12 q0 10 10 10 m170 0 q10 0 10 -10 m-160 10 h10 m30 0 h10 m0 0 h4 m-74 0 h20 m54 0 h20 m-94 0 q10 0 10 10 m74 0 q0 -10 10 -10 m-84 10 v24 m74 0 v-24 m-74 24 q0 10 10 10 m54 0 q10 0 10 -10 m-64 10 h10 m34 0 h10 m20 -44 h10 m56 0 h10 m43 -108 h-3"/>
|
||||
<polygon points="455 17 463 13 463 21"/>
|
||||
<polygon points="455 17 447 13 447 21"/></svg><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<xhtml:div class="ebnf"><xhtml:code>
|
||||
<div><a href="#PropertyQuery" title="PropertyQuery">PropertyQuery</a></div>
|
||||
<div> ::= '-'? <a href="#PropertyName" title="PropertyName">PropertyName</a></div>
|
||||
<div> | '?' <a href="#PropertyName" title="PropertyName">PropertyName</a> ( ( '=' | '!=' ) <a href="#Value" title="Value">Value</a> )?</div></xhtml:code></xhtml:div>
|
||||
</xhtml:p>
|
||||
<xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">referenced by:
|
||||
<xhtml:ul>
|
||||
<xhtml:li><xhtml:a href="#Query" title="Query">Query</xhtml:a></xhtml:li>
|
||||
</xhtml:ul>
|
||||
</xhtml:p><xhtml:br xmlns:xhtml="http://www.w3.org/1999/xhtml" /><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml" style="font-size: 14px; font-weight:bold"><xhtml:a name="Value">Value:</xhtml:a></xhtml:p><svg xmlns="http://www.w3.org/2000/svg" width="207" height="81">
|
||||
<defs>
|
||||
<style type="text/css">
|
||||
@namespace "http://www.w3.org/2000/svg";
|
||||
@@ -372,7 +420,7 @@
|
||||
<xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">referenced by:
|
||||
<xhtml:ul>
|
||||
<xhtml:li><xhtml:a href="#Definition" title="Definition">Definition</xhtml:a></xhtml:li>
|
||||
<xhtml:li><xhtml:a href="#Query" title="Query">Query</xhtml:a></xhtml:li>
|
||||
<xhtml:li><xhtml:a href="#PropertyQuery" title="PropertyQuery">PropertyQuery</xhtml:a></xhtml:li>
|
||||
</xhtml:ul>
|
||||
</xhtml:p><xhtml:br xmlns:xhtml="http://www.w3.org/1999/xhtml" /><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml" style="font-size: 14px; font-weight:bold"><xhtml:a name="StringLiteral">StringLiteral:</xhtml:a></xhtml:p><svg xmlns="http://www.w3.org/2000/svg" width="219" height="81">
|
||||
<defs>
|
||||
@@ -659,7 +707,7 @@
|
||||
<xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">referenced by:
|
||||
<xhtml:ul>
|
||||
<xhtml:li><xhtml:a href="#Definition" title="Definition">Definition</xhtml:a></xhtml:li>
|
||||
<xhtml:li><xhtml:a href="#Query" title="Query">Query</xhtml:a></xhtml:li>
|
||||
<xhtml:li><xhtml:a href="#PropertyQuery" title="PropertyQuery">PropertyQuery</xhtml:a></xhtml:li>
|
||||
</xhtml:ul>
|
||||
</xhtml:p><xhtml:br xmlns:xhtml="http://www.w3.org/1999/xhtml" /><xhtml:hr xmlns:xhtml="http://www.w3.org/1999/xhtml" />
|
||||
<xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
|
||||
+27
-34
@@ -47,6 +47,7 @@ typedef struct {
|
||||
} ALGORITHM;
|
||||
|
||||
struct ossl_method_store_st {
|
||||
OPENSSL_CTX *ctx;
|
||||
size_t nelem;
|
||||
SPARSE_ARRAY_OF(ALGORITHM) *algs;
|
||||
OSSL_PROPERTY_LIST *global_properties;
|
||||
@@ -82,29 +83,10 @@ int ossl_property_unlock(OSSL_METHOD_STORE *p)
|
||||
return p != 0 ? CRYPTO_THREAD_unlock(p->lock) : 0;
|
||||
}
|
||||
|
||||
int ossl_method_store_init(void)
|
||||
static openssl_ctx_run_once_fn do_method_store_init;
|
||||
int do_method_store_init(OPENSSL_CTX *ctx)
|
||||
{
|
||||
if (ossl_property_string_init()
|
||||
&& ossl_prop_defn_init()
|
||||
&& ossl_property_parse_init())
|
||||
return 1;
|
||||
|
||||
ossl_method_store_cleanup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ossl_method_store_cleanup(void)
|
||||
{
|
||||
ossl_property_string_cleanup();
|
||||
ossl_prop_defn_cleanup();
|
||||
}
|
||||
|
||||
static CRYPTO_ONCE method_store_init_flag = CRYPTO_ONCE_STATIC_INIT;
|
||||
DEFINE_RUN_ONCE_STATIC(do_method_store_init)
|
||||
{
|
||||
return OPENSSL_init_crypto(0, NULL)
|
||||
&& ossl_method_store_init()
|
||||
&& OPENSSL_atexit(&ossl_method_store_cleanup);
|
||||
return ossl_property_parse_init(ctx);
|
||||
}
|
||||
|
||||
static unsigned long query_hash(const QUERY *a)
|
||||
@@ -141,15 +123,22 @@ static void alg_cleanup(ossl_uintmax_t idx, ALGORITHM *a)
|
||||
}
|
||||
}
|
||||
|
||||
OSSL_METHOD_STORE *ossl_method_store_new(void)
|
||||
/*
|
||||
* The OPENSSL_CTX param here allows access to underlying property data needed
|
||||
* for computation
|
||||
*/
|
||||
OSSL_METHOD_STORE *ossl_method_store_new(OPENSSL_CTX *ctx)
|
||||
{
|
||||
OSSL_METHOD_STORE *res;
|
||||
|
||||
if (!RUN_ONCE(&method_store_init_flag, do_method_store_init))
|
||||
return 0;
|
||||
if (!openssl_ctx_run_once(ctx,
|
||||
OPENSSL_CTX_METHOD_STORE_RUN_ONCE_INDEX,
|
||||
do_method_store_init))
|
||||
return NULL;
|
||||
|
||||
res = OPENSSL_zalloc(sizeof(*res));
|
||||
if (res != NULL) {
|
||||
res->ctx = ctx;
|
||||
if ((res->algs = ossl_sa_ALGORITHM_new()) == NULL) {
|
||||
OPENSSL_free(res);
|
||||
return NULL;
|
||||
@@ -212,10 +201,11 @@ int ossl_method_store_add(OSSL_METHOD_STORE *store,
|
||||
*/
|
||||
ossl_property_write_lock(store);
|
||||
ossl_method_cache_flush(store, nid);
|
||||
if ((impl->properties = ossl_prop_defn_get(properties)) == NULL) {
|
||||
if ((impl->properties = ossl_parse_property(properties)) == NULL)
|
||||
if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) {
|
||||
impl->properties = ossl_parse_property(store->ctx, properties);
|
||||
if (impl->properties == NULL)
|
||||
goto err;
|
||||
ossl_prop_defn_set(properties, impl->properties);
|
||||
ossl_prop_defn_set(store->ctx, properties, impl->properties);
|
||||
}
|
||||
|
||||
alg = ossl_method_store_retrieve(store, nid);
|
||||
@@ -287,7 +277,7 @@ int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
|
||||
IMPLEMENTATION *impl;
|
||||
OSSL_PROPERTY_LIST *pq = NULL, *p2;
|
||||
int ret = 0;
|
||||
int j;
|
||||
int j, best = -1, score, optional;
|
||||
|
||||
if (nid <= 0 || method == NULL || store == NULL)
|
||||
return 0;
|
||||
@@ -310,7 +300,7 @@ int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
|
||||
}
|
||||
goto fin;
|
||||
}
|
||||
pq = ossl_parse_query(prop_query);
|
||||
pq = ossl_parse_query(store->ctx, prop_query);
|
||||
if (pq == NULL)
|
||||
goto fin;
|
||||
if (store->global_properties != NULL) {
|
||||
@@ -320,13 +310,16 @@ int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
|
||||
ossl_property_free(pq);
|
||||
pq = p2;
|
||||
}
|
||||
optional = ossl_property_has_optional(pq);
|
||||
for (j = 0; j < sk_IMPLEMENTATION_num(alg->impls); j++) {
|
||||
impl = sk_IMPLEMENTATION_value(alg->impls, j);
|
||||
|
||||
if (ossl_property_match(pq, impl->properties)) {
|
||||
score = ossl_property_match_count(pq, impl->properties);
|
||||
if (score > best) {
|
||||
*method = impl->method;
|
||||
ret = 1;
|
||||
goto fin;
|
||||
if (!optional)
|
||||
goto fin;
|
||||
best = score;
|
||||
}
|
||||
}
|
||||
fin:
|
||||
@@ -350,7 +343,7 @@ int ossl_method_store_set_global_properties(OSSL_METHOD_STORE *store,
|
||||
ossl_property_unlock(store);
|
||||
return 1;
|
||||
}
|
||||
store->global_properties = ossl_parse_query(prop_query);
|
||||
store->global_properties = ossl_parse_query(store->ctx, prop_query);
|
||||
ret = store->global_properties != NULL;
|
||||
ossl_property_unlock(store);
|
||||
return ret;
|
||||
|
||||
@@ -14,35 +14,31 @@
|
||||
typedef struct ossl_property_list_st OSSL_PROPERTY_LIST;
|
||||
typedef int OSSL_PROPERTY_IDX;
|
||||
|
||||
/* Initialisation and finalisation for subsystem */
|
||||
int ossl_method_store_init(void);
|
||||
void ossl_method_store_cleanup(void);
|
||||
|
||||
/* Property string functions */
|
||||
OSSL_PROPERTY_IDX ossl_property_name(const char *s, int create);
|
||||
OSSL_PROPERTY_IDX ossl_property_value(const char *s, int create);
|
||||
int ossl_property_string_init(void);
|
||||
void ossl_property_string_cleanup(void);
|
||||
OSSL_PROPERTY_IDX ossl_property_name(OPENSSL_CTX *ctx, const char *s,
|
||||
int create);
|
||||
OSSL_PROPERTY_IDX ossl_property_value(OPENSSL_CTX *ctx, const char *s,
|
||||
int create);
|
||||
|
||||
/* Property list functions */
|
||||
int ossl_property_parse_init(void);
|
||||
int ossl_property_parse_init(OPENSSL_CTX *ctx);
|
||||
void ossl_property_free(OSSL_PROPERTY_LIST *p);
|
||||
int ossl_property_match(const OSSL_PROPERTY_LIST *query,
|
||||
const OSSL_PROPERTY_LIST *defn);
|
||||
int ossl_property_has_optional(const OSSL_PROPERTY_LIST *query);
|
||||
int ossl_property_match_count(const OSSL_PROPERTY_LIST *query,
|
||||
const OSSL_PROPERTY_LIST *defn);
|
||||
OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
|
||||
const OSSL_PROPERTY_LIST *b);
|
||||
|
||||
/* Property definition functions */
|
||||
OSSL_PROPERTY_LIST *ossl_parse_property(const char *s);
|
||||
OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *s);
|
||||
|
||||
/* Property query functions */
|
||||
OSSL_PROPERTY_LIST *ossl_parse_query(const char *s);
|
||||
OSSL_PROPERTY_LIST *ossl_parse_query(OPENSSL_CTX *ctx, const char *s);
|
||||
|
||||
/* Property definition cache functions */
|
||||
int ossl_prop_defn_init(void);
|
||||
void ossl_prop_defn_cleanup(void);
|
||||
OSSL_PROPERTY_LIST *ossl_prop_defn_get(const char *prop);
|
||||
int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl);
|
||||
OSSL_PROPERTY_LIST *ossl_prop_defn_get(OPENSSL_CTX *ctx, const char *prop);
|
||||
int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop,
|
||||
OSSL_PROPERTY_LIST *pl);
|
||||
|
||||
/* Property cache lock / unlock */
|
||||
int ossl_property_write_lock(OSSL_METHOD_STORE *);
|
||||
|
||||
@@ -32,6 +32,7 @@ typedef struct {
|
||||
OSSL_PROPERTY_IDX name_idx;
|
||||
PROPERTY_TYPE type;
|
||||
PROPERTY_OPER oper;
|
||||
unsigned int optional : 1;
|
||||
union {
|
||||
int64_t int_val; /* Signed integer */
|
||||
OSSL_PROPERTY_IDX str_val; /* String */
|
||||
@@ -40,6 +41,7 @@ typedef struct {
|
||||
|
||||
struct ossl_property_list_st {
|
||||
int n;
|
||||
unsigned int has_optional : 1;
|
||||
PROPERTY_DEFINITION properties[1];
|
||||
};
|
||||
|
||||
@@ -78,7 +80,8 @@ static int match(const char *t[], const char m[], size_t m_len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_name(const char *t[], int create, OSSL_PROPERTY_IDX *idx)
|
||||
static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create,
|
||||
OSSL_PROPERTY_IDX *idx)
|
||||
{
|
||||
char name[100];
|
||||
int err = 0;
|
||||
@@ -109,7 +112,7 @@ static int parse_name(const char *t[], int create, OSSL_PROPERTY_IDX *idx)
|
||||
name[i] = '\0';
|
||||
*t = skip_space(s);
|
||||
if (!err) {
|
||||
*idx = ossl_property_name(name, user_name && create);
|
||||
*idx = ossl_property_name(ctx, name, user_name && create);
|
||||
return 1;
|
||||
}
|
||||
PROPerr(PROP_F_PARSE_NAME, PROP_R_NAME_TOO_LONG);
|
||||
@@ -180,8 +183,8 @@ static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int parse_string(const char *t[], char delim, PROPERTY_DEFINITION *res,
|
||||
const int create)
|
||||
static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim,
|
||||
PROPERTY_DEFINITION *res, const int create)
|
||||
{
|
||||
char v[1000];
|
||||
const char *s = *t;
|
||||
@@ -205,13 +208,13 @@ static int parse_string(const char *t[], char delim, PROPERTY_DEFINITION *res,
|
||||
if (err)
|
||||
PROPerr(PROP_F_PARSE_STRING, PROP_R_STRING_TOO_LONG);
|
||||
else
|
||||
res->v.str_val = ossl_property_value(v, create);
|
||||
res->v.str_val = ossl_property_value(ctx, v, create);
|
||||
res->type = PROPERTY_TYPE_STRING;
|
||||
return !err;
|
||||
}
|
||||
|
||||
static int parse_unquoted(const char *t[], PROPERTY_DEFINITION *res,
|
||||
const int create)
|
||||
static int parse_unquoted(OPENSSL_CTX *ctx, const char *t[],
|
||||
PROPERTY_DEFINITION *res, const int create)
|
||||
{
|
||||
char v[1000];
|
||||
const char *s = *t;
|
||||
@@ -236,19 +239,20 @@ static int parse_unquoted(const char *t[], PROPERTY_DEFINITION *res,
|
||||
if (err)
|
||||
PROPerr(PROP_F_PARSE_UNQUOTED, PROP_R_STRING_TOO_LONG);
|
||||
else
|
||||
res->v.str_val = ossl_property_value(v, create);
|
||||
res->v.str_val = ossl_property_value(ctx, v, create);
|
||||
res->type = PROPERTY_TYPE_STRING;
|
||||
return !err;
|
||||
}
|
||||
|
||||
static int parse_value(const char *t[], PROPERTY_DEFINITION *res, int create)
|
||||
static int parse_value(OPENSSL_CTX *ctx, const char *t[],
|
||||
PROPERTY_DEFINITION *res, int create)
|
||||
{
|
||||
const char *s = *t;
|
||||
int r = 0;
|
||||
|
||||
if (*s == '"' || *s == '\'') {
|
||||
s++;
|
||||
r = parse_string(&s, s[-1], res, create);
|
||||
r = parse_string(ctx, &s, s[-1], res, create);
|
||||
} else if (*s == '+') {
|
||||
s++;
|
||||
r = parse_number(&s, res);
|
||||
@@ -265,7 +269,7 @@ static int parse_value(const char *t[], PROPERTY_DEFINITION *res, int create)
|
||||
} else if (ossl_isdigit(*s)) {
|
||||
return parse_number(t, res);
|
||||
} else if (ossl_isalpha(*s))
|
||||
return parse_unquoted(t, res, create);
|
||||
return parse_unquoted(ctx, t, res, create);
|
||||
if (r)
|
||||
*t = s;
|
||||
return r;
|
||||
@@ -305,14 +309,17 @@ static OSSL_PROPERTY_LIST *stack_to_property_list(STACK_OF(PROPERTY_DEFINITION)
|
||||
if (r != NULL) {
|
||||
sk_PROPERTY_DEFINITION_sort(sk);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
r->has_optional = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
r->properties[i] = *sk_PROPERTY_DEFINITION_value(sk, i);
|
||||
r->has_optional |= r->properties[i].optional;
|
||||
}
|
||||
r->n = n;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
OSSL_PROPERTY_LIST *ossl_parse_property(const char *defn)
|
||||
OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn)
|
||||
{
|
||||
PROPERTY_DEFINITION *prop = NULL;
|
||||
OSSL_PROPERTY_LIST *res = NULL;
|
||||
@@ -330,7 +337,8 @@ OSSL_PROPERTY_LIST *ossl_parse_property(const char *defn)
|
||||
if (prop == NULL)
|
||||
goto err;
|
||||
memset(&prop->v, 0, sizeof(prop->v));
|
||||
if (!parse_name(&s, 1, &prop->name_idx))
|
||||
prop->optional = 0;
|
||||
if (!parse_name(ctx, &s, 1, &prop->name_idx))
|
||||
goto err;
|
||||
prop->oper = PROPERTY_OPER_EQ;
|
||||
if (prop->name_idx == 0) {
|
||||
@@ -338,7 +346,7 @@ OSSL_PROPERTY_LIST *ossl_parse_property(const char *defn)
|
||||
goto err;
|
||||
}
|
||||
if (match_ch(&s, '=')) {
|
||||
if (!parse_value(&s, prop, 1)) {
|
||||
if (!parse_value(ctx, &s, prop, 1)) {
|
||||
PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE);
|
||||
goto err;
|
||||
}
|
||||
@@ -365,7 +373,7 @@ err:
|
||||
return res;
|
||||
}
|
||||
|
||||
OSSL_PROPERTY_LIST *ossl_parse_query(const char *s)
|
||||
OSSL_PROPERTY_LIST *ossl_parse_query(OPENSSL_CTX *ctx, const char *s)
|
||||
{
|
||||
STACK_OF(PROPERTY_DEFINITION) *sk;
|
||||
OSSL_PROPERTY_LIST *res = NULL;
|
||||
@@ -385,11 +393,13 @@ OSSL_PROPERTY_LIST *ossl_parse_query(const char *s)
|
||||
|
||||
if (match_ch(&s, '-')) {
|
||||
prop->oper = PROPERTY_OVERRIDE;
|
||||
if (!parse_name(&s, 0, &prop->name_idx))
|
||||
prop->optional = 0;
|
||||
if (!parse_name(ctx, &s, 0, &prop->name_idx))
|
||||
goto err;
|
||||
goto skip_value;
|
||||
}
|
||||
if (!parse_name(&s, 0, &prop->name_idx))
|
||||
prop->optional = match_ch(&s, '?');
|
||||
if (!parse_name(ctx, &s, 0, &prop->name_idx))
|
||||
goto err;
|
||||
|
||||
if (match_ch(&s, '=')) {
|
||||
@@ -403,7 +413,7 @@ OSSL_PROPERTY_LIST *ossl_parse_query(const char *s)
|
||||
prop->v.str_val = ossl_property_true;
|
||||
goto skip_value;
|
||||
}
|
||||
if (!parse_value(&s, prop, 0))
|
||||
if (!parse_value(ctx, &s, prop, 0))
|
||||
prop->type = PROPERTY_TYPE_VALUE_UNDEFINED;
|
||||
|
||||
skip_value:
|
||||
@@ -424,12 +434,22 @@ err:
|
||||
return res;
|
||||
}
|
||||
|
||||
int ossl_property_match(const OSSL_PROPERTY_LIST *query,
|
||||
const OSSL_PROPERTY_LIST *defn)
|
||||
/* Does a property query have any optional clauses */
|
||||
int ossl_property_has_optional(const OSSL_PROPERTY_LIST *query)
|
||||
{
|
||||
return query->has_optional ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare a query against a definition.
|
||||
* Return the number of clauses matched or -1 if a mandatory clause is false.
|
||||
*/
|
||||
int ossl_property_match_count(const OSSL_PROPERTY_LIST *query,
|
||||
const OSSL_PROPERTY_LIST *defn)
|
||||
{
|
||||
const PROPERTY_DEFINITION *const q = query->properties;
|
||||
const PROPERTY_DEFINITION *const d = defn->properties;
|
||||
int i = 0, j = 0;
|
||||
int i = 0, j = 0, matches = 0;
|
||||
PROPERTY_OPER oper;
|
||||
|
||||
while (i < query->n) {
|
||||
@@ -446,9 +466,11 @@ int ossl_property_match(const OSSL_PROPERTY_LIST *query,
|
||||
const int eq = q[i].type == d[j].type
|
||||
&& memcmp(&q[i].v, &d[j].v, sizeof(q[i].v)) == 0;
|
||||
|
||||
if ((eq && oper != PROPERTY_OPER_EQ)
|
||||
|| (!eq && oper != PROPERTY_OPER_NE))
|
||||
return 0;
|
||||
if ((eq && oper == PROPERTY_OPER_EQ)
|
||||
|| (!eq && oper == PROPERTY_OPER_NE))
|
||||
matches++;
|
||||
else if (!q[i].optional)
|
||||
return -1;
|
||||
i++;
|
||||
j++;
|
||||
continue;
|
||||
@@ -461,18 +483,23 @@ int ossl_property_match(const OSSL_PROPERTY_LIST *query,
|
||||
* the latter is treated as a comparison against the Boolean false.
|
||||
*/
|
||||
if (q[i].type == PROPERTY_TYPE_VALUE_UNDEFINED) {
|
||||
if (oper != PROPERTY_OPER_NE)
|
||||
return 0;
|
||||
if (oper == PROPERTY_OPER_NE)
|
||||
matches++;
|
||||
else if (!q[i].optional)
|
||||
return -1;
|
||||
} else if (q[i].type != PROPERTY_TYPE_STRING
|
||||
|| (oper == PROPERTY_OPER_EQ
|
||||
&& q[i].v.str_val != ossl_property_false)
|
||||
|| (oper == PROPERTY_OPER_NE
|
||||
&& q[i].v.str_val == ossl_property_false)) {
|
||||
return 0;
|
||||
if (!q[i].optional)
|
||||
return -1;
|
||||
} else {
|
||||
matches++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return 1;
|
||||
return matches;
|
||||
}
|
||||
|
||||
void ossl_property_free(OSSL_PROPERTY_LIST *p)
|
||||
@@ -519,7 +546,7 @@ OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
|
||||
return r;
|
||||
}
|
||||
|
||||
int ossl_property_parse_init(void)
|
||||
int ossl_property_parse_init(OPENSSL_CTX *ctx)
|
||||
{
|
||||
static const char *const predefined_names[] = {
|
||||
"default", /* Being provided by the default built-in provider */
|
||||
@@ -532,12 +559,12 @@ int ossl_property_parse_init(void)
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < OSSL_NELEM(predefined_names); i++)
|
||||
if (ossl_property_name(predefined_names[i], 1) == 0)
|
||||
if (ossl_property_name(ctx, predefined_names[i], 1) == 0)
|
||||
goto err;
|
||||
|
||||
/* Pre-populate the two Boolean values */
|
||||
if ((ossl_property_true = ossl_property_value("yes", 1)) == 0
|
||||
|| (ossl_property_false = ossl_property_value("no", 1)) == 0)
|
||||
if ((ossl_property_true = ossl_property_value(ctx, "yes", 1)) == 0
|
||||
|| (ossl_property_false = ossl_property_value(ctx, "no", 1)) == 0)
|
||||
goto err;
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -34,10 +34,12 @@ typedef struct {
|
||||
DEFINE_LHASH_OF(PROPERTY_STRING);
|
||||
typedef LHASH_OF(PROPERTY_STRING) PROP_TABLE;
|
||||
|
||||
static PROP_TABLE *prop_names;
|
||||
static PROP_TABLE *prop_values;
|
||||
static OSSL_PROPERTY_IDX prop_name_idx = 0;
|
||||
static OSSL_PROPERTY_IDX prop_value_idx = 0;
|
||||
typedef struct {
|
||||
PROP_TABLE *prop_names;
|
||||
PROP_TABLE *prop_values;
|
||||
OSSL_PROPERTY_IDX prop_name_idx;
|
||||
OSSL_PROPERTY_IDX prop_value_idx;
|
||||
} PROPERTY_STRING_DATA;
|
||||
|
||||
static unsigned long property_hash(const PROPERTY_STRING *a)
|
||||
{
|
||||
@@ -65,6 +67,48 @@ static void property_table_free(PROP_TABLE **pt)
|
||||
}
|
||||
}
|
||||
|
||||
static void property_string_data_free(void *vpropdata)
|
||||
{
|
||||
PROPERTY_STRING_DATA *propdata = vpropdata;
|
||||
|
||||
if (propdata == NULL)
|
||||
return;
|
||||
|
||||
property_table_free(&propdata->prop_names);
|
||||
property_table_free(&propdata->prop_values);
|
||||
propdata->prop_name_idx = propdata->prop_value_idx = 0;
|
||||
|
||||
OPENSSL_free(propdata);
|
||||
}
|
||||
|
||||
static void *property_string_data_new(OPENSSL_CTX *ctx) {
|
||||
PROPERTY_STRING_DATA *propdata = OPENSSL_zalloc(sizeof(*propdata));
|
||||
|
||||
if (propdata == NULL)
|
||||
return NULL;
|
||||
|
||||
propdata->prop_names = lh_PROPERTY_STRING_new(&property_hash,
|
||||
&property_cmp);
|
||||
if (propdata->prop_names == NULL)
|
||||
goto err;
|
||||
|
||||
propdata->prop_values = lh_PROPERTY_STRING_new(&property_hash,
|
||||
&property_cmp);
|
||||
if (propdata->prop_values == NULL)
|
||||
goto err;
|
||||
|
||||
return propdata;
|
||||
|
||||
err:
|
||||
property_string_data_free(propdata);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const OPENSSL_CTX_METHOD property_string_data_method = {
|
||||
property_string_data_new,
|
||||
property_string_data_free,
|
||||
};
|
||||
|
||||
static PROPERTY_STRING *new_property_string(const char *s,
|
||||
OSSL_PROPERTY_IDX *pidx)
|
||||
{
|
||||
@@ -103,35 +147,30 @@ static OSSL_PROPERTY_IDX ossl_property_string(PROP_TABLE *t,
|
||||
return ps != NULL ? ps->idx : 0;
|
||||
}
|
||||
|
||||
OSSL_PROPERTY_IDX ossl_property_name(const char *s, int create)
|
||||
OSSL_PROPERTY_IDX ossl_property_name(OPENSSL_CTX *ctx, const char *s,
|
||||
int create)
|
||||
{
|
||||
return ossl_property_string(prop_names, create ? &prop_name_idx : NULL, s);
|
||||
}
|
||||
PROPERTY_STRING_DATA *propdata
|
||||
= openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_STRING_INDEX,
|
||||
&property_string_data_method);
|
||||
|
||||
OSSL_PROPERTY_IDX ossl_property_value(const char *s, int create)
|
||||
{
|
||||
return ossl_property_string(prop_values, create ? &prop_value_idx : NULL, s);
|
||||
}
|
||||
|
||||
int ossl_property_string_init(void)
|
||||
{
|
||||
prop_names = lh_PROPERTY_STRING_new(&property_hash, &property_cmp);
|
||||
if (prop_names == NULL)
|
||||
if (propdata == NULL)
|
||||
return 0;
|
||||
|
||||
prop_values = lh_PROPERTY_STRING_new(&property_hash, &property_cmp);
|
||||
if (prop_values == NULL)
|
||||
goto err;
|
||||
return 1;
|
||||
|
||||
err:
|
||||
ossl_property_string_cleanup();
|
||||
return 0;
|
||||
return ossl_property_string(propdata->prop_names,
|
||||
create ? &propdata->prop_name_idx : NULL,
|
||||
s);
|
||||
}
|
||||
|
||||
void ossl_property_string_cleanup(void)
|
||||
OSSL_PROPERTY_IDX ossl_property_value(OPENSSL_CTX *ctx, const char *s,
|
||||
int create)
|
||||
{
|
||||
property_table_free(&prop_names);
|
||||
property_table_free(&prop_values);
|
||||
prop_name_idx = prop_value_idx = 0;
|
||||
PROPERTY_STRING_DATA *propdata
|
||||
= openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_STRING_INDEX,
|
||||
&property_string_data_method);
|
||||
|
||||
if (propdata == NULL)
|
||||
return 0;
|
||||
return ossl_property_string(propdata->prop_values,
|
||||
create ? &propdata->prop_value_idx : NULL,
|
||||
s);
|
||||
}
|
||||
Reference in New Issue
Block a user