| 1 | #include <hpke/random.h> |
| 2 | |
| 3 | #include "openssl_common.h" |
| 4 | |
| 5 | #include <openssl/rand.h> |
| 6 | |
| 7 | namespace mlspp::hpke { |
| 8 | |
| 9 | bytes |
| 10 | random_bytes(size_t size) |
| 11 | { |
| 12 | auto rand = bytes(size); |
| 13 | if (1 != RAND_bytes(rand.data(), static_cast<int>(size))) { |
| 14 | throw openssl_error(); |
| 15 | } |
| 16 | return rand; |
| 17 | } |
| 18 | |
| 19 | } // namespace mlspp::hpke |