diff options
author | Francis Dupont <fdupont@isc.org> | 2014-06-30 15:26:38 +0200 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2014-06-30 15:26:38 +0200 |
commit | 4b4110dd68706b4171fc6d8a6f4f2a9cd820edac (patch) | |
tree | b666ef94ca27398a29f8825bdf26e9f088e88fe1 /src/lib/cryptolink/crypto_hash.cc | |
parent | [master] Added ChangeLog entry 793 (diff) | |
download | kea-4b4110dd68706b4171fc6d8a6f4f2a9cd820edac.tar.xz kea-4b4110dd68706b4171fc6d8a6f4f2a9cd820edac.zip |
applied #2406: OpenSSL alternate crypto backend
Diffstat (limited to 'src/lib/cryptolink/crypto_hash.cc')
-rw-r--r-- | src/lib/cryptolink/crypto_hash.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/lib/cryptolink/crypto_hash.cc b/src/lib/cryptolink/crypto_hash.cc new file mode 100644 index 0000000000..95f0fadb49 --- /dev/null +++ b/src/lib/cryptolink/crypto_hash.cc @@ -0,0 +1,42 @@ +// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include <cryptolink.h> +#include <cryptolink/crypto_hash.h> + +#include <boost/scoped_ptr.hpp> + +#include <cstring> + +namespace isc { +namespace cryptolink { + +void +digest(const void* data, const size_t data_len, + const HashAlgorithm hash_algorithm, + isc::util::OutputBuffer& result, size_t len) +{ + boost::scoped_ptr<Hash> hash( + CryptoLink::getCryptoLink().createHash(hash_algorithm)); + hash->update(data, data_len); + hash->final(result, len); +} + +void +deleteHash(Hash* hash) { + delete hash; +} + +} // namespace cryptolink +} // namespace isc |