summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/evp/digest.c12
-rw-r--r--crypto/params.c207
-rw-r--r--crypto/provider.c3
-rw-r--r--crypto/provider_core.c7
-rw-r--r--doc/internal/man3/ossl_provider_new.pod3
-rw-r--r--doc/man3/EVP_DigestInit.pod2
-rw-r--r--doc/man3/OSSL_PARAM.pod33
-rw-r--r--doc/man3/OSSL_PARAM_int.pod101
-rw-r--r--doc/man3/OSSL_PROVIDER.pod4
-rw-r--r--include/internal/provider.h3
-rw-r--r--include/openssl/core.h2
-rw-r--r--include/openssl/core_numbers.h10
-rw-r--r--include/openssl/evp.h2
-rw-r--r--include/openssl/params.h153
-rw-r--r--include/openssl/provider.h3
-rw-r--r--providers/common/ciphers/aes.c10
-rw-r--r--providers/common/digests/sha2_prov.c2
-rw-r--r--providers/common/digests/sha3_prov.c2
-rw-r--r--providers/default/defltprov.c5
-rw-r--r--providers/default/digests/md5_sha1_prov.c2
-rw-r--r--providers/fips/fipsprov.c5
-rw-r--r--providers/legacy/digests/mdc2_prov.c2
-rw-r--r--providers/legacy/legacyprov.c5
-rw-r--r--ssl/s3_enc.c3
-rw-r--r--test/mdc2test.c2
-rw-r--r--test/p_test.c16
-rw-r--r--test/params_api_test.c110
-rw-r--r--test/params_conversion_test.c4
-rw-r--r--test/params_test.c120
-rw-r--r--test/provider_internal_test.c5
-rw-r--r--test/provider_test.c5
-rw-r--r--util/libcrypto.num1
-rw-r--r--util/private.num13
33 files changed, 359 insertions, 498 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 604bf7fea0..9f19744606 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -365,8 +365,7 @@ int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, size_t size)
return 0;
}
- params[i++] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_XOFLEN,
- &size, NULL);
+ params[i++] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_XOFLEN, &size);
params[i++] = OSSL_PARAM_construct_end();
if (EVP_MD_CTX_set_params(ctx, params) > 0)
@@ -532,7 +531,7 @@ int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[])
return 0;
}
-int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[])
+int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[])
{
if (ctx->digest != NULL && ctx->digest->get_params != NULL)
return ctx->digest->get_params(ctx->provctx, params);
@@ -545,7 +544,7 @@ int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2)
if (ctx->digest != NULL) {
if (ctx->digest->prov != NULL) {
OSSL_PARAM params[2];
- size_t i, sz, n = 0;
+ size_t i, n = 0;
switch (cmd) {
case EVP_MD_CTRL_XOF_LEN:
@@ -553,8 +552,7 @@ int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2)
break;
i = (size_t)p1;
params[n++] =
- OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_XOFLEN, &i,
- &sz);
+ OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_XOFLEN, &i);
params[n++] = OSSL_PARAM_construct_end();
return ctx->digest->set_params(ctx->provctx, params);
case EVP_MD_CTRL_MICALG:
@@ -562,7 +560,7 @@ int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2)
break;
params[n++] =
OSSL_PARAM_construct_utf8_string(OSSL_DIGEST_PARAM_MICALG,
- p2, p1 ? p1 : 9999, &sz);
+ p2, p1 ? p1 : 9999);
params[n++] = OSSL_PARAM_construct_end();
return ctx->digest->get_params(ctx->provctx, params);
}
diff --git a/crypto/params.c b/crypto/params.c
index 183884fa79..0c9e6f3ef7 100644
--- a/crypto/params.c
+++ b/crypto/params.c
@@ -12,11 +12,7 @@
#include <openssl/params.h>
#include "internal/thread_once.h"
-#define SET_RETURN_SIZE(p, sz) \
- if ((p)->return_size != NULL) \
- *(p)->return_size = (sz)
-
-const OSSL_PARAM *OSSL_PARAM_locate(const OSSL_PARAM *p, const char *key)
+OSSL_PARAM *OSSL_PARAM_locate(OSSL_PARAM *p, const char *key)
{
if (p != NULL && key != NULL)
for (; p->key != NULL; p++)
@@ -25,9 +21,13 @@ const OSSL_PARAM *OSSL_PARAM_locate(const OSSL_PARAM *p, const char *key)
return NULL;
}
+const OSSL_PARAM *OSSL_PARAM_locate_const(const OSSL_PARAM *p, const char *key)
+{
+ return OSSL_PARAM_locate((OSSL_PARAM *)p, key);
+}
+
static OSSL_PARAM ossl_param_construct(const char *key, unsigned int data_type,
- void *data, size_t data_size,
- size_t *return_size)
+ void *data, size_t data_size)
{
OSSL_PARAM res;
@@ -35,7 +35,7 @@ static OSSL_PARAM ossl_param_construct(const char *key, unsigned int data_type,
res.data_type = data_type;
res.data = data;
res.data_size = data_size;
- res.return_size = return_size;
+ res.return_size = 0;
return res;
}
@@ -50,7 +50,7 @@ int OSSL_PARAM_get_int(const OSSL_PARAM *p, int *val)
return 0;
}
-int OSSL_PARAM_set_int(const OSSL_PARAM *p, int val)
+int OSSL_PARAM_set_int(OSSL_PARAM *p, int val)
{
switch (sizeof(int)) {
case sizeof(int32_t):
@@ -61,10 +61,9 @@ int OSSL_PARAM_set_int(const OSSL_PARAM *p, int val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_int(const char *key, int *buf, size_t *rsize)
+OSSL_PARAM OSSL_PARAM_construct_int(const char *key, int *buf)
{
- return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(int),
- rsize);
+ return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(int));
}
int OSSL_PARAM_get_uint(const OSSL_PARAM *p, unsigned int *val)
@@ -78,7 +77,7 @@ int OSSL_PARAM_get_uint(const OSSL_PARAM *p, unsigned int *val)
return 0;
}
-int OSSL_PARAM_set_uint(const OSSL_PARAM *p, unsigned int val)
+int OSSL_PARAM_set_uint(OSSL_PARAM *p, unsigned int val)
{
switch (sizeof(unsigned int)) {
case sizeof(uint32_t):
@@ -89,11 +88,10 @@ int OSSL_PARAM_set_uint(const OSSL_PARAM *p, unsigned int val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_uint(const char *key, unsigned int *buf,
- size_t *rsize)
+OSSL_PARAM OSSL_PARAM_construct_uint(const char *key, unsigned int *buf)
{
return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
- sizeof(unsigned int), rsize);
+ sizeof(unsigned int));
}
int OSSL_PARAM_get_long(const OSSL_PARAM *p, long int *val)
@@ -107,7 +105,7 @@ int OSSL_PARAM_get_long(const OSSL_PARAM *p, long int *val)
return 0;
}
-int OSSL_PARAM_set_long(const OSSL_PARAM *p, long int val)
+int OSSL_PARAM_set_long(OSSL_PARAM *p, long int val)
{
switch (sizeof(long int)) {
case sizeof(int32_t):
@@ -118,11 +116,9 @@ int OSSL_PARAM_set_long(const OSSL_PARAM *p, long int val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_long(const char *key, long int *buf,
- size_t *rsize)
+OSSL_PARAM OSSL_PARAM_construct_long(const char *key, long int *buf)
{
- return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(long int),
- rsize);
+ return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(long int));
}
int OSSL_PARAM_get_ulong(const OSSL_PARAM *p, unsigned long int *val)
@@ -136,7 +132,7 @@ int OSSL_PARAM_get_ulong(const OSSL_PARAM *p, unsigned long int *val)
return 0;
}
-int OSSL_PARAM_set_ulong(const OSSL_PARAM *p, unsigned long int val)
+int OSSL_PARAM_set_ulong(OSSL_PARAM *p, unsigned long int val)
{
switch (sizeof(unsigned long int)) {
case sizeof(uint32_t):
@@ -147,11 +143,10 @@ int OSSL_PARAM_set_ulong(const OSSL_PARAM *p, unsigned long int val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_ulong(const char *key, unsigned long int *buf,
- size_t *rsize)
+OSSL_PARAM OSSL_PARAM_construct_ulong(const char *key, unsigned long int *buf)
{
return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
- sizeof(unsigned long int), rsize);
+ sizeof(unsigned long int));
}
int OSSL_PARAM_get_int32(const OSSL_PARAM *p, int32_t *val)
@@ -208,35 +203,35 @@ int OSSL_PARAM_get_int32(const OSSL_PARAM *p, int32_t *val)
return 0;
}
-int OSSL_PARAM_set_int32(const OSSL_PARAM *p, int32_t val)
+int OSSL_PARAM_set_int32(OSSL_PARAM *p, int32_t val)
{
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (p->data_type == OSSL_PARAM_INTEGER) {
- SET_RETURN_SIZE(p, sizeof(int32_t)); /* Minimum expected size */
+ p->return_size = sizeof(int32_t); /* Minimum expected size */
switch (p->data_size) {
case sizeof(int32_t):
*(int32_t *)p->data = val;
return 1;
case sizeof(int64_t):
- SET_RETURN_SIZE(p, sizeof(int64_t));
+ p->return_size = sizeof(int64_t);
*(int64_t *)p->data = (int64_t)val;
return 1;
}
} else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER && val >= 0) {
- SET_RETURN_SIZE(p, sizeof(uint32_t)); /* Minimum expected size */
+ p->return_size = sizeof(uint32_t); /* Minimum expected size */
switch (p->data_size) {
case sizeof(uint32_t):
*(uint32_t *)p->data = (uint32_t)val;
return 1;
case sizeof(uint64_t):
- SET_RETURN_SIZE(p, sizeof(uint64_t));
+ p->return_size = sizeof(uint64_t);
*(uint64_t *)p->data = (uint64_t)val;
return 1;
}
} else if (p->data_type == OSSL_PARAM_REAL) {
- SET_RETURN_SIZE(p, sizeof(double));
+ p->return_size = sizeof(double);
switch (p->data_size) {
case sizeof(double):
*(double *)p->data = (double)val;
@@ -246,11 +241,10 @@ int OSSL_PARAM_set_int32(const OSSL_PARAM *p, int32_t val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_int32(const char *key, int32_t *buf,
- size_t *rsize)
+OSSL_PARAM OSSL_PARAM_construct_int32(const char *key, int32_t *buf)
{
return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf,
- sizeof(int32_t), rsize);
+ sizeof(int32_t));
}
int OSSL_PARAM_get_uint32(const OSSL_PARAM *p, uint32_t *val)
@@ -307,25 +301,25 @@ int OSSL_PARAM_get_uint32(const OSSL_PARAM *p, uint32_t *val)
return 0;
}
-int OSSL_PARAM_set_uint32(const OSSL_PARAM *p, uint32_t val)
+int OSSL_PARAM_set_uint32(OSSL_PARAM *p, uint32_t val)
{
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
- SET_RETURN_SIZE(p, sizeof(uint32_t)); /* Minimum expected size */
+ p->return_size = sizeof(uint32_t); /* Minimum expected size */
switch (p->data_size) {
case sizeof(uint32_t):
*(uint32_t *)p->data = val;
return 1;
case sizeof(uint64_t):
- SET_RETURN_SIZE(p, sizeof(uint64_t));
+ p->return_size = sizeof(uint64_t);
*(uint64_t *)p->data = val;
return 1;
}
} else if (p->data_type == OSSL_PARAM_INTEGER) {
- SET_RETURN_SIZE(p, sizeof(int32_t)); /* Minimum expected size */
+ p->return_size = sizeof(int32_t); /* Minimum expected size */
switch (p->data_size) {
case sizeof(int32_t):
if (val <= INT32_MAX) {
@@ -334,12 +328,12 @@ int OSSL_PARAM_set_uint32(const OSSL_PARAM *p, uint32_t val)
}
break;
case sizeof(int64_t):
- SET_RETURN_SIZE(p, sizeof(int64_t));
+ p->return_size = sizeof(int64_t);
*(int64_t *)p->data = (int64_t)val;
return 1;
}
} else if (p->data_type == OSSL_PARAM_REAL) {
- SET_RETURN_SIZE(p, sizeof(double));
+ p->return_size = sizeof(double);
switch (p->data_size) {
case sizeof(double):
*(double *)p->data = (double)val;
@@ -349,11 +343,10 @@ int OSSL_PARAM_set_uint32(const OSSL_PARAM *p, uint32_t val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_uint32(const char *key, uint32_t *buf,
- size_t *rsize)
+OSSL_PARAM OSSL_PARAM_construct_uint32(const char *key, uint32_t *buf)
{
return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
- sizeof(uint32_t), rsize);
+ sizeof(uint32_t));
}
int OSSL_PARAM_get_int64(const OSSL_PARAM *p, int64_t *val)
@@ -400,19 +393,19 @@ int OSSL_PARAM_get_int64(const OSSL_PARAM *p, int64_t *val)
return 0;
}
-int OSSL_PARAM_set_int64(const OSSL_PARAM *p, int64_t val)
+int OSSL_PARAM_set_int64(OSSL_PARAM *p, int64_t val)
{
uint64_t u64;
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (p->data_type == OSSL_PARAM_INTEGER) {
- SET_RETURN_SIZE(p, sizeof(int64_t)); /* Expected size */
+ p->return_size = sizeof(int64_t); /* Expected size */
switch (p->data_size) {
case sizeof(int32_t):
if (val >= INT32_MIN && val <= INT32_MAX) {
- SET_RETURN_SIZE(p, sizeof(int32_t));
+ p->return_size = sizeof(int32_t);
*(int32_t *)p->data = (int32_t)val;
return 1;
}
@@ -422,11 +415,11 @@ int OSSL_PARAM_set_int64(const OSSL_PARAM *p, int64_t val)
return 1;
}
} else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER && val >= 0) {
- SET_RETURN_SIZE(p, sizeof(uint64_t)); /* Expected size */
+ p->return_size = sizeof(uint64_t); /* Expected size */
switch (p->data_size) {
case sizeof(uint32_t):
if (val <= UINT32_MAX) {
- SET_RETURN_SIZE(p, sizeof(uint32_t));
+ p->return_size = sizeof(uint32_t);
*(uint32_t *)p->data = (uint32_t)val;
return 1;
}
@@ -436,7 +429,7 @@ int OSSL_PARAM_set_int64(const OSSL_PARAM *p, int64_t val)
return 1;
}
} else if (p->data_type == OSSL_PARAM_REAL) {
- SET_RETURN_SIZE(p, sizeof(double));
+ p->return_size = sizeof(double);
switch (p->data_size) {
case sizeof(double):
u64 = val < 0 ? -val : val;
@@ -450,11 +443,9 @@ int OSSL_PARAM_set_int64(const OSSL_PARAM *p, int64_t val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_int64(const char *key, int64_t *buf,
- size_t *rsize)
+OSSL_PARAM OSSL_PARAM_construct_int64(const char *key, int64_t *buf)
{
- return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(int64_t),
- rsize);
+ return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(int64_t));
}
int OSSL_PARAM_get_uint64(const OSSL_PARAM *p, uint64_t *val)
@@ -506,18 +497,18 @@ int OSSL_PARAM_get_uint64(const OSSL_PARAM *p, uint64_t *val)
return 0;
}
-int OSSL_PARAM_set_uint64(const OSSL_PARAM *p, uint64_t val)
+int OSSL_PARAM_set_uint64(OSSL_PARAM *p, uint64_t val)
{
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
- SET_RETURN_SIZE(p, sizeof(uint64_t)); /* Expected size */
+ p->return_size = sizeof(uint64_t); /* Expected size */
switch (p->data_size) {
case sizeof(uint32_t):
if (val <= UINT32_MAX) {
- SET_RETURN_SIZE(p, sizeof(uint32_t));
+ p->return_size = sizeof(uint32_t);
*(uint32_t *)p->data = (uint32_t)val;
return 1;
}
@@ -527,11 +518,11 @@ int OSSL_PARAM_set_uint64(const OSSL_PARAM *p, uint64_t val)
return 1;
}
} else if (p->data_type == OSSL_PARAM_INTEGER) {
- SET_RETURN_SIZE(p, sizeof(int64_t)); /* Expected size */
+ p->return_size = sizeof(int64_t); /* Expected size */
switch (p->data_size) {
case sizeof(int32_t):
if (val <= INT32_MAX) {
- SET_RETURN_SIZE(p, sizeof(int32_t));
+ p->return_size = sizeof(int32_t);
*(int32_t *)p->data = (int32_t)val;
return 1;
}
@@ -544,7 +535,7 @@ int OSSL_PARAM_set_uint64(const OSSL_PARAM *p, uint64_t val)
break;
}
} else if (p->data_type == OSSL_PARAM_REAL) {
- SET_RETURN_SIZE(p, sizeof(double));
+ p->return_size = sizeof(double);
switch (p->data_size) {
case sizeof(double):
if ((val >> 53) == 0) { /* 53 significant bits in the mantissa */
@@ -557,10 +548,10 @@ int OSSL_PARAM_set_uint64(const OSSL_PARAM *p, uint64_t val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_uint64(const char *key, uint64_t *buf,
- size_t *rsize) {
+OSSL_PARAM OSSL_PARAM_construct_uint64(const char *key, uint64_t *buf)
+{
return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
- sizeof(uint64_t), rsize);
+ sizeof(uint64_t));
}
int OSSL_PARAM_get_size_t(const OSSL_PARAM *p, size_t *val)
@@ -574,7 +565,7 @@ int OSSL_PARAM_get_size_t(const OSSL_PARAM *p, size_t *val)
return 0;
}
-int OSSL_PARAM_set_size_t(const OSSL_PARAM *p, size_t val)
+int OSSL_PARAM_set_size_t(OSSL_PARAM *p, size_t val)
{
switch (sizeof(size_t)) {
case sizeof(uint32_t):
@@ -585,11 +576,11 @@ int OSSL_PARAM_set_size_t(const OSSL_PARAM *p, size_t val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_size_t(const char *key, size_t *buf,
- size_t *rsize)
+OSSL_PARAM OSSL_PARAM_construct_size_t(const char *key, size_t *buf)
{
return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
- sizeof(size_t), rsize); }
+ sizeof(size_t));
+}
#ifndef FIPS_MODE
/*
@@ -615,13 +606,13 @@ int OSSL_PARAM_get_BN(const OSSL_PARAM *p, BIGNUM **val)
return 0;
}
-int OSSL_PARAM_set_BN(const OSSL_PARAM *p, const BIGNUM *val)
+int OSSL_PARAM_set_BN(OSSL_PARAM *p, const BIGNUM *val)
{
size_t bytes;
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (val == NULL || p->data_type != OSSL_PARAM_UNSIGNED_INTEGER)
return 0;
@@ -630,16 +621,16 @@ int OSSL_PARAM_set_BN(const OSSL_PARAM *p, const BIGNUM *val)
return 0;
bytes = (size_t)BN_num_bytes(val);
- SET_RETURN_SIZE(p, bytes);
+ p->return_size = bytes;
return p->data_size >= bytes
&& BN_bn2nativepad(val, p->data, bytes) >= 0;
}
OSSL_PARAM OSSL_PARAM_construct_BN(const char *key, unsigned char *buf,
- size_t bsize, size_t *rsize)
+ size_t bsize)
{
return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER,
- buf, bsize, rsize);
+ buf, bsize);
}
#endif
@@ -688,14 +679,14 @@ int OSSL_PARAM_get_double(const OSSL_PARAM *p, double *val)
return 0;
}
-int OSSL_PARAM_set_double(const OSSL_PARAM *p, double val)
+int OSSL_PARAM_set_double(OSSL_PARAM *p, double val)
{
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (p->data_type == OSSL_PARAM_REAL) {
- SET_RETURN_SIZE(p, sizeof(double));
+ p->return_size = sizeof(double);
switch (p->data_size) {
case sizeof(double):
*(double *)p->data = val;
@@ -703,35 +694,35 @@ int OSSL_PARAM_set_double(const OSSL_PARAM *p, double val)
}
} else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER
&& val == (uintmax_t)val) {
- SET_RETURN_SIZE(p, sizeof(double));
+ p->return_size = sizeof(double);
switch (p->data_size) {
case sizeof(uint32_t):
if (val >= 0 && val <= UINT32_MAX) {
- SET_RETURN_SIZE(p, sizeof(uint32_t));
+ p->return_size = sizeof(uint32_t);
*(uint32_t *)p->data = (uint32_t)val;
return 1;
}
break;
case sizeof(uint64_t):
if (val >= 0 && val <= UINT64_MAX) {
- SET_RETURN_SIZE(p, sizeof(uint64_t));
+ p->return_size = sizeof(uint64_t);
*(uint64_t *)p->data = (uint64_t)val;
return 1;
}
break; }
} else if (p->data_type == OSSL_PARAM_INTEGER && val == (intmax_t)val) {
- SET_RETURN_SIZE(p, sizeof(double));
+ p->return_size = sizeof(double);
switch (p->data_size) {
case sizeof(int32_t):
if (val >= INT32_MIN && val <= INT32_MAX) {
- SET_RETURN_SIZE(p, sizeof(int32_t));
+ p->return_size = sizeof(int32_t);
*(int32_t *)p->data = (int32_t)val;
return 1;
}
break;
case sizeof(int64_t):
if (val >= INT64_MIN && val <= INT64_MAX) {
- SET_RETURN_SIZE(p, sizeof(int64_t));
+ p->return_size = sizeof(int64_t);
*(int64_t *)p->data = (int64_t)val;
return 1;
}
@@ -741,11 +732,9 @@ int OSSL_PARAM_set_double(const OSSL_PARAM *p, double val)
return 0;
}
-OSSL_PARAM OSSL_PARAM_construct_double(const char *key, double *buf,
- size_t *rsize)
+OSSL_PARAM OSSL_PARAM_construct_double(const char *key, double *buf)
{
- return ossl_param_construct(key, OSSL_PARAM_REAL, buf, sizeof(double),
- rsize);
+ return ossl_param_construct(key, OSSL_PARAM_REAL, buf, sizeof(double));
}
static int get_string_internal(const OSSL_PARAM *p, void **val, size_t max_len,
@@ -789,10 +778,10 @@ int OSSL_PARAM_get_octet_string(const OSSL_PARAM *p, void **val, size_t max_len,
OSSL_PARAM_OCTET_STRING);
}
-static int set_string_internal(const OSSL_PARAM *p, const void *val, size_t len,
+static int set_string_internal(OSSL_PARAM *p, const void *val, size_t len,
unsigned int type)
{
- SET_RETURN_SIZE(p, len);
+ p->return_size = len;
if (p->data_type != type || p->data_size < len)
return 0;
@@ -800,41 +789,39 @@ static int set_string_internal(const OSSL_PARAM *p, const void *val, size_t len,
return 1;
}
-int OSSL_PARAM_set_utf8_string(const OSSL_PARAM *p, const char *val)
+int OSSL_PARAM_set_utf8_string(OSSL_PARAM *p, const char *val)
{
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (val == NULL)
return 0;
return set_string_internal(p, val, strlen(val) + 1, OSSL_PARAM_UTF8_STRING);
}
-int OSSL_PARAM_set_octet_string(const OSSL_PARAM *p, const void *val,
+int OSSL_PARAM_set_octet_string(OSSL_PARAM *p, const void *val,
size_t len)
{
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (val == NULL)
return 0;
return set_string_internal(p, val, len, OSSL_PARAM_OCTET_STRING);
}
OSSL_PARAM OSSL_PARAM_construct_utf8_string(const char *key, char *buf,
- size_t bsize, size_t *rsize)
+ size_t bsize)
{
- return ossl_param_construct(key, OSSL_PARAM_UTF8_STRING, buf, bsize,
- rsize);
+ return ossl_param_construct(key, OSSL_PARAM_UTF8_STRING, buf, bsize);
}
OSSL_PARAM OSSL_PARAM_construct_octet_string(const char *key, void *buf,
- size_t bsize, size_t *rsize)
+ size_t bsize)
{
- return ossl_param_construct(key, OSSL_PARAM_OCTET_STRING, buf, bsize,
- rsize);
+ return ossl_param_construct(key, OSSL_PARAM_OCTET_STRING, buf, bsize);
}
static int get_ptr_internal(const OSSL_PARAM *p, const void **val,
@@ -859,47 +846,47 @@ int OSSL_PARAM_get_octet_ptr(const OSSL_PARAM *p, const void **val,
return get_ptr_internal(p, val, used_len, OSSL_PARAM_OCTET_PTR);
}
-static int set_ptr_internal(const OSSL_PARAM *p, const void *val,
+static int set_ptr_internal(OSSL_PARAM *p, const void *val,
unsigned int type, size_t len)
{
- SET_RETURN_SIZE(p, len);
+ p->return_size = len;
if (p->data_type != type)
return 0;
*(const void **)p->data = val;
return 1;
}
-int OSSL_PARAM_set_utf8_ptr(const OSSL_PARAM *p, const char *val)
+int OSSL_PARAM_set_utf8_ptr(OSSL_PARAM *p, const char *val)
{
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (val == NULL)
return 0;
return set_ptr_internal(p, val, OSSL_PARAM_UTF8_PTR, strlen(val) + 1);
}
-int OSSL_PARAM_set_octet_ptr(const OSSL_PARAM *p, const void *val,
+int OSSL_PARAM_set_octet_ptr(OSSL_PARAM *p, const void *val,
size_t used_len)
{
if (p == NULL)
return 0;
- SET_RETURN_SIZE(p, 0);
+ p->return_size = 0;
if (val == NULL)
return 0;
return set_ptr_internal(p, val, OSSL_PARAM_OCTET_PTR, used_len);
}
OSSL_PARAM OSSL_PARAM_construct_utf8_ptr(const char *key, char **buf,
- size_t bsize, size_t *rsize)
+ size_t bsize)
{
- return ossl_param_construct(key, OSSL_PARAM_UTF8_PTR, buf, bsize, rsize);
+ return ossl_param_construct(key, OSSL_PARAM_UTF8_PTR, buf, bsize);
}
OSSL_PARAM OSSL_PARAM_construct_octet_ptr(const char *key, void **buf,
- size_t bsize, size_t *rsize)
+ size_t bsize)
{
- return ossl_param_construct(key, OSSL_PARAM_OCTET_PTR, buf, bsize, rsize);
+ return ossl_param_construct(key, OSSL_PARAM_OCTET_PTR, buf, bsize);
}
OSSL_PARAM OSSL_PARAM_construct_end(void)
diff --git a/crypto/provider.c b/crypto/provider.c
index 249502413f..4e21bfe6d7 100644
--- a/crypto/provider.c
+++ b/crypto/provider.c
@@ -40,8 +40,7 @@ const OSSL_ITEM *OSSL_PROVIDER_get_param_types(const OSSL_PROVIDER *prov)
return ossl_provider_get_param_types(prov);
}
-int OSSL_PROVIDER_get_params(const OSSL_PROVIDER *prov,
- const OSSL_PARAM params[])
+int OSSL_PROVIDER_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[])
{
return ossl_provider_get_params(prov, params);
}
diff --git a/crypto/provider_core.c b/crypto/provider_core.c
index 274bdf94ba..f1b3925faa 100644
--- a/crypto/provider_core.c
+++ b/crypto/provider_core.c
@@ -603,8 +603,7 @@ const OSSL_ITEM *ossl_provider_get_param_types(const OSSL_PROVIDER *prov)
? NULL : prov->get_param_types(prov->provctx);
}
-int ossl_provider_get_params(const OSSL_PROVIDER *prov,
- const OSSL_PARAM params[])
+int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[])
{
return prov->get_params == NULL
? 0 : prov->get_params(prov->provctx, params);
@@ -641,10 +640,10 @@ static const OSSL_ITEM *core_get_param_types(const OSSL_PROVIDER *prov)
return param_types;
}
-static int core_get_params(const OSSL_PROVIDER *prov, const OSSL_PARAM params[])
+static int core_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[])
{
int i;
- const OSSL_PARAM *p;
+ OSSL_PARAM *p;
if ((p = OSSL_PARAM_locate(params, "openssl-version")) != NULL)
OSSL_PARAM_set_utf8_ptr(p, OPENSSL_VERSION_STR);
diff --git a/doc/internal/man3/ossl_provider_new.pod b/doc/internal/man3/ossl_provider_new.pod
index 04535086be..9e96c7203c 100644
--- a/doc/internal/man3/ossl_provider_new.pod
+++ b/doc/internal/man3/ossl_provider_new.pod
@@ -47,8 +47,7 @@ ossl_provider_get_params, ossl_provider_query_operation
/* Thin wrappers around calls to the provider */
void ossl_provider_teardown(const OSSL_PROVIDER *prov);
const OSSL_ITEM *ossl_provider_get_param_types(const OSSL_PROVIDER *prov);
- int ossl_provider_get_params(const OSSL_PROVIDER *prov,
- const OSSL_PARAM params[]);
+ int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]);
const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov,
int operation_id,
int *no_cache);
diff --git a/doc/man3/EVP_DigestInit.pod b/doc/man3/EVP_DigestInit.pod
index ec8f6cc1c7..bc10fa36c5 100644
--- a/doc/man3/EVP_DigestInit.pod
+++ b/doc/man3/EVP_DigestInit.pod
@@ -22,7 +22,7 @@ EVP_MD_CTX_pkey_ctx, EVP_MD_CTX_set_pkey_ctx - EVP digest routines
int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
void EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void* p2);
- int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]);
+ int EVP_MD_CTX_ge