OSSL_PARAM_UNSIGNED_INTEGER);
}
+int OSSL_PARAM_BLD_push_time_t(OSSL_PARAM_BLD *bld, const char *key,
+ time_t num)
+{
+ return param_push_num(bld, key, &num, sizeof(num),
+ OSSL_PARAM_INTEGER);
+}
+
int OSSL_PARAM_BLD_push_double(OSSL_PARAM_BLD *bld, const char *key,
double num)
{
sizeof(size_t));
}
+int OSSL_PARAM_get_time_t(const OSSL_PARAM *p, time_t *val)
+{
+ switch (sizeof(time_t)) {
+ case sizeof(int32_t):
+ return OSSL_PARAM_get_int32(p, (int32_t *)val);
+ case sizeof(int64_t):
+ return OSSL_PARAM_get_int64(p, (int64_t *)val);
+ }
+ return 0;
+}
+
+int OSSL_PARAM_set_time_t(OSSL_PARAM *p, time_t val)
+{
+ switch (sizeof(time_t)) {
+ case sizeof(int32_t):
+ return OSSL_PARAM_set_int32(p, (int32_t)val);
+ case sizeof(int64_t):
+ return OSSL_PARAM_set_int64(p, (int64_t)val);
+ }
+ return 0;
+}
+
+OSSL_PARAM OSSL_PARAM_construct_time_t(const char *key, time_t *buf)
+{
+ return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(time_t));
+}
+
int OSSL_PARAM_get_BN(const OSSL_PARAM *p, BIGNUM **val)
{
BIGNUM *b;
=head1 NAME
OSSL_PARAM_double, OSSL_PARAM_int, OSSL_PARAM_int32, OSSL_PARAM_int64,
-OSSL_PARAM_long, OSSL_PARAM_size_t, OSSL_PARAM_uint, OSSL_PARAM_uint32,
+OSSL_PARAM_long, OSSL_PARAM_size_t, OSSL_PARAM_time_t, OSSL_PARAM_uint, OSSL_PARAM_uint32,
OSSL_PARAM_uint64, OSSL_PARAM_ulong, OSSL_PARAM_BN, OSSL_PARAM_utf8_string,
OSSL_PARAM_octet_string, OSSL_PARAM_utf8_ptr, OSSL_PARAM_octet_ptr,
OSSL_PARAM_END,
OSSL_PARAM_construct_double, OSSL_PARAM_construct_int,
OSSL_PARAM_construct_int32, OSSL_PARAM_construct_int64,
-OSSL_PARAM_construct_long, OSSL_PARAM_construct_size_t,
+OSSL_PARAM_construct_long, OSSL_PARAM_construct_size_t, OSSL_PARAM_construct_time_t,
OSSL_PARAM_construct_uint, OSSL_PARAM_construct_uint32,
OSSL_PARAM_construct_uint64, OSSL_PARAM_construct_ulong,
OSSL_PARAM_construct_BN, OSSL_PARAM_construct_utf8_string,
OSSL_PARAM_construct_octet_ptr, OSSL_PARAM_construct_end,
OSSL_PARAM_locate, OSSL_PARAM_locate_const,
OSSL_PARAM_get_double, OSSL_PARAM_get_int, OSSL_PARAM_get_int32,
-OSSL_PARAM_get_int64, OSSL_PARAM_get_long, OSSL_PARAM_get_size_t,
+OSSL_PARAM_get_int64, OSSL_PARAM_get_long, OSSL_PARAM_get_size_t, OSSL_PARAM_get_time_t,
OSSL_PARAM_get_uint, OSSL_PARAM_get_uint32, OSSL_PARAM_get_uint64,
OSSL_PARAM_get_ulong, OSSL_PARAM_get_BN, OSSL_PARAM_get_utf8_string,
OSSL_PARAM_get_octet_string, OSSL_PARAM_get_utf8_ptr,
OSSL_PARAM_get_octet_ptr,
OSSL_PARAM_set_double, OSSL_PARAM_set_int, OSSL_PARAM_set_int32,
-OSSL_PARAM_set_int64, OSSL_PARAM_set_long, OSSL_PARAM_set_size_t,
+OSSL_PARAM_set_int64, OSSL_PARAM_set_long, OSSL_PARAM_set_size_t, OSSL_PARAM_set_time_t,
OSSL_PARAM_set_uint, OSSL_PARAM_set_uint32, OSSL_PARAM_set_uint64,
OSSL_PARAM_set_ulong, OSSL_PARAM_set_BN, OSSL_PARAM_set_utf8_string,
OSSL_PARAM_set_octet_string, OSSL_PARAM_set_utf8_ptr,
/*
* TYPE in function names is one of:
- * double, int, int32, int64, long, size_t, uint, uint32, uint64, ulong
+ * double, int, int32, int64, long, size_t, time_t, uint, uint32, uint64, ulong
* Corresponding TYPE in function arguments is one of:
- * double, int, int32_t, int64_t, long, size_t, unsigned int, uint32_t,
+ * double, int, int32_t, int64_t, long, size_t, time_t, unsigned int, uint32_t,
* uint64_t, unsigned long
*/
=item *
+time_t
+
+=item *
+
size_t
=item *
uint64_t val);
int OSSL_PARAM_BLD_push_size_t(OSSL_PARAM_BLD *bld, const char *key,
size_t val);
+int OSSL_PARAM_BLD_push_time_t(OSSL_PARAM_BLD *bld, const char *key,
+ time_t val);
int OSSL_PARAM_BLD_push_double(OSSL_PARAM_BLD *bld, const char *key,
double val);
int OSSL_PARAM_BLD_push_BN(OSSL_PARAM_BLD *bld, const char *key,
sizeof(uint64_t))
# define OSSL_PARAM_size_t(key, addr) \
OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), sizeof(size_t))
+# define OSSL_PARAM_time_t(key, addr) \
+ OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(time_t))
# define OSSL_PARAM_double(key, addr) \
OSSL_PARAM_DEFN((key), OSSL_PARAM_REAL, (addr), sizeof(double))
OSSL_PARAM OSSL_PARAM_construct_int64(const char *key, int64_t *buf);
OSSL_PARAM OSSL_PARAM_construct_uint64(const char *key, uint64_t *buf);
OSSL_PARAM OSSL_PARAM_construct_size_t(const char *key, size_t *buf);
+OSSL_PARAM OSSL_PARAM_construct_time_t(const char *key, time_t *buf);
OSSL_PARAM OSSL_PARAM_construct_BN(const char *key, unsigned char *buf,
size_t bsize);
OSSL_PARAM OSSL_PARAM_construct_double(const char *key, double *buf);
int OSSL_PARAM_get_int64(const OSSL_PARAM *p, int64_t *val);
int OSSL_PARAM_get_uint64(const OSSL_PARAM *p, uint64_t *val);
int OSSL_PARAM_get_size_t(const OSSL_PARAM *p, size_t *val);
+int OSSL_PARAM_get_time_t(const OSSL_PARAM *p, time_t *val);
int OSSL_PARAM_set_int(OSSL_PARAM *p, int val);
int OSSL_PARAM_set_uint(OSSL_PARAM *p, unsigned int val);
int OSSL_PARAM_set_int64(OSSL_PARAM *p, int64_t val);
int OSSL_PARAM_set_uint64(OSSL_PARAM *p, uint64_t val);
int OSSL_PARAM_set_size_t(OSSL_PARAM *p, size_t val);
+int OSSL_PARAM_set_time_t(OSSL_PARAM *p, time_t val);
int OSSL_PARAM_get_double(const OSSL_PARAM *p, double *val);
int OSSL_PARAM_set_double(OSSL_PARAM *p, double val);
int32_t i32;
int64_t i64;
double d;
+ time_t t;
char *utf = NULL;
const char *cutf;
int res = 0;
|| !TEST_true(OSSL_PARAM_BLD_push_long(bld, "l", 42))
|| !TEST_true(OSSL_PARAM_BLD_push_int32(bld, "i32", 1532))
|| !TEST_true(OSSL_PARAM_BLD_push_int64(bld, "i64", -9999999))
+ || !TEST_true(OSSL_PARAM_BLD_push_time_t(bld, "t", 11224))
|| !TEST_true(OSSL_PARAM_BLD_push_double(bld, "d", 1.61803398875))
|| !TEST_ptr(bn = BN_new())
|| !TEST_true(BN_set_word(bn, 1729))
|| !TEST_size_t_eq(p->data_size, sizeof(long int))
|| !TEST_true(OSSL_PARAM_get_long(p, &l))
|| !TEST_long_eq(l, 42)
+ /* Check time_t */
+ || !TEST_ptr(p = OSSL_PARAM_locate(params, "t"))
+ || !TEST_str_eq(p->key, "t")
+ || !TEST_uint_eq(p->data_type, OSSL_PARAM_INTEGER)
+ || !TEST_size_t_eq(p->data_size, sizeof(time_t))
+ || !TEST_true(OSSL_PARAM_get_time_t(p, &t))
+ || !TEST_time_t_eq(t, 11224)
/* Check double */
|| !TEST_ptr(p = OSSL_PARAM_locate(params, "d"))
|| !TEST_true(OSSL_PARAM_get_double(p, &d))
return test_param_type_extra(¶m, raw_values[n].value, sizeof(size_t));
}
+static int test_param_time_t(int n)
+{
+ time_t in, out;
+ unsigned char buf[MAX_LEN], cmp[sizeof(size_t)];
+ const size_t len = raw_values[n].len >= sizeof(size_t)
+ ? sizeof(time_t) : raw_values[n].len;
+ OSSL_PARAM param = OSSL_PARAM_time_t("a", NULL);
+
+ memset(buf, 0, sizeof(buf));
+ le_copy(buf, raw_values[n].value, sizeof(in));
+ memcpy(&in, buf, sizeof(in));
+ param.data = &out;
+ if (!TEST_true(OSSL_PARAM_set_time_t(¶m, in)))
+ return 0;
+ le_copy(cmp, &out, sizeof(out));
+ if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
+ return 0;
+ in = 0;
+ if (!TEST_true(OSSL_PARAM_get_time_t(¶m, &in)))
+ return 0;
+ le_copy(cmp, &in, sizeof(in));
+ if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
+ return 0;
+ param.data = &out;
+ return test_param_type_extra(¶m, raw_values[n].value, sizeof(size_t));
+}
+
static int test_param_bignum(int n)
{
unsigned char buf[MAX_LEN], bnbuf[MAX_LEN];
ADD_ALL_TESTS(test_param_int32, OSSL_NELEM(raw_values));
ADD_ALL_TESTS(test_param_uint32, OSSL_NELEM(raw_values));
ADD_ALL_TESTS(test_param_size_t, OSSL_NELEM(raw_values));
+ ADD_ALL_TESTS(test_param_time_t, OSSL_NELEM(raw_values));
ADD_ALL_TESTS(test_param_int64, OSSL_NELEM(raw_values));
ADD_ALL_TESTS(test_param_uint64, OSSL_NELEM(raw_values));
ADD_ALL_TESTS(test_param_bignum, OSSL_NELEM(raw_values));
EVP_default_properties_enable_fips ? 3_0_0 EXIST::FUNCTION:
EVP_PKEY_new_raw_private_key_with_libctx ? 3_0_0 EXIST::FUNCTION:
EVP_PKEY_new_raw_public_key_with_libctx ? 3_0_0 EXIST::FUNCTION:
+OSSL_PARAM_BLD_push_time_t ? 3_0_0 EXIST::FUNCTION:
+OSSL_PARAM_construct_time_t ? 3_0_0 EXIST::FUNCTION:
+OSSL_PARAM_get_time_t ? 3_0_0 EXIST::FUNCTION:
+OSSL_PARAM_set_time_t ? 3_0_0 EXIST::FUNCTION:
OSSL_STORE_attach ? 3_0_0 EXIST::FUNCTION:
OSSL_STORE_LOADER_set_attach ? 3_0_0 EXIST::FUNCTION:
EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen ? 3_0_0 EXIST::FUNCTION:RSA