mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-18 19:41:01 -05:00
Centralised HMAC implementation.
This replaces all the separate HMAC-implementing wrappers in the various source files implementing the underlying hashes. The new HMAC code also correctly handles the case of a key longer than the underlying hash's block length, by replacing it with its own hash. This means I can reinstate the test vectors in RFC 6234 which exercise that case, which I didn't add to cryptsuite before because they'd have failed. It also allows me to remove the ad-hoc code at the call site in cproxy.c which turns out to have been doing the same thing - I think that must have been the only call site where the question came up (since MAC keys invented by the main SSH-2 BPP are always shorter than that).
This commit is contained in:
@ -31,10 +31,16 @@ struct BinarySink {
|
||||
* put 'BinarySink_DELEGATE_IMPLEMENTATION' in its declaration, and
|
||||
* when an instance is set up, use 'BinarySink_DELEGATE_INIT' to point
|
||||
* at the object it wants to delegate to.
|
||||
*
|
||||
* In such a delegated structure, you might sometimes want to have the
|
||||
* delegation stop being valid (e.g. it might be delegating to an
|
||||
* object that only sometimes exists). You can null out the delegate
|
||||
* pointer using BinarySink_DELEGATE_CLEAR.
|
||||
*/
|
||||
#define BinarySink_DELEGATE_IMPLEMENTATION BinarySink *binarysink_
|
||||
#define BinarySink_DELEGATE_INIT(obj, othersink) \
|
||||
((obj)->binarysink_ = BinarySink_UPCAST(othersink))
|
||||
#define BinarySink_DELEGATE_CLEAR(obj) ((obj)->binarysink_ = NULL)
|
||||
|
||||
/*
|
||||
* The implementing type's write function will want to downcast its
|
||||
|
Reference in New Issue
Block a user