| 1 | #cxx . . $ `<file>/mlspp/lib/hpke/src/random.cpp`/include <hpke/random.h>cxx . . $ `<file>/mlspp/lib/hpke/include/hpke/random.h`/ |
| 2 | |
| 3 | #include "openssl_common.h"cxx . . $ `<file>/mlspp/lib/hpke/src/openssl_common.h`/ |
| 4 | |
| 5 | #include <openssl/rand.h> |
| 6 | |
| 7 | namespace mlsppcxx . . $ mlspp/::hpkecxx . . $ mlspp/hpke/ { |
| 8 | |
| 9 | bytescxx . . $ mlspp/bytes_ns/bytes# |
| 10 | random_bytescxx . . $ mlspp/hpke/random_bytes(b7161179e0ed6f95).(size_t size) |
| 11 | { |
| 12 | auto rand = bytescxx . . $ mlspp/bytes_ns/bytes#(size); |
| 13 | if (1 != RAND_bytes(rand.datacxx . . $ mlspp/bytes_ns/bytes#data(37d8967d10cb1e7b).(), static_cast<int>(size))) { |
| 14 | throw openssl_errorcxx . . $ mlspp/hpke/openssl_error(d6ab8afd00dfc651).(); |
| 15 | } |
| 16 | return randcxx . . $ mlspp/bytes_ns/bytes#bytes(628b76f52f2a67f).; |
| 17 | } |
| 18 | |
| 19 | } // namespace mlspp::hpke |