mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 02:39:48 +09:00
Add logic to support SHA2 HMAC algorithms
BUG: https://red.libssh.org/issues/91 Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
4a08902664
commit
164b8e99cc
@@ -48,6 +48,23 @@
|
||||
#include "libssh/wrapper.h"
|
||||
#include "libssh/pki.h"
|
||||
|
||||
size_t hmac_digest_len(enum ssh_hmac_e type) {
|
||||
switch(type) {
|
||||
case SSH_HMAC_SHA1:
|
||||
return SHA_DIGEST_LEN;
|
||||
case SSH_HMAC_SHA256:
|
||||
return SHA256_DIGEST_LEN;
|
||||
case SSH_HMAC_SHA384:
|
||||
return SHA384_DIGEST_LEN;
|
||||
case SSH_HMAC_SHA512:
|
||||
return SHA512_DIGEST_LEN;
|
||||
case SSH_HMAC_MD5:
|
||||
return MD5_DIGEST_LEN;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* it allocates a new cipher structure based on its offset into the global table */
|
||||
static struct ssh_cipher_struct *cipher_new(int offset) {
|
||||
struct ssh_cipher_struct *cipher = NULL;
|
||||
|
||||
Reference in New Issue
Block a user