| 1 | /* @title: Entropy Pool */ |
|---|---|
| 2 | #include <stdint.h> |
| 3 | #include <sync/spinlock.h> |
| 4 | #pragma once |
| 5 | #define ENTROPY_POOL_SIZE 64 // 512 bits |
| 6 | #define ENTROPY_MAX_BITS (ENTROPY_POOL_SIZE * 8) |
| 7 | |
| 8 | struct entropy_pool { |
| 9 | uint8_t buffer[ENTROPY_POOL_SIZE]; // Raw pool data |
| 10 | uint64_t write_pos; // Circular buffer write position |
| 11 | uint64_t entropy_bits; // Estimated entropy in bits |
| 12 | struct spinlock lock; // To protect concurrent access |
| 13 | }; |
| 14 |