Lines Matching refs:len
61 RAND_POOL *ossl_rand_pool_attach(const unsigned char *buffer, size_t len, in ossl_rand_pool_attach() argument
75 pool->len = len; in ossl_rand_pool_attach()
79 pool->min_len = pool->max_len = pool->alloc_len = pool->len; in ossl_rand_pool_attach()
130 return pool->len; in ossl_rand_pool_length()
154 OPENSSL_cleanse(pool->buffer, pool->len); in ossl_rand_pool_reattach()
155 pool->len = 0; in ossl_rand_pool_reattach()
179 if (pool->len < pool->min_len) in ossl_rand_pool_entropy_available()
199 static int rand_pool_grow(RAND_POOL *pool, size_t len) in rand_pool_grow() argument
201 if (len > pool->alloc_len - pool->len) { in rand_pool_grow()
206 if (pool->attached || len > pool->max_len - pool->len) { in rand_pool_grow()
213 while (len > newlen - pool->len); in rand_pool_grow()
221 memcpy(p, pool->buffer, pool->len); in rand_pool_grow()
250 if (bytes_needed > pool->max_len - pool->len) { in ossl_rand_pool_bytes_needed()
256 pool->max_len, pool->len); in ossl_rand_pool_bytes_needed()
260 if (pool->len < pool->min_len && in ossl_rand_pool_bytes_needed()
261 bytes_needed < pool->min_len - pool->len) in ossl_rand_pool_bytes_needed()
263 bytes_needed = pool->min_len - pool->len; in ossl_rand_pool_bytes_needed()
279 pool->max_len = pool->len = 0; in ossl_rand_pool_bytes_needed()
289 return pool->max_len - pool->len; in ossl_rand_pool_bytes_remaining()
302 const unsigned char *buffer, size_t len, size_t entropy) in ossl_rand_pool_add() argument
304 if (len > pool->max_len - pool->len) { in ossl_rand_pool_add()
314 if (len > 0) { in ossl_rand_pool_add()
323 if (pool->alloc_len > pool->len && pool->buffer + pool->len == buffer) { in ossl_rand_pool_add()
334 if (!rand_pool_grow(pool, len)) in ossl_rand_pool_add()
336 memcpy(pool->buffer + pool->len, buffer, len); in ossl_rand_pool_add()
337 pool->len += len; in ossl_rand_pool_add()
356 unsigned char *ossl_rand_pool_add_begin(RAND_POOL *pool, size_t len) in ossl_rand_pool_add_begin() argument
358 if (len == 0) in ossl_rand_pool_add_begin()
361 if (len > pool->max_len - pool->len) { in ossl_rand_pool_add_begin()
380 if (!rand_pool_grow(pool, len)) in ossl_rand_pool_add_begin()
383 return pool->buffer + pool->len; in ossl_rand_pool_add_begin()
395 int ossl_rand_pool_add_end(RAND_POOL *pool, size_t len, size_t entropy) in ossl_rand_pool_add_end() argument
397 if (len > pool->alloc_len - pool->len) { in ossl_rand_pool_add_end()
402 if (len > 0) { in ossl_rand_pool_add_end()
403 pool->len += len; in ossl_rand_pool_add_end()