Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
7be4a7e7
Commit
7be4a7e7
authored
Apr 26, 2011
by
Jelte Jansen
Browse files
[trac781] add deleteHMAC()
parent
6c274fd9
Changes
3
Show whitespace changes
Inline
Side-by-side
src/lib/cryptolink/crypto_hmac.cc
View file @
7be4a7e7
...
...
@@ -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
src/lib/cryptolink/crypto_hmac.h
View file @
7be4a7e7
...
...
@@ -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
...
...
src/lib/cryptolink/cryptolink.h
View file @
7be4a7e7
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment