diff options
author | Jack Lloyd <[email protected]> | 2018-08-10 21:30:23 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-10 21:30:23 -0400 |
commit | 4bae26bc1a884d534dc482ba3cd4cbeaa50f4963 (patch) | |
tree | b61b2c328e8d479f019fddd97a260344d08575e8 /src/lib/ffi/ffi_rng.cpp | |
parent | 4c1129afb9c712f3de01d47992c9f52edfb7eee0 (diff) |
Add some useful FFI functions
Diffstat (limited to 'src/lib/ffi/ffi_rng.cpp')
-rw-r--r-- | src/lib/ffi/ffi_rng.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/ffi/ffi_rng.cpp b/src/lib/ffi/ffi_rng.cpp index a4dda59ec..7e185f75d 100644 --- a/src/lib/ffi/ffi_rng.cpp +++ b/src/lib/ffi/ffi_rng.cpp @@ -32,6 +32,10 @@ int botan_rng_init(botan_rng_t* rng_out, const char* rng_type) { rng.reset(new Botan::AutoSeeded_RNG); } + else if(rng_type_s == "null") + { + rng.reset(new Botan::Null_RNG); + } #if defined(BOTAN_TARGET_OS_HAS_THREADS) else if(rng_type_s == "user-threadsafe") { @@ -68,4 +72,9 @@ int botan_rng_add_entropy(botan_rng_t rng, const uint8_t* input, size_t len) return BOTAN_FFI_DO(Botan::RandomNumberGenerator, rng, r, { r.add_entropy(input, len); }); } +int botan_rng_reseed_from_rng(botan_rng_t rng, botan_rng_t source_rng, size_t bits) + { + return BOTAN_FFI_DO(Botan::RandomNumberGenerator, rng, r, { r.reseed_from_rng(safe_get(source_rng), bits); }); + } + } |