Lines Matching defs:entropy
18 #include <lib/crypto/entropy/collector.h>
19 #include <lib/crypto/entropy/jitterentropy_collector.h>
20 #include <lib/crypto/entropy/hw_rng_collector.h>
21 #include <lib/crypto/entropy/quality_test.h>
42 // of entropy, and false otherwise.
45 // we decide we don't need it for getting entropy from elsewhere.
47 const char* entropy = cmdline_get("kernel.entropy-mixin");
48 if (!entropy) {
53 const size_t hex_len = fbl::min(strlen(entropy), kMaxEntropyArgumentLen);
56 if (!isxdigit(entropy[i])) {
57 panic("Invalid entropy string: idx %zu is not an ASCII hex digit\n", i);
62 clSHA256(entropy, static_cast<int>(hex_len), digest);
71 mandatory_memset(const_cast<char*>(entropy), 'x', hex_len);
73 memcpy(const_cast<char*>(entropy) - 1,
78 LTRACEF("Collected %zu bytes of entropy from the kernel cmdline.\n",
84 static bool SeedFrom(entropy::Collector* collector) {
91 LTRACEF("About to collect %zu bytes of entropy from '%s'.\n",
104 // TODO(ZX-1007): don't assume that every byte of entropy that's added
105 // has a full 8 bits worth of entropy
110 LTRACEF("Successfully collected entropy.\n");
118 // Before doing anything else, test our entropy collector. This is
122 entropy::EarlyBootTest();
134 unsigned int successful = 0; // number of successful entropy sources
135 entropy::Collector* collector;
136 if (entropy::HwRngCollector::GetInstance(&collector) == ZX_OK &&
140 if (entropy::JitterentropyCollector::GetInstance(&collector) == ZX_OK &&
160 LTRACEF("Successfully collected entropy from %u sources.\n",