1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 2019-2023 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 <stdarg.h> 12e1051a39Sopenharmony_ci#include <openssl/evp.h> 13e1051a39Sopenharmony_ci#include "testutil.h" 14e1051a39Sopenharmony_ci#include "internal/nelem.h" 15e1051a39Sopenharmony_ci#include "internal/property.h" 16e1051a39Sopenharmony_ci#include "../crypto/property/property_local.h" 17e1051a39Sopenharmony_ci 18e1051a39Sopenharmony_ci/* 19e1051a39Sopenharmony_ci * We make our OSSL_PROVIDER for testing purposes. All we really need is 20e1051a39Sopenharmony_ci * a pointer. We know that as long as we don't try to use the method 21e1051a39Sopenharmony_ci * cache flush functions, the provider pointer is merely a pointer being 22e1051a39Sopenharmony_ci * passed around, and used as a tag of sorts. 23e1051a39Sopenharmony_ci */ 24e1051a39Sopenharmony_cistruct ossl_provider_st { 25e1051a39Sopenharmony_ci int x; 26e1051a39Sopenharmony_ci}; 27e1051a39Sopenharmony_ci 28e1051a39Sopenharmony_cistatic int add_property_names(const char *n, ...) 29e1051a39Sopenharmony_ci{ 30e1051a39Sopenharmony_ci va_list args; 31e1051a39Sopenharmony_ci int res = 1; 32e1051a39Sopenharmony_ci 33e1051a39Sopenharmony_ci va_start(args, n); 34e1051a39Sopenharmony_ci do { 35e1051a39Sopenharmony_ci if (!TEST_int_ne(ossl_property_name(NULL, n, 1), 0)) 36e1051a39Sopenharmony_ci res = 0; 37e1051a39Sopenharmony_ci } while ((n = va_arg(args, const char *)) != NULL); 38e1051a39Sopenharmony_ci va_end(args); 39e1051a39Sopenharmony_ci return res; 40e1051a39Sopenharmony_ci} 41e1051a39Sopenharmony_ci 42e1051a39Sopenharmony_cistatic int up_ref(void *p) 43e1051a39Sopenharmony_ci{ 44e1051a39Sopenharmony_ci return 1; 45e1051a39Sopenharmony_ci} 46e1051a39Sopenharmony_ci 47e1051a39Sopenharmony_cistatic void down_ref(void *p) 48e1051a39Sopenharmony_ci{ 49e1051a39Sopenharmony_ci} 50e1051a39Sopenharmony_ci 51e1051a39Sopenharmony_cistatic int test_property_string(void) 52e1051a39Sopenharmony_ci{ 53e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 54e1051a39Sopenharmony_ci int res = 0; 55e1051a39Sopenharmony_ci OSSL_PROPERTY_IDX i, j; 56e1051a39Sopenharmony_ci 57e1051a39Sopenharmony_ci if (TEST_ptr(store = ossl_method_store_new(NULL)) 58e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_name(NULL, "fnord", 0), 0) 59e1051a39Sopenharmony_ci && TEST_int_ne(ossl_property_name(NULL, "fnord", 1), 0) 60e1051a39Sopenharmony_ci && TEST_int_ne(ossl_property_name(NULL, "name", 1), 0) 61e1051a39Sopenharmony_ci /* Property value checks */ 62e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_value(NULL, "fnord", 0), 0) 63e1051a39Sopenharmony_ci && TEST_int_ne(i = ossl_property_value(NULL, "no", 0), 0) 64e1051a39Sopenharmony_ci && TEST_int_ne(j = ossl_property_value(NULL, "yes", 0), 0) 65e1051a39Sopenharmony_ci && TEST_int_ne(i, j) 66e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_value(NULL, "yes", 1), j) 67e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_value(NULL, "no", 1), i) 68e1051a39Sopenharmony_ci && TEST_int_ne(i = ossl_property_value(NULL, "illuminati", 1), 0) 69e1051a39Sopenharmony_ci && TEST_int_eq(j = ossl_property_value(NULL, "fnord", 1), i + 1) 70e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_value(NULL, "fnord", 1), j) 71e1051a39Sopenharmony_ci /* Check name and values are distinct */ 72e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_value(NULL, "cold", 0), 0) 73e1051a39Sopenharmony_ci && TEST_int_ne(ossl_property_name(NULL, "fnord", 0), 74e1051a39Sopenharmony_ci ossl_property_value(NULL, "fnord", 0))) 75e1051a39Sopenharmony_ci res = 1; 76e1051a39Sopenharmony_ci ossl_method_store_free(store); 77e1051a39Sopenharmony_ci return res; 78e1051a39Sopenharmony_ci} 79e1051a39Sopenharmony_ci 80e1051a39Sopenharmony_cistatic const struct { 81e1051a39Sopenharmony_ci const char *defn; 82e1051a39Sopenharmony_ci const char *query; 83e1051a39Sopenharmony_ci int e; 84e1051a39Sopenharmony_ci} parser_tests[] = { 85e1051a39Sopenharmony_ci { "", "sky=blue", -1 }, 86e1051a39Sopenharmony_ci { "", "sky!=blue", 1 }, 87e1051a39Sopenharmony_ci { "groan", "", 0 }, 88e1051a39Sopenharmony_ci { "cold=yes", "cold=yes", 1 }, 89e1051a39Sopenharmony_ci { "cold=yes", "cold", 1 }, 90e1051a39Sopenharmony_ci { "cold=yes", "cold!=no", 1 }, 91e1051a39Sopenharmony_ci { "groan", "groan=yes", 1 }, 92e1051a39Sopenharmony_ci { "groan", "groan=no", -1 }, 93e1051a39Sopenharmony_ci { "groan", "groan!=yes", -1 }, 94e1051a39Sopenharmony_ci { "cold=no", "cold", -1 }, 95e1051a39Sopenharmony_ci { "cold=no", "?cold", 0 }, 96e1051a39Sopenharmony_ci { "cold=no", "cold=no", 1 }, 97e1051a39Sopenharmony_ci { "groan", "cold", -1 }, 98e1051a39Sopenharmony_ci { "groan", "cold=no", 1 }, 99e1051a39Sopenharmony_ci { "groan", "cold!=yes", 1 }, 100e1051a39Sopenharmony_ci { "groan=blue", "groan=yellow", -1 }, 101e1051a39Sopenharmony_ci { "groan=blue", "?groan=yellow", 0 }, 102e1051a39Sopenharmony_ci { "groan=blue", "groan!=yellow", 1 }, 103e1051a39Sopenharmony_ci { "groan=blue", "?groan!=yellow", 1 }, 104e1051a39Sopenharmony_ci { "today=monday, tomorrow=3", "today!=2", 1 }, 105e1051a39Sopenharmony_ci { "today=monday, tomorrow=3", "today!='monday'", -1 }, 106e1051a39Sopenharmony_ci { "today=monday, tomorrow=3", "tomorrow=3", 1 }, 107e1051a39Sopenharmony_ci { "n=0x3", "n=3", 1 }, 108e1051a39Sopenharmony_ci { "n=0x3", "n=-3", -1 }, 109e1051a39Sopenharmony_ci { "n=0x33", "n=51", 1 }, 110e1051a39Sopenharmony_ci { "n=033", "n=27", 1 }, 111e1051a39Sopenharmony_ci { "n=0", "n=00", 1 }, 112e1051a39Sopenharmony_ci { "n=0x0", "n=0", 1 }, 113e1051a39Sopenharmony_ci { "n=0, sky=blue", "?n=0, sky=blue", 2 }, 114e1051a39Sopenharmony_ci { "n=1, sky=blue", "?n=0, sky=blue", 1 }, 115e1051a39Sopenharmony_ci}; 116e1051a39Sopenharmony_ci 117e1051a39Sopenharmony_cistatic int test_property_parse(int n) 118e1051a39Sopenharmony_ci{ 119e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 120e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *p = NULL, *q = NULL; 121e1051a39Sopenharmony_ci int r = 0; 122e1051a39Sopenharmony_ci 123e1051a39Sopenharmony_ci if (TEST_ptr(store = ossl_method_store_new(NULL)) 124e1051a39Sopenharmony_ci && add_property_names("sky", "groan", "cold", "today", "tomorrow", "n", 125e1051a39Sopenharmony_ci NULL) 126e1051a39Sopenharmony_ci && TEST_ptr(p = ossl_parse_property(NULL, parser_tests[n].defn)) 127e1051a39Sopenharmony_ci && TEST_ptr(q = ossl_parse_query(NULL, parser_tests[n].query, 0)) 128e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_match_count(q, p), parser_tests[n].e)) 129e1051a39Sopenharmony_ci r = 1; 130e1051a39Sopenharmony_ci ossl_property_free(p); 131e1051a39Sopenharmony_ci ossl_property_free(q); 132e1051a39Sopenharmony_ci ossl_method_store_free(store); 133e1051a39Sopenharmony_ci return r; 134e1051a39Sopenharmony_ci} 135e1051a39Sopenharmony_ci 136e1051a39Sopenharmony_cistatic int test_property_query_value_create(void) 137e1051a39Sopenharmony_ci{ 138e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 139e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *p = NULL, *q = NULL, *o = NULL; 140e1051a39Sopenharmony_ci int r = 0; 141e1051a39Sopenharmony_ci 142e1051a39Sopenharmony_ci /* The property value used here must not be used in other test cases */ 143e1051a39Sopenharmony_ci if (TEST_ptr(store = ossl_method_store_new(NULL)) 144e1051a39Sopenharmony_ci && add_property_names("wood", NULL) 145e1051a39Sopenharmony_ci && TEST_ptr(p = ossl_parse_query(NULL, "wood=oak", 0)) /* undefined */ 146e1051a39Sopenharmony_ci && TEST_ptr(q = ossl_parse_query(NULL, "wood=oak", 1)) /* creates */ 147e1051a39Sopenharmony_ci && TEST_ptr(o = ossl_parse_query(NULL, "wood=oak", 0)) /* defined */ 148e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_match_count(q, p), -1) 149e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_match_count(q, o), 1)) 150e1051a39Sopenharmony_ci r = 1; 151e1051a39Sopenharmony_ci ossl_property_free(o); 152e1051a39Sopenharmony_ci ossl_property_free(p); 153e1051a39Sopenharmony_ci ossl_property_free(q); 154e1051a39Sopenharmony_ci ossl_method_store_free(store); 155e1051a39Sopenharmony_ci return r; 156e1051a39Sopenharmony_ci} 157e1051a39Sopenharmony_ci 158e1051a39Sopenharmony_cistatic const struct { 159e1051a39Sopenharmony_ci int query; 160e1051a39Sopenharmony_ci const char *ps; 161e1051a39Sopenharmony_ci} parse_error_tests[] = { 162e1051a39Sopenharmony_ci { 0, "n=1, n=1" }, /* duplicate name */ 163e1051a39Sopenharmony_ci { 0, "n=1, a=hi, n=1" }, /* duplicate name */ 164e1051a39Sopenharmony_ci { 1, "n=1, a=bye, ?n=0" }, /* duplicate name */ 165e1051a39Sopenharmony_ci { 0, "a=abc,#@!, n=1" }, /* non-ASCII character located */ 166e1051a39Sopenharmony_ci { 1, "a='Hello" }, /* Unterminated string */ 167e1051a39Sopenharmony_ci { 0, "a=\"World" }, /* Unterminated string */ 168e1051a39Sopenharmony_ci { 0, "a=_abd_" }, /* Unquoted string not starting with alphabetic */ 169e1051a39Sopenharmony_ci { 1, "a=2, n=012345678" }, /* Bad octal digit */ 170e1051a39Sopenharmony_ci { 0, "n=0x28FG, a=3" }, /* Bad hex digit */ 171e1051a39Sopenharmony_ci { 0, "n=145d, a=2" }, /* Bad decimal digit */ 172e1051a39Sopenharmony_ci { 1, "@='hello'" }, /* Invalid name */ 173e1051a39Sopenharmony_ci { 1, "n0123456789012345678901234567890123456789" 174e1051a39Sopenharmony_ci "0123456789012345678901234567890123456789" 175e1051a39Sopenharmony_ci "0123456789012345678901234567890123456789" 176e1051a39Sopenharmony_ci "0123456789012345678901234567890123456789=yes" }, /* Name too long */ 177e1051a39Sopenharmony_ci { 0, ".n=3" }, /* Invalid name */ 178e1051a39Sopenharmony_ci { 1, "fnord.fnord.=3" } /* Invalid name */ 179e1051a39Sopenharmony_ci}; 180e1051a39Sopenharmony_ci 181e1051a39Sopenharmony_cistatic int test_property_parse_error(int n) 182e1051a39Sopenharmony_ci{ 183e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 184e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *p = NULL; 185e1051a39Sopenharmony_ci int r = 0; 186e1051a39Sopenharmony_ci const char *ps; 187e1051a39Sopenharmony_ci 188e1051a39Sopenharmony_ci if (!TEST_ptr(store = ossl_method_store_new(NULL)) 189e1051a39Sopenharmony_ci || !add_property_names("a", "n", NULL)) 190e1051a39Sopenharmony_ci goto err; 191e1051a39Sopenharmony_ci ps = parse_error_tests[n].ps; 192e1051a39Sopenharmony_ci if (parse_error_tests[n].query) { 193e1051a39Sopenharmony_ci if (!TEST_ptr_null(p = ossl_parse_query(NULL, ps, 1))) 194e1051a39Sopenharmony_ci goto err; 195e1051a39Sopenharmony_ci } else if (!TEST_ptr_null(p = ossl_parse_property(NULL, ps))) { 196e1051a39Sopenharmony_ci goto err; 197e1051a39Sopenharmony_ci } 198e1051a39Sopenharmony_ci r = 1; 199e1051a39Sopenharmony_ci err: 200e1051a39Sopenharmony_ci ossl_property_free(p); 201e1051a39Sopenharmony_ci ossl_method_store_free(store); 202e1051a39Sopenharmony_ci return r; 203e1051a39Sopenharmony_ci} 204e1051a39Sopenharmony_ci 205e1051a39Sopenharmony_cistatic const struct { 206e1051a39Sopenharmony_ci const char *q_global; 207e1051a39Sopenharmony_ci const char *q_local; 208e1051a39Sopenharmony_ci const char *prop; 209e1051a39Sopenharmony_ci} merge_tests[] = { 210e1051a39Sopenharmony_ci { "", "colour=blue", "colour=blue" }, 211e1051a39Sopenharmony_ci { "colour=blue", "", "colour=blue" }, 212e1051a39Sopenharmony_ci { "colour=red", "colour=blue", "colour=blue" }, 213e1051a39Sopenharmony_ci { "clouds=pink, urn=red", "urn=blue, colour=green", 214e1051a39Sopenharmony_ci "urn=blue, colour=green, clouds=pink" }, 215e1051a39Sopenharmony_ci { "pot=gold", "urn=blue", "pot=gold, urn=blue" }, 216e1051a39Sopenharmony_ci { "night", "day", "day=yes, night=yes" }, 217e1051a39Sopenharmony_ci { "day", "night", "day=yes, night=yes" }, 218e1051a39Sopenharmony_ci { "", "", "" }, 219e1051a39Sopenharmony_ci /* 220e1051a39Sopenharmony_ci * The following four leave 'day' unspecified in the query, and will match 221e1051a39Sopenharmony_ci * any definition 222e1051a39Sopenharmony_ci */ 223e1051a39Sopenharmony_ci { "day=yes", "-day", "day=no" }, 224e1051a39Sopenharmony_ci { "day=yes", "-day", "day=yes" }, 225e1051a39Sopenharmony_ci { "day=yes", "-day", "day=arglebargle" }, 226e1051a39Sopenharmony_ci { "day=yes", "-day", "pot=sesquioxidizing" }, 227e1051a39Sopenharmony_ci { "day, night", "-night, day", "day=yes, night=no" }, 228e1051a39Sopenharmony_ci { "-day", "day=yes", "day=yes" }, 229e1051a39Sopenharmony_ci}; 230e1051a39Sopenharmony_ci 231e1051a39Sopenharmony_cistatic int test_property_merge(int n) 232e1051a39Sopenharmony_ci{ 233e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 234e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *q_global = NULL, *q_local = NULL; 235e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *q_combined = NULL, *prop = NULL; 236e1051a39Sopenharmony_ci int r = 0; 237e1051a39Sopenharmony_ci 238e1051a39Sopenharmony_ci if (TEST_ptr(store = ossl_method_store_new(NULL)) 239e1051a39Sopenharmony_ci && add_property_names("colour", "urn", "clouds", "pot", "day", "night", 240e1051a39Sopenharmony_ci NULL) 241e1051a39Sopenharmony_ci && TEST_ptr(prop = ossl_parse_property(NULL, merge_tests[n].prop)) 242e1051a39Sopenharmony_ci && TEST_ptr(q_global = ossl_parse_query(NULL, merge_tests[n].q_global, 243e1051a39Sopenharmony_ci 0)) 244e1051a39Sopenharmony_ci && TEST_ptr(q_local = ossl_parse_query(NULL, merge_tests[n].q_local, 0)) 245e1051a39Sopenharmony_ci && TEST_ptr(q_combined = ossl_property_merge(q_local, q_global)) 246e1051a39Sopenharmony_ci && TEST_int_ge(ossl_property_match_count(q_combined, prop), 0)) 247e1051a39Sopenharmony_ci r = 1; 248e1051a39Sopenharmony_ci ossl_property_free(q_global); 249e1051a39Sopenharmony_ci ossl_property_free(q_local); 250e1051a39Sopenharmony_ci ossl_property_free(q_combined); 251e1051a39Sopenharmony_ci ossl_property_free(prop); 252e1051a39Sopenharmony_ci ossl_method_store_free(store); 253e1051a39Sopenharmony_ci return r; 254e1051a39Sopenharmony_ci} 255e1051a39Sopenharmony_ci 256e1051a39Sopenharmony_cistatic int test_property_defn_cache(void) 257e1051a39Sopenharmony_ci{ 258e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 259e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *red = NULL, *blue = NULL, *blue2 = NULL; 260e1051a39Sopenharmony_ci int r; 261e1051a39Sopenharmony_ci 262e1051a39Sopenharmony_ci r = TEST_ptr(store = ossl_method_store_new(NULL)) 263e1051a39Sopenharmony_ci && add_property_names("red", "blue", NULL) 264e1051a39Sopenharmony_ci && TEST_ptr(red = ossl_parse_property(NULL, "red")) 265e1051a39Sopenharmony_ci && TEST_ptr(blue = ossl_parse_property(NULL, "blue")) 266e1051a39Sopenharmony_ci && TEST_ptr_ne(red, blue) 267e1051a39Sopenharmony_ci && TEST_true(ossl_prop_defn_set(NULL, "red", &red)); 268e1051a39Sopenharmony_ci 269e1051a39Sopenharmony_ci if (!r) { 270e1051a39Sopenharmony_ci ossl_property_free(red); 271e1051a39Sopenharmony_ci red = NULL; 272e1051a39Sopenharmony_ci ossl_property_free(blue); 273e1051a39Sopenharmony_ci blue = NULL; 274e1051a39Sopenharmony_ci } 275e1051a39Sopenharmony_ci 276e1051a39Sopenharmony_ci r = r && TEST_true(ossl_prop_defn_set(NULL, "blue", &blue)); 277e1051a39Sopenharmony_ci if (!r) { 278e1051a39Sopenharmony_ci ossl_property_free(blue); 279e1051a39Sopenharmony_ci blue = NULL; 280e1051a39Sopenharmony_ci } 281e1051a39Sopenharmony_ci 282e1051a39Sopenharmony_ci r = r && TEST_ptr_eq(ossl_prop_defn_get(NULL, "red"), red) 283e1051a39Sopenharmony_ci && TEST_ptr_eq(ossl_prop_defn_get(NULL, "blue"), blue) 284e1051a39Sopenharmony_ci && TEST_ptr(blue2 = ossl_parse_property(NULL, "blue")) 285e1051a39Sopenharmony_ci && TEST_ptr_ne(blue2, blue) 286e1051a39Sopenharmony_ci && TEST_true(ossl_prop_defn_set(NULL, "blue", &blue2)); 287e1051a39Sopenharmony_ci if (!r) { 288e1051a39Sopenharmony_ci ossl_property_free(blue2); 289e1051a39Sopenharmony_ci blue2 = NULL; 290e1051a39Sopenharmony_ci } 291e1051a39Sopenharmony_ci 292e1051a39Sopenharmony_ci r = r && TEST_ptr_eq(blue2, blue) 293e1051a39Sopenharmony_ci && TEST_ptr_eq(ossl_prop_defn_get(NULL, "blue"), blue); 294e1051a39Sopenharmony_ci 295e1051a39Sopenharmony_ci ossl_method_store_free(store); 296e1051a39Sopenharmony_ci return r; 297e1051a39Sopenharmony_ci} 298e1051a39Sopenharmony_ci 299e1051a39Sopenharmony_cistatic const struct { 300e1051a39Sopenharmony_ci const char *defn; 301e1051a39Sopenharmony_ci const char *query; 302e1051a39Sopenharmony_ci int e; 303e1051a39Sopenharmony_ci} definition_tests[] = { 304e1051a39Sopenharmony_ci { "alpha", "alpha=yes", 1 }, 305e1051a39Sopenharmony_ci { "alpha=no", "alpha", -1 }, 306e1051a39Sopenharmony_ci { "alpha=1", "alpha=1", 1 }, 307e1051a39Sopenharmony_ci { "alpha=2", "alpha=1",-1 }, 308e1051a39Sopenharmony_ci { "alpha", "omega", -1 }, 309e1051a39Sopenharmony_ci { "alpha", "?omega", 0 }, 310e1051a39Sopenharmony_ci { "alpha", "?omega=1", 0 }, 311e1051a39Sopenharmony_ci { "alpha", "?omega=no", 1 }, 312e1051a39Sopenharmony_ci { "alpha", "?omega=yes", 0 }, 313e1051a39Sopenharmony_ci { "alpha, omega", "?omega=yes", 1 }, 314e1051a39Sopenharmony_ci { "alpha, omega", "?omega=no", 0 } 315e1051a39Sopenharmony_ci}; 316e1051a39Sopenharmony_ci 317e1051a39Sopenharmony_cistatic int test_definition_compares(int n) 318e1051a39Sopenharmony_ci{ 319e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 320e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *d = NULL, *q = NULL; 321e1051a39Sopenharmony_ci int r; 322e1051a39Sopenharmony_ci 323e1051a39Sopenharmony_ci r = TEST_ptr(store = ossl_method_store_new(NULL)) 324e1051a39Sopenharmony_ci && add_property_names("alpha", "omega", NULL) 325e1051a39Sopenharmony_ci && TEST_ptr(d = ossl_parse_property(NULL, definition_tests[n].defn)) 326e1051a39Sopenharmony_ci && TEST_ptr(q = ossl_parse_query(NULL, definition_tests[n].query, 0)) 327e1051a39Sopenharmony_ci && TEST_int_eq(ossl_property_match_count(q, d), definition_tests[n].e); 328e1051a39Sopenharmony_ci 329e1051a39Sopenharmony_ci ossl_property_free(d); 330e1051a39Sopenharmony_ci ossl_property_free(q); 331e1051a39Sopenharmony_ci ossl_method_store_free(store); 332e1051a39Sopenharmony_ci return r; 333e1051a39Sopenharmony_ci} 334e1051a39Sopenharmony_ci 335e1051a39Sopenharmony_cistatic int test_register_deregister(void) 336e1051a39Sopenharmony_ci{ 337e1051a39Sopenharmony_ci static const struct { 338e1051a39Sopenharmony_ci int nid; 339e1051a39Sopenharmony_ci const char *prop; 340e1051a39Sopenharmony_ci char *impl; 341e1051a39Sopenharmony_ci } impls[] = { 342e1051a39Sopenharmony_ci { 6, "position=1", "a" }, 343e1051a39Sopenharmony_ci { 6, "position=2", "b" }, 344e1051a39Sopenharmony_ci { 6, "position=3", "c" }, 345e1051a39Sopenharmony_ci { 6, "position=4", "d" }, 346e1051a39Sopenharmony_ci }; 347e1051a39Sopenharmony_ci size_t i; 348e1051a39Sopenharmony_ci int ret = 0; 349e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 350e1051a39Sopenharmony_ci OSSL_PROVIDER prov = { 1 }; 351e1051a39Sopenharmony_ci 352e1051a39Sopenharmony_ci if (!TEST_ptr(store = ossl_method_store_new(NULL)) 353e1051a39Sopenharmony_ci || !add_property_names("position", NULL)) 354e1051a39Sopenharmony_ci goto err; 355e1051a39Sopenharmony_ci 356e1051a39Sopenharmony_ci for (i = 0; i < OSSL_NELEM(impls); i++) 357e1051a39Sopenharmony_ci if (!TEST_true(ossl_method_store_add(store, &prov, impls[i].nid, 358e1051a39Sopenharmony_ci impls[i].prop, impls[i].impl, 359e1051a39Sopenharmony_ci &up_ref, &down_ref))) { 360e1051a39Sopenharmony_ci TEST_note("iteration %zd", i + 1); 361e1051a39Sopenharmony_ci goto err; 362e1051a39Sopenharmony_ci } 363e1051a39Sopenharmony_ci 364e1051a39Sopenharmony_ci /* Deregister in a different order to registration */ 365e1051a39Sopenharmony_ci for (i = 0; i < OSSL_NELEM(impls); i++) { 366e1051a39Sopenharmony_ci const size_t j = (1 + i * 3) % OSSL_NELEM(impls); 367e1051a39Sopenharmony_ci int nid = impls[j].nid; 368e1051a39Sopenharmony_ci void *impl = impls[j].impl; 369e1051a39Sopenharmony_ci 370e1051a39Sopenharmony_ci if (!TEST_true(ossl_method_store_remove(store, nid, impl)) 371e1051a39Sopenharmony_ci || !TEST_false(ossl_method_store_remove(store, nid, impl))) { 372e1051a39Sopenharmony_ci TEST_note("iteration %zd, position %zd", i + 1, j + 1); 373e1051a39Sopenharmony_ci goto err; 374e1051a39Sopenharmony_ci } 375e1051a39Sopenharmony_ci } 376e1051a39Sopenharmony_ci 377e1051a39Sopenharmony_ci if (TEST_false(ossl_method_store_remove(store, impls[0].nid, impls[0].impl))) 378e1051a39Sopenharmony_ci ret = 1; 379e1051a39Sopenharmony_cierr: 380e1051a39Sopenharmony_ci ossl_method_store_free(store); 381e1051a39Sopenharmony_ci return ret; 382e1051a39Sopenharmony_ci} 383e1051a39Sopenharmony_ci 384e1051a39Sopenharmony_cistatic int test_property(void) 385e1051a39Sopenharmony_ci{ 386e1051a39Sopenharmony_ci static OSSL_PROVIDER fake_provider1 = { 1 }; 387e1051a39Sopenharmony_ci static OSSL_PROVIDER fake_provider2 = { 2 }; 388e1051a39Sopenharmony_ci static const OSSL_PROVIDER *fake_prov1 = &fake_provider1; 389e1051a39Sopenharmony_ci static const OSSL_PROVIDER *fake_prov2 = &fake_provider2; 390e1051a39Sopenharmony_ci static const struct { 391e1051a39Sopenharmony_ci const OSSL_PROVIDER **prov; 392e1051a39Sopenharmony_ci int nid; 393e1051a39Sopenharmony_ci const char *prop; 394e1051a39Sopenharmony_ci char *impl; 395e1051a39Sopenharmony_ci } impls[] = { 396e1051a39Sopenharmony_ci { &fake_prov1, 1, "fast=no, colour=green", "a" }, 397e1051a39Sopenharmony_ci { &fake_prov1, 1, "fast, colour=blue", "b" }, 398e1051a39Sopenharmony_ci { &fake_prov1, 1, "", "-" }, 399e1051a39Sopenharmony_ci { &fake_prov2, 9, "sky=blue, furry", "c" }, 400e1051a39Sopenharmony_ci { &fake_prov2, 3, NULL, "d" }, 401e1051a39Sopenharmony_ci { &fake_prov2, 6, "sky.colour=blue, sky=green, old.data", "e" }, 402e1051a39Sopenharmony_ci }; 403e1051a39Sopenharmony_ci static struct { 404e1051a39Sopenharmony_ci const OSSL_PROVIDER **prov; 405e1051a39Sopenharmony_ci int nid; 406e1051a39Sopenharmony_ci const char *prop; 407e1051a39Sopenharmony_ci char *expected; 408e1051a39Sopenharmony_ci } queries[] = { 409e1051a39Sopenharmony_ci { &fake_prov1, 1, "fast", "b" }, 410e1051a39Sopenharmony_ci { &fake_prov1, 1, "fast=yes", "b" }, 411e1051a39Sopenharmony_ci { &fake_prov1, 1, "fast=no, colour=green", "a" }, 412e1051a39Sopenharmony_ci { &fake_prov1, 1, "colour=blue, fast", "b" }, 413e1051a39Sopenharmony_ci { &fake_prov1, 1, "colour=blue", "b" }, 414e1051a39Sopenharmony_ci { &fake_prov2, 9, "furry", "c" }, 415e1051a39Sopenharmony_ci { &fake_prov2, 6, "sky.colour=blue", "e" }, 416e1051a39Sopenharmony_ci { &fake_prov2, 6, "old.data", "e" }, 417e1051a39Sopenharmony_ci { &fake_prov2, 9, "furry=yes, sky=blue", "c" }, 418e1051a39Sopenharmony_ci { &fake_prov1, 1, "", "a" }, 419e1051a39Sopenharmony_ci { &fake_prov2, 3, "", "d" }, 420e1051a39Sopenharmony_ci }; 421e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 422e1051a39Sopenharmony_ci size_t i; 423e1051a39Sopenharmony_ci int ret = 0; 424e1051a39Sopenharmony_ci void *result; 425e1051a39Sopenharmony_ci 426e1051a39Sopenharmony_ci if (!TEST_ptr(store = ossl_method_store_new(NULL)) 427e1051a39Sopenharmony_ci || !add_property_names("fast", "colour", "sky", "furry", NULL)) 428e1051a39Sopenharmony_ci goto err; 429e1051a39Sopenharmony_ci 430e1051a39Sopenharmony_ci for (i = 0; i < OSSL_NELEM(impls); i++) 431e1051a39Sopenharmony_ci if (!TEST_true(ossl_method_store_add(store, *impls[i].prov, 432e1051a39Sopenharmony_ci impls[i].nid, impls[i].prop, 433e1051a39Sopenharmony_ci impls[i].impl, 434e1051a39Sopenharmony_ci &up_ref, &down_ref))) { 435e1051a39Sopenharmony_ci TEST_note("iteration %zd", i + 1); 436e1051a39Sopenharmony_ci goto err; 437e1051a39Sopenharmony_ci } 438e1051a39Sopenharmony_ci /* 439e1051a39Sopenharmony_ci * The first check of queries is with NULL given as provider. All 440e1051a39Sopenharmony_ci * queries are expected to succeed. 441e1051a39Sopenharmony_ci */ 442e1051a39Sopenharmony_ci for (i = 0; i < OSSL_NELEM(queries); i++) { 443e1051a39Sopenharmony_ci const OSSL_PROVIDER *nullprov = NULL; 444e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *pq = NULL; 445e1051a39Sopenharmony_ci 446e1051a39Sopenharmony_ci if (!TEST_true(ossl_method_store_fetch(store, 447e1051a39Sopenharmony_ci queries[i].nid, queries[i].prop, 448e1051a39Sopenharmony_ci &nullprov, &result)) 449e1051a39Sopenharmony_ci || !TEST_str_eq((char *)result, queries[i].expected)) { 450e1051a39Sopenharmony_ci TEST_note("iteration %zd", i + 1); 451e1051a39Sopenharmony_ci ossl_property_free(pq); 452e1051a39Sopenharmony_ci goto err; 453e1051a39Sopenharmony_ci } 454e1051a39Sopenharmony_ci ossl_property_free(pq); 455e1051a39Sopenharmony_ci } 456e1051a39Sopenharmony_ci /* 457e1051a39Sopenharmony_ci * The second check of queries is with &address1 given as provider. 458e1051a39Sopenharmony_ci */ 459e1051a39Sopenharmony_ci for (i = 0; i < OSSL_NELEM(queries); i++) { 460e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *pq = NULL; 461e1051a39Sopenharmony_ci 462e1051a39Sopenharmony_ci result = NULL; 463e1051a39Sopenharmony_ci if (queries[i].prov == &fake_prov1) { 464e1051a39Sopenharmony_ci if (!TEST_true(ossl_method_store_fetch(store, 465e1051a39Sopenharmony_ci queries[i].nid, 466e1051a39Sopenharmony_ci queries[i].prop, 467e1051a39Sopenharmony_ci &fake_prov1, &result)) 468e1051a39Sopenharmony_ci || !TEST_ptr_eq(fake_prov1, &fake_provider1) 469e1051a39Sopenharmony_ci || !TEST_str_eq((char *)result, queries[i].expected)) { 470e1051a39Sopenharmony_ci TEST_note("iteration %zd", i + 1); 471e1051a39Sopenharmony_ci ossl_property_free(pq); 472e1051a39Sopenharmony_ci goto err; 473e1051a39Sopenharmony_ci } 474e1051a39Sopenharmony_ci } else { 475e1051a39Sopenharmony_ci if (!TEST_false(ossl_method_store_fetch(store, 476e1051a39Sopenharmony_ci queries[i].nid, 477e1051a39Sopenharmony_ci queries[i].prop, 478e1051a39Sopenharmony_ci &fake_prov1, &result)) 479e1051a39Sopenharmony_ci || !TEST_ptr_eq(fake_prov1, &fake_provider1) 480e1051a39Sopenharmony_ci || !TEST_ptr_null(result)) { 481e1051a39Sopenharmony_ci TEST_note("iteration %zd", i + 1); 482e1051a39Sopenharmony_ci ossl_property_free(pq); 483e1051a39Sopenharmony_ci goto err; 484e1051a39Sopenharmony_ci } 485e1051a39Sopenharmony_ci } 486e1051a39Sopenharmony_ci ossl_property_free(pq); 487e1051a39Sopenharmony_ci } 488e1051a39Sopenharmony_ci /* 489e1051a39Sopenharmony_ci * The third check of queries is with &address2 given as provider. 490e1051a39Sopenharmony_ci */ 491e1051a39Sopenharmony_ci for (i = 0; i < OSSL_NELEM(queries); i++) { 492e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *pq = NULL; 493e1051a39Sopenharmony_ci 494e1051a39Sopenharmony_ci result = NULL; 495e1051a39Sopenharmony_ci if (queries[i].prov == &fake_prov2) { 496e1051a39Sopenharmony_ci if (!TEST_true(ossl_method_store_fetch(store, 497e1051a39Sopenharmony_ci queries[i].nid, 498e1051a39Sopenharmony_ci queries[i].prop, 499e1051a39Sopenharmony_ci &fake_prov2, &result)) 500e1051a39Sopenharmony_ci || !TEST_ptr_eq(fake_prov2, &fake_provider2) 501e1051a39Sopenharmony_ci || !TEST_str_eq((char *)result, queries[i].expected)) { 502e1051a39Sopenharmony_ci TEST_note("iteration %zd", i + 1); 503e1051a39Sopenharmony_ci ossl_property_free(pq); 504e1051a39Sopenharmony_ci goto err; 505e1051a39Sopenharmony_ci } 506e1051a39Sopenharmony_ci } else { 507e1051a39Sopenharmony_ci if (!TEST_false(ossl_method_store_fetch(store, 508e1051a39Sopenharmony_ci queries[i].nid, 509e1051a39Sopenharmony_ci queries[i].prop, 510e1051a39Sopenharmony_ci &fake_prov2, &result)) 511e1051a39Sopenharmony_ci || !TEST_ptr_eq(fake_prov2, &fake_provider2) 512e1051a39Sopenharmony_ci || !TEST_ptr_null(result)) { 513e1051a39Sopenharmony_ci TEST_note("iteration %zd", i + 1); 514e1051a39Sopenharmony_ci ossl_property_free(pq); 515e1051a39Sopenharmony_ci goto err; 516e1051a39Sopenharmony_ci } 517e1051a39Sopenharmony_ci } 518e1051a39Sopenharmony_ci ossl_property_free(pq); 519e1051a39Sopenharmony_ci } 520e1051a39Sopenharmony_ci ret = 1; 521e1051a39Sopenharmony_cierr: 522e1051a39Sopenharmony_ci ossl_method_store_free(store); 523e1051a39Sopenharmony_ci return ret; 524e1051a39Sopenharmony_ci} 525e1051a39Sopenharmony_ci 526e1051a39Sopenharmony_cistatic int test_query_cache_stochastic(void) 527e1051a39Sopenharmony_ci{ 528e1051a39Sopenharmony_ci const int max = 10000, tail = 10; 529e1051a39Sopenharmony_ci OSSL_METHOD_STORE *store; 530e1051a39Sopenharmony_ci int i, res = 0; 531e1051a39Sopenharmony_ci char buf[50]; 532e1051a39Sopenharmony_ci void *result; 533e1051a39Sopenharmony_ci int errors = 0; 534e1051a39Sopenharmony_ci int v[10001]; 535e1051a39Sopenharmony_ci OSSL_PROVIDER prov = { 1 }; 536e1051a39Sopenharmony_ci 537e1051a39Sopenharmony_ci if (!TEST_ptr(store = ossl_method_store_new(NULL)) 538e1051a39Sopenharmony_ci || !add_property_names("n", NULL)) 539e1051a39Sopenharmony_ci goto err; 540e1051a39Sopenharmony_ci 541e1051a39Sopenharmony_ci for (i = 1; i <= max; i++) { 542e1051a39Sopenharmony_ci v[i] = 2 * i; 543e1051a39Sopenharmony_ci BIO_snprintf(buf, sizeof(buf), "n=%d\n", i); 544e1051a39Sopenharmony_ci if (!TEST_true(ossl_method_store_add(store, &prov, i, buf, "abc", 545e1051a39Sopenharmony_ci &up_ref, &down_ref)) 546e1051a39Sopenharmony_ci || !TEST_true(ossl_method_store_cache_set(store, &prov, i, 547e1051a39Sopenharmony_ci buf, v + i, 548e1051a39Sopenharmony_ci &up_ref, &down_ref)) 549e1051a39Sopenharmony_ci || !TEST_true(ossl_method_store_cache_set(store, &prov, i, 550e1051a39Sopenharmony_ci "n=1234", "miss", 551e1051a39Sopenharmony_ci &up_ref, &down_ref))) { 552e1051a39Sopenharmony_ci TEST_note("iteration %d", i); 553e1051a39Sopenharmony_ci goto err; 554e1051a39Sopenharmony_ci } 555e1051a39Sopenharmony_ci } 556e1051a39Sopenharmony_ci for (i = 1; i <= max; i++) { 557e1051a39Sopenharmony_ci BIO_snprintf(buf, sizeof(buf), "n=%d\n", i); 558e1051a39Sopenharmony_ci if (!ossl_method_store_cache_get(store, NULL, i, buf, &result) 559e1051a39Sopenharmony_ci || result != v + i) 560e1051a39Sopenharmony_ci errors++; 561e1051a39Sopenharmony_ci } 562e1051a39Sopenharmony_ci /* There is a tiny probability that this will fail when it shouldn't */ 563e1051a39Sopenharmony_ci res = TEST_int_gt(errors, tail) && TEST_int_lt(errors, max - tail); 564e1051a39Sopenharmony_ci 565e1051a39Sopenharmony_cierr: 566e1051a39Sopenharmony_ci ossl_method_store_free(store); 567e1051a39Sopenharmony_ci return res; 568e1051a39Sopenharmony_ci} 569e1051a39Sopenharmony_ci 570e1051a39Sopenharmony_cistatic int test_fips_mode(void) 571e1051a39Sopenharmony_ci{ 572e1051a39Sopenharmony_ci int ret = 0; 573e1051a39Sopenharmony_ci OSSL_LIB_CTX *ctx = NULL; 574e1051a39Sopenharmony_ci 575e1051a39Sopenharmony_ci if (!TEST_ptr(ctx = OSSL_LIB_CTX_new())) 576e1051a39Sopenharmony_ci goto err; 577e1051a39Sopenharmony_ci 578e1051a39Sopenharmony_ci ret = TEST_true(EVP_set_default_properties(ctx, "default=yes,fips=yes")) 579e1051a39Sopenharmony_ci && TEST_true(EVP_default_properties_is_fips_enabled(ctx)) 580e1051a39Sopenharmony_ci && TEST_true(EVP_set_default_properties(ctx, "fips=no,default=yes")) 581e1051a39Sopenharmony_ci && TEST_false(EVP_default_properties_is_fips_enabled(ctx)) 582e1051a39Sopenharmony_ci && TEST_true(EVP_set_default_properties(ctx, "fips=no")) 583e1051a39Sopenharmony_ci && TEST_false(EVP_default_properties_is_fips_enabled(ctx)) 584e1051a39Sopenharmony_ci && TEST_true(EVP_set_default_properties(ctx, "fips!=no")) 585e1051a39Sopenharmony_ci && TEST_true(EVP_default_properties_is_fips_enabled(ctx)) 586e1051a39Sopenharmony_ci && TEST_true(EVP_set_default_properties(ctx, "fips=no")) 587e1051a39Sopenharmony_ci && TEST_false(EVP_default_properties_is_fips_enabled(ctx)) 588e1051a39Sopenharmony_ci && TEST_true(EVP_set_default_properties(ctx, "fips=no,default=yes")) 589e1051a39Sopenharmony_ci && TEST_true(EVP_default_properties_enable_fips(ctx, 1)) 590e1051a39Sopenharmony_ci && TEST_true(EVP_default_properties_is_fips_enabled(ctx)) 591e1051a39Sopenharmony_ci && TEST_true(EVP_default_properties_enable_fips(ctx, 0)) 592e1051a39Sopenharmony_ci && TEST_false(EVP_default_properties_is_fips_enabled(ctx)); 593e1051a39Sopenharmony_cierr: 594e1051a39Sopenharmony_ci OSSL_LIB_CTX_free(ctx); 595e1051a39Sopenharmony_ci return ret; 596e1051a39Sopenharmony_ci} 597e1051a39Sopenharmony_ci 598e1051a39Sopenharmony_cistatic struct { 599e1051a39Sopenharmony_ci const char *in; 600e1051a39Sopenharmony_ci const char *out; 601e1051a39Sopenharmony_ci} to_string_tests[] = { 602e1051a39Sopenharmony_ci { "fips=yes", "fips=yes" }, 603e1051a39Sopenharmony_ci { "fips!=yes", "fips!=yes" }, 604e1051a39Sopenharmony_ci { "fips = yes", "fips=yes" }, 605e1051a39Sopenharmony_ci { "fips", "fips=yes" }, 606e1051a39Sopenharmony_ci { "fips=no", "fips=no" }, 607e1051a39Sopenharmony_ci { "-fips", "-fips" }, 608e1051a39Sopenharmony_ci { "?fips=yes", "?fips=yes" }, 609e1051a39Sopenharmony_ci { "fips=yes,provider=fips", "fips=yes,provider=fips" }, 610e1051a39Sopenharmony_ci { "fips = yes , provider = fips", "fips=yes,provider=fips" }, 611e1051a39Sopenharmony_ci { "fips=yes,provider!=fips", "fips=yes,provider!=fips" }, 612e1051a39Sopenharmony_ci { "fips=yes,?provider=fips", "fips=yes,?provider=fips" }, 613e1051a39Sopenharmony_ci { "fips=yes,-provider", "fips=yes,-provider" }, 614e1051a39Sopenharmony_ci /* foo is an unknown internal name */ 615e1051a39Sopenharmony_ci { "foo=yes,fips=yes", "fips=yes"}, 616e1051a39Sopenharmony_ci { "", "" }, 617e1051a39Sopenharmony_ci { "fips=3", "fips=3" }, 618e1051a39Sopenharmony_ci { "fips=-3", "fips=-3" }, 619e1051a39Sopenharmony_ci { NULL, "" } 620e1051a39Sopenharmony_ci}; 621e1051a39Sopenharmony_ci 622e1051a39Sopenharmony_cistatic int test_property_list_to_string(int i) 623e1051a39Sopenharmony_ci{ 624e1051a39Sopenharmony_ci OSSL_PROPERTY_LIST *pl = NULL; 625e1051a39Sopenharmony_ci int ret = 0; 626e1051a39Sopenharmony_ci size_t bufsize; 627e1051a39Sopenharmony_ci char *buf = NULL; 628e1051a39Sopenharmony_ci 629e1051a39Sopenharmony_ci if (to_string_tests[i].in != NULL 630e1051a39Sopenharmony_ci && !TEST_ptr(pl = ossl_parse_query(NULL, to_string_tests[i].in, 1))) 631e1051a39Sopenharmony_ci goto err; 632e1051a39Sopenharmony_ci bufsize = ossl_property_list_to_string(NULL, pl, NULL, 0); 633e1051a39Sopenharmony_ci if (!TEST_size_t_gt(bufsize, 0)) 634e1051a39Sopenharmony_ci goto err; 635e1051a39Sopenharmony_ci buf = OPENSSL_malloc(bufsize); 636e1051a39Sopenharmony_ci if (!TEST_ptr(buf) 637e1051a39Sopenharmony_ci || !TEST_size_t_eq(ossl_property_list_to_string(NULL, pl, buf, 638e1051a39Sopenharmony_ci bufsize), 639e1051a39Sopenharmony_ci bufsize) 640e1051a39Sopenharmony_ci || !TEST_str_eq(to_string_tests[i].out, buf) 641e1051a39Sopenharmony_ci || !TEST_size_t_eq(bufsize, strlen(to_string_tests[i].out) + 1)) 642e1051a39Sopenharmony_ci goto err; 643e1051a39Sopenharmony_ci 644e1051a39Sopenharmony_ci ret = 1; 645e1051a39Sopenharmony_ci err: 646e1051a39Sopenharmony_ci OPENSSL_free(buf); 647e1051a39Sopenharmony_ci ossl_property_free(pl); 648e1051a39Sopenharmony_ci return ret; 649e1051a39Sopenharmony_ci} 650e1051a39Sopenharmony_ci 651e1051a39Sopenharmony_ciint setup_tests(void) 652e1051a39Sopenharmony_ci{ 653e1051a39Sopenharmony_ci ADD_TEST(test_property_string); 654e1051a39Sopenharmony_ci ADD_TEST(test_property_query_value_create); 655e1051a39Sopenharmony_ci ADD_ALL_TESTS(test_property_parse, OSSL_NELEM(parser_tests)); 656e1051a39Sopenharmony_ci ADD_ALL_TESTS(test_property_parse_error, OSSL_NELEM(parse_error_tests)); 657e1051a39Sopenharmony_ci ADD_ALL_TESTS(test_property_merge, OSSL_NELEM(merge_tests)); 658e1051a39Sopenharmony_ci ADD_TEST(test_property_defn_cache); 659e1051a39Sopenharmony_ci ADD_ALL_TESTS(test_definition_compares, OSSL_NELEM(definition_tests)); 660e1051a39Sopenharmony_ci ADD_TEST(test_register_deregister); 661e1051a39Sopenharmony_ci ADD_TEST(test_property); 662e1051a39Sopenharmony_ci ADD_TEST(test_query_cache_stochastic); 663e1051a39Sopenharmony_ci ADD_TEST(test_fips_mode); 664e1051a39Sopenharmony_ci ADD_ALL_TESTS(test_property_list_to_string, OSSL_NELEM(to_string_tests)); 665e1051a39Sopenharmony_ci return 1; 666e1051a39Sopenharmony_ci} 667