isc_throw(InitializationError, "Botan error: " << ex.what());
}
}
- // A not yet fixed bug makes RNG to be destroyed after memory pool...
- atexit([]{ getCryptoLink().getRNG().reset(); });
}
std::string
}
std::vector<uint8_t>
-random(size_t len)
-{
+random(size_t len) {
RNGPtr rng(CryptoLink::getCryptoLink().getRNG());
return (rng->random(len));
}
virtual std::vector<uint8_t> random(size_t len) = 0;
private:
- friend RNGPtr& CryptoLink::getRNG();
+ friend RNGPtr const& CryptoLink::getRNG() const;
};
/// \brief Generate random value.
return (new HMAC(secret, secret_len, hash_algorithm));
}
-RNGPtr&
-CryptoLink::getRNG() {
+RNGPtr const&
+CryptoLink::getRNG() const {
return (rng_);
}
/// in a derived class
/// \exception LibraryError if there was any unexpected exception
/// in the underlying library
- virtual RNGPtr& getRNG();
+ virtual RNGPtr const& getRNG() const;
private:
/// \brief Initialize the library