summaryrefslogtreecommitdiffstats
path: root/crypto/params.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-04-21 10:49:19 +1000
committerPauli <paul.dale@oracle.com>2020-04-22 13:56:44 +1000
commit8d5fb6485282c79bfe9f1ebab14eab515910e370 (patch)
tree7fe3b356021db7eba7529a9569d2c61348324e99 /crypto/params.c
parent07caec83b81859ea9aa2d5075a394aa48c4e5fae (diff)
params: add functionality to test if an OSSL_PARAM has been set.
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11588)
Diffstat (limited to 'crypto/params.c')
-rw-r--r--crypto/params.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/crypto/params.c b/crypto/params.c
index 64d53c50e3..1decffdaca 100644
--- a/crypto/params.c
+++ b/crypto/params.c
@@ -36,10 +36,21 @@ 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 = 0;
+ res.return_size = OSSL_PARAM_UNMODIFIED;
return res;
}
+int OSSL_PARAM_modified(const OSSL_PARAM *p)
+{
+ return p != NULL && p->return_size != OSSL_PARAM_UNMODIFIED;
+}
+
+void OSSL_PARAM_set_unmodified(OSSL_PARAM *p)
+{
+ if (p != NULL)
+ p->return_size = OSSL_PARAM_UNMODIFIED;
+}
+
int OSSL_PARAM_get_int(const OSSL_PARAM *p, int *val)
{
switch (sizeof(int)) {