Allow setting a NULL pointer in a params structure
Sometimes it is valid to send a NULL pointer in params.
@@ -892,9 +892,8 @@ int OSSL_PARAM_set_utf8_ptr(OSSL_PARAM *p, const char *val)
if (p == NULL)
return 0;
p->return_size = 0;
- if (val == NULL)
- return 0;
- return set_ptr_internal(p, val, OSSL_PARAM_UTF8_PTR, strlen(val) + 1);
+ return set_ptr_internal(p, val, OSSL_PARAM_UTF8_PTR,
+ val == NULL ? 0 : strlen(val) + 1);
}
int OSSL_PARAM_set_octet_ptr(OSSL_PARAM *p, const void *val,
@@ -903,8 +902,6 @@ int OSSL_PARAM_set_octet_ptr(OSSL_PARAM *p, const void *val,
if (p == NULL)
return 0;
p->return_size = 0;
- if (val == NULL)
- return 0;
return set_ptr_internal(p, val, OSSL_PARAM_OCTET_PTR, used_len);
}
