Lines Matching refs:t
53 PROV_TEST_RNG *t; in test_rng_new() local
55 t = OPENSSL_zalloc(sizeof(*t)); in test_rng_new()
56 if (t == NULL) in test_rng_new()
59 t->max_request = INT_MAX; in test_rng_new()
60 t->provctx = provctx; in test_rng_new()
61 t->state = EVP_RAND_STATE_UNINITIALISED; in test_rng_new()
62 return t; in test_rng_new()
67 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_free() local
69 if (t == NULL) in test_rng_free()
71 OPENSSL_free(t->entropy); in test_rng_free()
72 OPENSSL_free(t->nonce); in test_rng_free()
73 CRYPTO_THREAD_lock_free(t->lock); in test_rng_free()
74 OPENSSL_free(t); in test_rng_free()
82 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_instantiate() local
84 if (!test_rng_set_ctx_params(t, params) || strength > t->strength) in test_rng_instantiate()
87 t->state = EVP_RAND_STATE_READY; in test_rng_instantiate()
88 t->entropy_pos = 0; in test_rng_instantiate()
95 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_uninstantiate() local
97 t->entropy_pos = 0; in test_rng_uninstantiate()
98 t->state = EVP_RAND_STATE_UNINITIALISED; in test_rng_uninstantiate()
106 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_generate() local
108 if (strength > t->strength || t->entropy_len - t->entropy_pos < outlen) in test_rng_generate()
110 memcpy(out, t->entropy + t->entropy_pos, outlen); in test_rng_generate()
111 t->entropy_pos += outlen; in test_rng_generate()
130 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_nonce() local
132 if (t->nonce == NULL || strength > t->strength) in test_rng_nonce()
136 memcpy(out, t->nonce, t->nonce_len); in test_rng_nonce()
137 return t->nonce_len; in test_rng_nonce()
142 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_get_ctx_params() local
146 if (p != NULL && !OSSL_PARAM_set_int(p, t->state)) in test_rng_get_ctx_params()
150 if (p != NULL && !OSSL_PARAM_set_int(p, t->strength)) in test_rng_get_ctx_params()
154 if (p != NULL && !OSSL_PARAM_set_size_t(p, t->max_request)) in test_rng_get_ctx_params()
173 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_set_ctx_params() local
182 if (p != NULL && !OSSL_PARAM_get_uint(p, &t->strength)) in test_rng_set_ctx_params()
189 OPENSSL_free(t->entropy); in test_rng_set_ctx_params()
190 t->entropy = ptr; in test_rng_set_ctx_params()
191 t->entropy_len = size; in test_rng_set_ctx_params()
192 t->entropy_pos = 0; in test_rng_set_ctx_params()
200 OPENSSL_free(t->nonce); in test_rng_set_ctx_params()
201 t->nonce = ptr; in test_rng_set_ctx_params()
202 t->nonce_len = size; in test_rng_set_ctx_params()
206 if (p != NULL && !OSSL_PARAM_get_size_t(p, &t->max_request)) in test_rng_set_ctx_params()
236 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_get_seed() local
238 *pout = t->entropy; in test_rng_get_seed()
239 return t->entropy_len > max_len ? max_len : t->entropy_len; in test_rng_get_seed()
244 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_enable_locking() local
246 if (t != NULL && t->lock == NULL) { in test_rng_enable_locking()
247 t->lock = CRYPTO_THREAD_lock_new(); in test_rng_enable_locking()
248 if (t->lock == NULL) { in test_rng_enable_locking()
258 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_lock() local
260 if (t == NULL || t->lock == NULL) in test_rng_lock()
262 return CRYPTO_THREAD_write_lock(t->lock); in test_rng_lock()
267 PROV_TEST_RNG *t = (PROV_TEST_RNG *)vtest; in test_rng_unlock() local
269 if (t != NULL && t->lock != NULL) in test_rng_unlock()
270 CRYPTO_THREAD_unlock(t->lock); in test_rng_unlock()