p->return_size = 0;
if (p->data_type == OSSL_PARAM_INTEGER) {
p->return_size = sizeof(int32_t); /* Minimum expected size */
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(int32_t):
*(int32_t *)p->data = val;
}
} else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER && val >= 0) {
p->return_size = sizeof(uint32_t); /* Minimum expected size */
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(uint32_t):
*(uint32_t *)p->data = (uint32_t)val;
}
} else if (p->data_type == OSSL_PARAM_REAL) {
p->return_size = sizeof(double);
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(double):
*(double *)p->data = (double)val;
if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
p->return_size = sizeof(uint32_t); /* Minimum expected size */
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(uint32_t):
*(uint32_t *)p->data = val;
}
} else if (p->data_type == OSSL_PARAM_INTEGER) {
p->return_size = sizeof(int32_t); /* Minimum expected size */
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(int32_t):
if (val <= INT32_MAX) {
}
} else if (p->data_type == OSSL_PARAM_REAL) {
p->return_size = sizeof(double);
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(double):
*(double *)p->data = (double)val;
p->return_size = 0;
if (p->data_type == OSSL_PARAM_INTEGER) {
p->return_size = sizeof(int64_t); /* Expected size */
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(int32_t):
if (val >= INT32_MIN && val <= INT32_MAX) {
}
} else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER && val >= 0) {
p->return_size = sizeof(uint64_t); /* Expected size */
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(uint32_t):
if (val <= UINT32_MAX) {
}
} else if (p->data_type == OSSL_PARAM_REAL) {
p->return_size = sizeof(double);
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(double):
u64 = val < 0 ? -val : val;
if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
p->return_size = sizeof(uint64_t); /* Expected size */
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(uint32_t):
if (val <= UINT32_MAX) {
}
} else if (p->data_type == OSSL_PARAM_INTEGER) {
p->return_size = sizeof(int64_t); /* Expected size */
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(int32_t):
if (val <= INT32_MAX) {
bytes = (size_t)BN_num_bytes(val);
p->return_size = bytes;
+ if (p->data == NULL)
+ return 1;
return p->data_size >= bytes
&& BN_bn2nativepad(val, p->data, bytes) >= 0;
}
if (p->data_type == OSSL_PARAM_REAL) {
p->return_size = sizeof(double);
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(double):
*(double *)p->data = val;
} else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER
&& val == (ossl_uintmax_t)val) {
p->return_size = sizeof(double);
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(uint32_t):
if (val >= 0 && val <= UINT32_MAX) {
break; }
} else if (p->data_type == OSSL_PARAM_INTEGER && val == (ossl_intmax_t)val) {
p->return_size = sizeof(double);
+ if (p->data == NULL)
+ return 1;
switch (p->data_size) {
case sizeof(int32_t):
if (val >= INT32_MIN && val <= INT32_MAX) {
unsigned int type)
{
p->return_size = len;
+ if (p->data == NULL)
+ return 1;
if (p->data_type != type || p->data_size < len)
return 0;
p->return_size = len;
if (p->data_type != type)
return 0;
- *(const void **)p->data = val;
+ if (p->data != NULL)
+ *(const void **)p->data = val;
return 1;
}
OSSL_PARAM_set_TYPE() stores a value B<val> of type B<TYPE> into the parameter
B<p>.
+If the parameter's I<data> field is NULL, then only its I<return_size> field
+will be assigned the size the parameter's I<data> buffer should have.
Type coercion takes place as discussed in the NOTES section.
OSSL_PARAM_get_BN() retrieves a BIGNUM from the parameter pointed to by B<p>.
B<NULL>.
OSSL_PARAM_set_BN() stores the BIGNUM B<val> into the parameter B<p>.
+If the parameter's I<data> field is NULL, then only its I<return_size> field
+will be assigned the size the parameter's I<data> buffer should have.
OSSL_PARAM_get_utf8_string() retrieves a UTF8 string from the parameter
pointed to by B<p>.
OSSL_PARAM_set_utf8_string() sets a UTF8 string from the parameter pointed to
by B<p> to the value referenced by B<val>.
+If the parameter's I<data> field is NULL, then only its I<return_size> field
+will be assigned the size the parameter's I<data> buffer should have.
OSSL_PARAM_get_octet_string() retrieves an OCTET string from the parameter
pointed to by B<p>.
OSSL_PARAM_set_octet_string() sets an OCTET string from the parameter
pointed to by B<p> to the value referenced by B<val>.
+If the parameter's I<data> field is NULL, then only its I<return_size> field
+will be assigned the size the parameter's I<data> buffer should have.
OSSL_PARAM_get_utf8_ptr() retrieves the UTF8 string pointer from the parameter
referenced by B<p> and stores it in B<*val>.
Apart from that, the functions must be used appropriately for the
expected type of the parameter.
-For OSSL_PARAM_get_utf8_ptr() and OSSL_PARAM_get_octet_ptr(), B<bsize>
-is not relevant if the purpose is to send the B<OSSL_PARAM> array to a
-I<responder>, i.e. to get parameter data back.
+For OSSL_PARAM_construct_utf8_ptr() and OSSL_PARAM_consstruct_octet_ptr(),
+B<bsize> is not relevant if the purpose is to send the B<OSSL_PARAM> array
+to a I<responder>, i.e. to get parameter data back.
In that case, B<bsize> can safely be given zero.
See L<OSSL_PARAM(3)/DESCRIPTION> for further information on the
possible purposes.