Commit 7be4a7e7 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[trac781] add deleteHMAC()

parent 6c274fd9
......@@ -228,5 +228,10 @@ verifyHMAC(const void* data, const size_t data_len, const void* secret,
return (hmac->verify(sig, sig_len));
}
void
deleteHMAC(HMAC* hmac) {
delete hmac;
}
} // namespace cryptolink
} // namespace isc
......@@ -199,6 +199,9 @@ bool verifyHMAC(const void* data,
const void* sig,
const size_t sig_len);
/// \brief Delete an HMAC object
void deleteHMAC(HMAC* hmac);
} // namespace cryptolink
} // namespace isc
......
......@@ -112,9 +112,16 @@ class CryptoLinkImpl;
/// have private constructors, it is declared a friend class of these
/// classes.
///
/// Since these factory functions return bare pointers, we also provide
/// deleter functions for them (e.g. deleteHMAC()), so that a caller
/// can use that to make sure it uses the correct delete operator (the
/// one defined at compilation time of this library). A way to make
/// sure you do not forget this, is to place the result of the create
/// functions in a shared_ptr with the corresponding deleter function.
///
/// \note All other classes within cryptolink should have private
/// constructors as well, and should have a factory function from
/// CryptoLink.
/// CryptoLink, and a deleter function.
///
// Internal note: we can use this class later to initialize and manage
// dynamic (PKCS#11) libs
......@@ -161,6 +168,10 @@ public:
/// algorithm, and use the digest as the secret for this HMAC
/// operation
///
/// If you want to safely delete objects created with this method,
/// you can use the function deleteHMAC() as defined in
/// crypto_hmac.h
///
/// \exception UnsupportedAlgorithmException if the given algorithm
/// is unknown or not supported by the underlying library
/// \exception InvalidKeyLength if the given key secret_len is bad
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment