Lines Matching refs:len

35 static void rand_bytes(u8 *out, size_t len)  in rand_bytes()  argument
37 for (size_t i = 0; i < len; i++) in rand_bytes()
41 static void rand_bytes_seeded_from_len(u8 *out, size_t len) in rand_bytes_seeded_from_len() argument
43 random_seed = len; in rand_bytes_seeded_from_len()
44 rand_bytes(out, len); in rand_bytes_seeded_from_len()
55 size_t len; in rand_length() local
59 len = rand32() % 128; in rand_length()
62 len = rand32() % 3072; in rand_length()
65 len = rand32(); in rand_length()
68 return len % (max_len + 1); in rand_length()
138 for (size_t len = 0; len <= 4096; len++) { in test_hash_all_lens_up_to_4096() local
139 HASH(test_buf, len, hash); in test_hash_all_lens_up_to_4096()
209 size_t len = rand_length(max_tested_len); in test_hash_buffer_overruns() local
214 HASH(buf_end - len, len, hash); in test_hash_buffer_overruns()
216 HASH_UPDATE(&ctx, buf_end - len, len); in test_hash_buffer_overruns()
220 HASH(test_buf, len, buf_end - HASH_SIZE); in test_hash_buffer_overruns()
222 HASH_UPDATE(&ctx, test_buf, len); in test_hash_buffer_overruns()
227 HASH_UPDATE(guarded_ctx, test_buf, len); in test_hash_buffer_overruns()
245 size_t len = rand_length(max_tested_len); in test_hash_overlaps() local
246 size_t offset = HASH_SIZE + rand_offset(max_tested_len - len); in test_hash_overlaps()
249 &test_buf[offset + len - HASH_SIZE]; in test_hash_overlaps()
251 HASH(&test_buf[offset], len, hash); in test_hash_overlaps()
252 HASH(&test_buf[offset], len, ovl_hash); in test_hash_overlaps()
256 len, offset, left_end); in test_hash_overlaps()
259 HASH(&test_buf[offset], len, hash); in test_hash_overlaps()
261 HASH_UPDATE(&ctx, &test_buf[offset], len); in test_hash_overlaps()
266 len, offset, left_end); in test_hash_overlaps()
269 HASH(&test_buf[offset], len, hash); in test_hash_overlaps()
271 HASH_UPDATE(&ctx, &test_buf[offset], len); in test_hash_overlaps()
272 rand_bytes(&test_buf[offset], len); in test_hash_overlaps()
277 len, offset, left_end); in test_hash_overlaps()
291 size_t len = rand_length(TEST_BUF_LEN); in test_hash_alignment_consistency() local
292 size_t data_offs1 = rand_offset(TEST_BUF_LEN - len); in test_hash_alignment_consistency()
293 size_t data_offs2 = rand_offset(TEST_BUF_LEN - len); in test_hash_alignment_consistency()
297 rand_bytes(&test_buf[data_offs1], len); in test_hash_alignment_consistency()
298 HASH(&test_buf[data_offs1], len, &hash1[hash_offs1]); in test_hash_alignment_consistency()
299 memmove(&test_buf[data_offs2], &test_buf[data_offs1], len); in test_hash_alignment_consistency()
300 HASH(&test_buf[data_offs2], len, &hash2[hash_offs2]); in test_hash_alignment_consistency()
304 len, data_offs1, data_offs2, hash_offs1, hash_offs2); in test_hash_alignment_consistency()
668 size_t len = lens_to_test[i]; in benchmark_hash() local
670 size_t num_iters = 10000000 / (len + 128); in benchmark_hash()
673 KUNIT_ASSERT_LE(test, len, TEST_BUF_LEN); in benchmark_hash()
677 HASH(test_buf, len, hash); in benchmark_hash()
680 kunit_info(test, "len=%zu: %llu MB/s", len, in benchmark_hash()
681 div64_u64((u64)len * num_iters * 1000, t ?: 1)); in benchmark_hash()