mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-18 19:41:01 -05:00
Add an extra HMAC constructor function.
This takes a plain ssh_hashalg, and constructs the most natural kind of HMAC wrapper around it, taking its key length and output length to be the hash's output length. In other words, it converts SHA-foo into exactly the thing usually called HMAC-SHA-foo. It does it by constructing a new ssh2_macalg vtable, and including it in the same memory allocation as the actual hash object. That's the first time in PuTTY I've done it this way. Nothing yet uses this, but a new piece of code is about to.
This commit is contained in:
5
ssh.h
5
ssh.h
@ -762,6 +762,11 @@ void nullmac_next_message(ssh2_mac *m);
|
||||
* string with a given key in the most obvious way. */
|
||||
void mac_simple(const ssh2_macalg *alg, ptrlen key, ptrlen data, void *output);
|
||||
|
||||
/* Constructor that makes an HMAC object given just a MAC. This object
|
||||
* will have empty 'name' and 'etm_name' fields, so it's not suitable
|
||||
* for use in SSH. It's used as a subroutine in RFC 6979. */
|
||||
ssh2_mac *hmac_new_from_hash(const ssh_hashalg *hash);
|
||||
|
||||
struct ssh_hash {
|
||||
const ssh_hashalg *vt;
|
||||
BinarySink_DELEGATE_IMPLEMENTATION;
|
||||
|
Reference in New Issue
Block a user