Lines Matching refs:val
166 static int general_get_int(const OSSL_PARAM *p, void *val, size_t val_size) in general_get_int() argument
169 return signed_from_signed(val, val_size, p->data, p->data_size); in general_get_int()
171 return signed_from_unsigned(val, val_size, p->data, p->data_size); in general_get_int()
176 static int general_set_int(OSSL_PARAM *p, void *val, size_t val_size) in general_set_int() argument
184 r = signed_from_signed(p->data, p->data_size, val, val_size); in general_set_int()
186 r = unsigned_from_signed(p->data, p->data_size, val, val_size); in general_set_int()
192 static int general_get_uint(const OSSL_PARAM *p, void *val, size_t val_size) in general_get_uint() argument
195 return unsigned_from_signed(val, val_size, p->data, p->data_size); in general_get_uint()
197 return unsigned_from_unsigned(val, val_size, p->data, p->data_size); in general_get_uint()
202 static int general_set_uint(OSSL_PARAM *p, void *val, size_t val_size) in general_set_uint() argument
210 r = signed_from_unsigned(p->data, p->data_size, val, val_size); in general_set_uint()
212 r = unsigned_from_unsigned(p->data, p->data_size, val, val_size); in general_set_uint()
217 int OSSL_PARAM_get_int(const OSSL_PARAM *p, int *val) in OSSL_PARAM_get_int() argument
222 return OSSL_PARAM_get_int32(p, (int32_t *)val); in OSSL_PARAM_get_int()
224 return OSSL_PARAM_get_int64(p, (int64_t *)val); in OSSL_PARAM_get_int()
227 return general_get_int(p, val, sizeof(*val)); in OSSL_PARAM_get_int()
230 int OSSL_PARAM_set_int(OSSL_PARAM *p, int val) in OSSL_PARAM_set_int() argument
235 return OSSL_PARAM_set_int32(p, (int32_t)val); in OSSL_PARAM_set_int()
237 return OSSL_PARAM_set_int64(p, (int64_t)val); in OSSL_PARAM_set_int()
240 return general_set_int(p, &val, sizeof(val)); in OSSL_PARAM_set_int()
248 int OSSL_PARAM_get_uint(const OSSL_PARAM *p, unsigned int *val) in OSSL_PARAM_get_uint() argument
253 return OSSL_PARAM_get_uint32(p, (uint32_t *)val); in OSSL_PARAM_get_uint()
255 return OSSL_PARAM_get_uint64(p, (uint64_t *)val); in OSSL_PARAM_get_uint()
258 return general_get_uint(p, val, sizeof(*val)); in OSSL_PARAM_get_uint()
261 int OSSL_PARAM_set_uint(OSSL_PARAM *p, unsigned int val) in OSSL_PARAM_set_uint() argument
266 return OSSL_PARAM_set_uint32(p, (uint32_t)val); in OSSL_PARAM_set_uint()
268 return OSSL_PARAM_set_uint64(p, (uint64_t)val); in OSSL_PARAM_set_uint()
271 return general_set_uint(p, &val, sizeof(val)); in OSSL_PARAM_set_uint()
280 int OSSL_PARAM_get_long(const OSSL_PARAM *p, long int *val) in OSSL_PARAM_get_long() argument
285 return OSSL_PARAM_get_int32(p, (int32_t *)val); in OSSL_PARAM_get_long()
287 return OSSL_PARAM_get_int64(p, (int64_t *)val); in OSSL_PARAM_get_long()
290 return general_get_int(p, val, sizeof(*val)); in OSSL_PARAM_get_long()
293 int OSSL_PARAM_set_long(OSSL_PARAM *p, long int val) in OSSL_PARAM_set_long() argument
298 return OSSL_PARAM_set_int32(p, (int32_t)val); in OSSL_PARAM_set_long()
300 return OSSL_PARAM_set_int64(p, (int64_t)val); in OSSL_PARAM_set_long()
303 return general_set_int(p, &val, sizeof(val)); in OSSL_PARAM_set_long()
311 int OSSL_PARAM_get_ulong(const OSSL_PARAM *p, unsigned long int *val) in OSSL_PARAM_get_ulong() argument
316 return OSSL_PARAM_get_uint32(p, (uint32_t *)val); in OSSL_PARAM_get_ulong()
318 return OSSL_PARAM_get_uint64(p, (uint64_t *)val); in OSSL_PARAM_get_ulong()
321 return general_get_uint(p, val, sizeof(*val)); in OSSL_PARAM_get_ulong()
324 int OSSL_PARAM_set_ulong(OSSL_PARAM *p, unsigned long int val) in OSSL_PARAM_set_ulong() argument
329 return OSSL_PARAM_set_uint32(p, (uint32_t)val); in OSSL_PARAM_set_ulong()
331 return OSSL_PARAM_set_uint64(p, (uint64_t)val); in OSSL_PARAM_set_ulong()
334 return general_set_uint(p, &val, sizeof(val)); in OSSL_PARAM_set_ulong()
343 int OSSL_PARAM_get_int32(const OSSL_PARAM *p, int32_t *val) in OSSL_PARAM_get_int32() argument
347 if (val == NULL || p == NULL ) in OSSL_PARAM_get_int32()
356 *val = *(const int32_t *)p->data; in OSSL_PARAM_get_int32()
361 *val = (int32_t)i64; in OSSL_PARAM_get_int32()
367 return general_get_int(p, val, sizeof(*val)); in OSSL_PARAM_get_int32()
378 *val = (int32_t)u32; in OSSL_PARAM_get_int32()
385 *val = (int32_t)u64; in OSSL_PARAM_get_int32()
391 return general_get_int(p, val, sizeof(*val)); in OSSL_PARAM_get_int32()
398 *val = (int32_t)d; in OSSL_PARAM_get_int32()
407 int OSSL_PARAM_set_int32(OSSL_PARAM *p, int32_t val) in OSSL_PARAM_set_int32() argument
419 *(int32_t *)p->data = val; in OSSL_PARAM_set_int32()
423 *(int64_t *)p->data = (int64_t)val; in OSSL_PARAM_set_int32()
427 return general_set_int(p, &val, sizeof(val)); in OSSL_PARAM_set_int32()
428 } else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER && val >= 0) { in OSSL_PARAM_set_int32()
435 *(uint32_t *)p->data = (uint32_t)val; in OSSL_PARAM_set_int32()
439 *(uint64_t *)p->data = (uint64_t)val; in OSSL_PARAM_set_int32()
443 return general_set_int(p, &val, sizeof(val)); in OSSL_PARAM_set_int32()
450 *(double *)p->data = (double)val; in OSSL_PARAM_set_int32()
463 int OSSL_PARAM_get_uint32(const OSSL_PARAM *p, uint32_t *val) in OSSL_PARAM_get_uint32() argument
467 if (val == NULL || p == NULL) in OSSL_PARAM_get_uint32()
476 *val = *(const uint32_t *)p->data; in OSSL_PARAM_get_uint32()
481 *val = (uint32_t)u64; in OSSL_PARAM_get_uint32()
487 return general_get_uint(p, val, sizeof(*val)); in OSSL_PARAM_get_uint32()
497 *val = i32; in OSSL_PARAM_get_uint32()
504 *val = (uint32_t)i64; in OSSL_PARAM_get_uint32()
510 return general_get_uint(p, val, sizeof(*val)); in OSSL_PARAM_get_uint32()
516 *val = (uint32_t)d; in OSSL_PARAM_get_uint32()
525 int OSSL_PARAM_set_uint32(OSSL_PARAM *p, uint32_t val) in OSSL_PARAM_set_uint32() argument
538 *(uint32_t *)p->data = val; in OSSL_PARAM_set_uint32()
542 *(uint64_t *)p->data = val; in OSSL_PARAM_set_uint32()
546 return general_set_uint(p, &val, sizeof(val)); in OSSL_PARAM_set_uint32()
554 if (val <= INT32_MAX) { in OSSL_PARAM_set_uint32()
555 *(int32_t *)p->data = (int32_t)val; in OSSL_PARAM_set_uint32()
561 *(int64_t *)p->data = (int64_t)val; in OSSL_PARAM_set_uint32()
565 return general_set_uint(p, &val, sizeof(val)); in OSSL_PARAM_set_uint32()
572 *(double *)p->data = (double)val; in OSSL_PARAM_set_uint32()
585 int OSSL_PARAM_get_int64(const OSSL_PARAM *p, int64_t *val) in OSSL_PARAM_get_int64() argument
589 if (val == NULL || p == NULL ) in OSSL_PARAM_get_int64()
596 *val = *(const int32_t *)p->data; in OSSL_PARAM_get_int64()
599 *val = *(const int64_t *)p->data; in OSSL_PARAM_get_int64()
603 return general_get_int(p, val, sizeof(*val)); in OSSL_PARAM_get_int64()
610 *val = *(const uint32_t *)p->data; in OSSL_PARAM_get_int64()
615 *val = (int64_t)u64; in OSSL_PARAM_get_int64()
621 return general_get_int(p, val, sizeof(*val)); in OSSL_PARAM_get_int64()
634 *val = (int64_t)d; in OSSL_PARAM_get_int64()
643 int OSSL_PARAM_set_int64(OSSL_PARAM *p, int64_t val) in OSSL_PARAM_set_int64() argument
657 if (val >= INT32_MIN && val <= INT32_MAX) { in OSSL_PARAM_set_int64()
659 *(int32_t *)p->data = (int32_t)val; in OSSL_PARAM_set_int64()
664 *(int64_t *)p->data = val; in OSSL_PARAM_set_int64()
668 return general_set_int(p, &val, sizeof(val)); in OSSL_PARAM_set_int64()
669 } else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER && val >= 0) { in OSSL_PARAM_set_int64()
676 if (val <= UINT32_MAX) { in OSSL_PARAM_set_int64()
678 *(uint32_t *)p->data = (uint32_t)val; in OSSL_PARAM_set_int64()
683 *(uint64_t *)p->data = (uint64_t)val; in OSSL_PARAM_set_int64()
687 return general_set_int(p, &val, sizeof(val)); in OSSL_PARAM_set_int64()
694 u64 = val < 0 ? -val : val; in OSSL_PARAM_set_int64()
696 *(double *)p->data = (double)val; in OSSL_PARAM_set_int64()
710 int OSSL_PARAM_get_uint64(const OSSL_PARAM *p, uint64_t *val) in OSSL_PARAM_get_uint64() argument
714 if (val == NULL || p == NULL) in OSSL_PARAM_get_uint64()
721 *val = *(const uint32_t *)p->data; in OSSL_PARAM_get_uint64()
724 *val = *(const uint64_t *)p->data; in OSSL_PARAM_get_uint64()
728 return general_get_uint(p, val, sizeof(*val)); in OSSL_PARAM_get_uint64()
738 *val = (uint64_t)i32; in OSSL_PARAM_get_uint64()
745 *val = (uint64_t)i64; in OSSL_PARAM_get_uint64()
751 return general_get_uint(p, val, sizeof(*val)); in OSSL_PARAM_get_uint64()
764 *val = (uint64_t)d; in OSSL_PARAM_get_uint64()
773 int OSSL_PARAM_set_uint64(OSSL_PARAM *p, uint64_t val) in OSSL_PARAM_set_uint64() argument
786 if (val <= UINT32_MAX) { in OSSL_PARAM_set_uint64()
788 *(uint32_t *)p->data = (uint32_t)val; in OSSL_PARAM_set_uint64()
793 *(uint64_t *)p->data = val; in OSSL_PARAM_set_uint64()
797 return general_set_uint(p, &val, sizeof(val)); in OSSL_PARAM_set_uint64()
805 if (val <= INT32_MAX) { in OSSL_PARAM_set_uint64()
807 *(int32_t *)p->data = (int32_t)val; in OSSL_PARAM_set_uint64()
812 if (val <= INT64_MAX) { in OSSL_PARAM_set_uint64()
813 *(int64_t *)p->data = (int64_t)val; in OSSL_PARAM_set_uint64()
819 return general_set_uint(p, &val, sizeof(val)); in OSSL_PARAM_set_uint64()
824 if ((val >> real_shift()) == 0) { in OSSL_PARAM_set_uint64()
825 *(double *)p->data = (double)val; in OSSL_PARAM_set_uint64()
840 int OSSL_PARAM_get_size_t(const OSSL_PARAM *p, size_t *val) in OSSL_PARAM_get_size_t() argument
845 return OSSL_PARAM_get_uint32(p, (uint32_t *)val); in OSSL_PARAM_get_size_t()
847 return OSSL_PARAM_get_uint64(p, (uint64_t *)val); in OSSL_PARAM_get_size_t()
850 return general_get_uint(p, val, sizeof(*val)); in OSSL_PARAM_get_size_t()
853 int OSSL_PARAM_set_size_t(OSSL_PARAM *p, size_t val) in OSSL_PARAM_set_size_t() argument
858 return OSSL_PARAM_set_uint32(p, (uint32_t)val); in OSSL_PARAM_set_size_t()
860 return OSSL_PARAM_set_uint64(p, (uint64_t)val); in OSSL_PARAM_set_size_t()
863 return general_set_uint(p, &val, sizeof(val)); in OSSL_PARAM_set_size_t()
872 int OSSL_PARAM_get_time_t(const OSSL_PARAM *p, time_t *val) in OSSL_PARAM_get_time_t() argument
877 return OSSL_PARAM_get_int32(p, (int32_t *)val); in OSSL_PARAM_get_time_t()
879 return OSSL_PARAM_get_int64(p, (int64_t *)val); in OSSL_PARAM_get_time_t()
882 return general_get_int(p, val, sizeof(*val)); in OSSL_PARAM_get_time_t()
885 int OSSL_PARAM_set_time_t(OSSL_PARAM *p, time_t val) in OSSL_PARAM_set_time_t() argument
890 return OSSL_PARAM_set_int32(p, (int32_t)val); in OSSL_PARAM_set_time_t()
892 return OSSL_PARAM_set_int64(p, (int64_t)val); in OSSL_PARAM_set_time_t()
895 return general_set_int(p, &val, sizeof(val)); in OSSL_PARAM_set_time_t()
903 int OSSL_PARAM_get_BN(const OSSL_PARAM *p, BIGNUM **val) in OSSL_PARAM_get_BN() argument
907 if (val == NULL in OSSL_PARAM_get_BN()
912 b = BN_native2bn(p->data, (int)p->data_size, *val); in OSSL_PARAM_get_BN()
914 *val = b; in OSSL_PARAM_get_BN()
920 int OSSL_PARAM_set_BN(OSSL_PARAM *p, const BIGNUM *val) in OSSL_PARAM_set_BN() argument
927 if (val == NULL || p->data_type != OSSL_PARAM_UNSIGNED_INTEGER) in OSSL_PARAM_set_BN()
931 if (BN_is_negative(val)) in OSSL_PARAM_set_BN()
934 bytes = (size_t)BN_num_bytes(val); in OSSL_PARAM_set_BN()
944 return BN_bn2nativepad(val, p->data, p->data_size) >= 0; in OSSL_PARAM_set_BN()
956 int OSSL_PARAM_get_double(const OSSL_PARAM *p, double *val) in OSSL_PARAM_get_double() argument
961 if (val == NULL || p == NULL) in OSSL_PARAM_get_double()
967 *val = *(const double *)p->data; in OSSL_PARAM_get_double()
973 *val = *(const uint32_t *)p->data; in OSSL_PARAM_get_double()
978 *val = (double)u64; in OSSL_PARAM_get_double()
986 *val = *(const int32_t *)p->data; in OSSL_PARAM_get_double()
992 *val = 0.0 + i64; in OSSL_PARAM_get_double()
1001 int OSSL_PARAM_set_double(OSSL_PARAM *p, double val) in OSSL_PARAM_set_double() argument
1013 *(double *)p->data = val; in OSSL_PARAM_set_double()
1017 && val == (uint64_t)val) { in OSSL_PARAM_set_double()
1023 if (val >= 0 && val <= UINT32_MAX) { in OSSL_PARAM_set_double()
1025 *(uint32_t *)p->data = (uint32_t)val; in OSSL_PARAM_set_double()
1030 if (val >= 0 in OSSL_PARAM_set_double()
1036 && val < (double)(UINT64_MAX - 65535) + 65536.0) { in OSSL_PARAM_set_double()
1038 *(uint64_t *)p->data = (uint64_t)val; in OSSL_PARAM_set_double()
1042 } else if (p->data_type == OSSL_PARAM_INTEGER && val == (int64_t)val) { in OSSL_PARAM_set_double()
1048 if (val >= INT32_MIN && val <= INT32_MAX) { in OSSL_PARAM_set_double()
1050 *(int32_t *)p->data = (int32_t)val; in OSSL_PARAM_set_double()
1055 if (val >= INT64_MIN in OSSL_PARAM_set_double()
1061 && val < (double)(INT64_MAX - 65535) + 65536.0) { in OSSL_PARAM_set_double()
1063 *(int64_t *)p->data = (int64_t)val; in OSSL_PARAM_set_double()
1077 static int get_string_internal(const OSSL_PARAM *p, void **val, in get_string_internal() argument
1083 if ((val == NULL && used_len == NULL) || p == NULL || p->data_type != type) in get_string_internal()
1099 if (val == NULL) in get_string_internal()
1102 if (*val == NULL) { in get_string_internal()
1107 *val = q; in get_string_internal()
1113 memcpy(*val, p->data, sz); in get_string_internal()
1117 int OSSL_PARAM_get_utf8_string(const OSSL_PARAM *p, char **val, size_t max_len) in OSSL_PARAM_get_utf8_string() argument
1119 int ret = get_string_internal(p, (void **)val, &max_len, NULL, in OSSL_PARAM_get_utf8_string()
1141 (*val)[data_length] = '\0'; in OSSL_PARAM_get_utf8_string()
1146 int OSSL_PARAM_get_octet_string(const OSSL_PARAM *p, void **val, size_t max_len, in OSSL_PARAM_get_octet_string() argument
1149 return get_string_internal(p, val, &max_len, used_len, in OSSL_PARAM_get_octet_string()
1153 static int set_string_internal(OSSL_PARAM *p, const void *val, size_t len, in set_string_internal() argument
1162 memcpy(p->data, val, len); in set_string_internal()
1169 int OSSL_PARAM_set_utf8_string(OSSL_PARAM *p, const char *val) in OSSL_PARAM_set_utf8_string() argument
1175 if (val == NULL) in OSSL_PARAM_set_utf8_string()
1177 return set_string_internal(p, val, strlen(val), OSSL_PARAM_UTF8_STRING); in OSSL_PARAM_set_utf8_string()
1180 int OSSL_PARAM_set_octet_string(OSSL_PARAM *p, const void *val, in OSSL_PARAM_set_octet_string() argument
1187 if (val == NULL) in OSSL_PARAM_set_octet_string()
1189 return set_string_internal(p, val, len, OSSL_PARAM_OCTET_STRING); in OSSL_PARAM_set_octet_string()
1206 static int get_ptr_internal(const OSSL_PARAM *p, const void **val, in get_ptr_internal() argument
1209 if (val == NULL || p == NULL || p->data_type != type) in get_ptr_internal()
1213 *val = *(const void **)p->data; in get_ptr_internal()
1217 int OSSL_PARAM_get_utf8_ptr(const OSSL_PARAM *p, const char **val) in OSSL_PARAM_get_utf8_ptr() argument
1219 return get_ptr_internal(p, (const void **)val, NULL, OSSL_PARAM_UTF8_PTR); in OSSL_PARAM_get_utf8_ptr()
1222 int OSSL_PARAM_get_octet_ptr(const OSSL_PARAM *p, const void **val, in OSSL_PARAM_get_octet_ptr() argument
1225 return get_ptr_internal(p, val, used_len, OSSL_PARAM_OCTET_PTR); in OSSL_PARAM_get_octet_ptr()
1228 static int set_ptr_internal(OSSL_PARAM *p, const void *val, in set_ptr_internal() argument
1235 *(const void **)p->data = val; in set_ptr_internal()
1239 int OSSL_PARAM_set_utf8_ptr(OSSL_PARAM *p, const char *val) in OSSL_PARAM_set_utf8_ptr() argument
1244 return set_ptr_internal(p, val, OSSL_PARAM_UTF8_PTR, in OSSL_PARAM_set_utf8_ptr()
1245 val == NULL ? 0 : strlen(val)); in OSSL_PARAM_set_utf8_ptr()
1248 int OSSL_PARAM_set_octet_ptr(OSSL_PARAM *p, const void *val, in OSSL_PARAM_set_octet_ptr() argument
1254 return set_ptr_internal(p, val, OSSL_PARAM_OCTET_PTR, used_len); in OSSL_PARAM_set_octet_ptr()
1276 static int get_string_ptr_internal(const OSSL_PARAM *p, const void **val, in get_string_ptr_internal() argument
1279 if (val == NULL || p == NULL || p->data_type != type) in get_string_ptr_internal()
1283 *val = p->data; in get_string_ptr_internal()
1287 int OSSL_PARAM_get_utf8_string_ptr(const OSSL_PARAM *p, const char **val) in OSSL_PARAM_get_utf8_string_ptr() argument
1289 return OSSL_PARAM_get_utf8_ptr(p, val) in OSSL_PARAM_get_utf8_string_ptr()
1290 || get_string_ptr_internal(p, (const void **)val, NULL, in OSSL_PARAM_get_utf8_string_ptr()
1294 int OSSL_PARAM_get_octet_string_ptr(const OSSL_PARAM *p, const void **val, in OSSL_PARAM_get_octet_string_ptr() argument
1297 return OSSL_PARAM_get_octet_ptr(p, val, used_len) in OSSL_PARAM_get_octet_string_ptr()
1298 || get_string_ptr_internal(p, val, used_len, OSSL_PARAM_OCTET_STRING); in OSSL_PARAM_get_octet_string_ptr()