BIND 10 trac781, updated. 7be4a7e7f859881a3e5a3f4268dbdbc3468b7214 [trac781] add deleteHMAC()
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Apr 26 15:07:10 UTC 2011
The branch, trac781 has been updated
via 7be4a7e7f859881a3e5a3f4268dbdbc3468b7214 (commit)
from 6c274fd95d3c2bcc99113108f5a68aa0364f924c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7be4a7e7f859881a3e5a3f4268dbdbc3468b7214
Author: Jelte Jansen <jelte at isc.org>
Date: Tue Apr 26 17:07:06 2011 +0200
[trac781] add deleteHMAC()
-----------------------------------------------------------------------
Summary of changes:
src/lib/cryptolink/crypto_hmac.cc | 5 +++++
src/lib/cryptolink/crypto_hmac.h | 3 +++
src/lib/cryptolink/cryptolink.h | 13 ++++++++++++-
3 files changed, 20 insertions(+), 1 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/cryptolink/crypto_hmac.cc b/src/lib/cryptolink/crypto_hmac.cc
index 595dd9a..6543e44 100644
--- a/src/lib/cryptolink/crypto_hmac.cc
+++ b/src/lib/cryptolink/crypto_hmac.cc
@@ -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
diff --git a/src/lib/cryptolink/crypto_hmac.h b/src/lib/cryptolink/crypto_hmac.h
index ddaa4a9..0c05c7e 100644
--- a/src/lib/cryptolink/crypto_hmac.h
+++ b/src/lib/cryptolink/crypto_hmac.h
@@ -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
diff --git a/src/lib/cryptolink/cryptolink.h b/src/lib/cryptolink/cryptolink.h
index 44db8ac..0436edb 100644
--- a/src/lib/cryptolink/cryptolink.h
+++ b/src/lib/cryptolink/cryptolink.h
@@ -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
More information about the bind10-changes
mailing list