mirror of
https://github.com/clearml/dropbear
synced 2025-02-12 07:25:30 +00:00
Make hmac-sha2-256 and hmac-sha2-512 work
This commit is contained in:
parent
eaa737fecd
commit
024d268d8c
@ -45,8 +45,8 @@ static int void_start(int cipher, const unsigned char *IV,
|
|||||||
|
|
||||||
/* Mappings for ciphers, parameters are
|
/* Mappings for ciphers, parameters are
|
||||||
{&cipher_desc, keysize, blocksize} */
|
{&cipher_desc, keysize, blocksize} */
|
||||||
/* NOTE: if keysize > 2*SHA1_HASH_SIZE, code such as hashkeys()
|
|
||||||
needs revisiting */
|
/* Remember to add new ciphers/hashes to regciphers/reghashes too */
|
||||||
|
|
||||||
#ifdef DROPBEAR_AES256
|
#ifdef DROPBEAR_AES256
|
||||||
static const struct dropbear_cipher dropbear_aes256 =
|
static const struct dropbear_cipher dropbear_aes256 =
|
||||||
@ -168,10 +168,10 @@ algo_type sshciphers[] = {
|
|||||||
|
|
||||||
algo_type sshhashes[] = {
|
algo_type sshhashes[] = {
|
||||||
#ifdef DROPBEAR_SHA2_256_HMAC
|
#ifdef DROPBEAR_SHA2_256_HMAC
|
||||||
// {"hmac-sha2-256", 0, &dropbear_sha2_256, 1, NULL},
|
{"hmac-sha2-256", 0, &dropbear_sha2_256, 1, NULL},
|
||||||
#endif
|
#endif
|
||||||
#ifdef DROPBEAR_SHA2_512_HMAC
|
#ifdef DROPBEAR_SHA2_512_HMAC
|
||||||
// {"hmac-sha2-512", 0, &dropbear_sha2_512, 1, NULL},
|
{"hmac-sha2-512", 0, &dropbear_sha2_512, 1, NULL},
|
||||||
#endif
|
#endif
|
||||||
#ifdef DROPBEAR_SHA1_96_HMAC
|
#ifdef DROPBEAR_SHA1_96_HMAC
|
||||||
{"hmac-sha1-96", 0, &dropbear_sha1_96, 1, NULL},
|
{"hmac-sha1-96", 0, &dropbear_sha1_96, 1, NULL},
|
||||||
@ -244,6 +244,12 @@ void crypto_init() {
|
|||||||
&sha1_desc,
|
&sha1_desc,
|
||||||
#ifdef DROPBEAR_MD5_HMAC
|
#ifdef DROPBEAR_MD5_HMAC
|
||||||
&md5_desc,
|
&md5_desc,
|
||||||
|
#endif
|
||||||
|
#ifdef DROPBEAR_SHA2_256_HMAC
|
||||||
|
&sha256_desc,
|
||||||
|
#endif
|
||||||
|
#ifdef DROPBEAR_SHA2_512_HMAC
|
||||||
|
&sha512_desc,
|
||||||
#endif
|
#endif
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -78,7 +78,7 @@ struct key_context_directional {
|
|||||||
symmetric_CTR ctr;
|
symmetric_CTR ctr;
|
||||||
#endif
|
#endif
|
||||||
} cipher_state;
|
} cipher_state;
|
||||||
unsigned char mackey[MAX_MAC_KEY];
|
unsigned char mackey[MAX_MAC_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct key_context {
|
struct key_context {
|
||||||
|
15
sysoptions.h
15
sysoptions.h
@ -76,26 +76,19 @@
|
|||||||
#define DROPBEAR_SIGNKEY_VERIFY
|
#define DROPBEAR_SIGNKEY_VERIFY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* SHA1 is 20 bytes == 160 bits */
|
|
||||||
#define SHA1_HASH_SIZE 20
|
#define SHA1_HASH_SIZE 20
|
||||||
/* SHA512 is 64 bytes == 512 bits */
|
|
||||||
#define SHA512_HASH_SIZE 64
|
|
||||||
/* MD5 is 16 bytes = 128 bits */
|
|
||||||
#define MD5_HASH_SIZE 16
|
#define MD5_HASH_SIZE 16
|
||||||
|
|
||||||
/* largest of MD5 and SHA1 */
|
|
||||||
#define MAX_MAC_LEN SHA1_HASH_SIZE
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_KEY_LEN 32 /* 256 bits for aes256 etc */
|
#define MAX_KEY_LEN 32 /* 256 bits for aes256 etc */
|
||||||
#define MAX_IV_LEN 20 /* must be same as max blocksize,
|
#define MAX_IV_LEN 20 /* must be same as max blocksize,
|
||||||
and >= SHA1_HASH_SIZE */
|
and >= SHA1_HASH_SIZE */
|
||||||
|
|
||||||
#if defined(DROPBEAR_SHA2_512_HMAC)
|
#if defined(DROPBEAR_SHA2_512_HMAC)
|
||||||
#define MAX_MAC_KEY 64
|
#define MAX_MAC_LEN 64
|
||||||
#elif defined(DROPBEAR_SHA2_256_HMAC)
|
#elif defined(DROPBEAR_SHA2_256_HMAC)
|
||||||
#define MAX_MAC_KEY 32
|
#define MAX_MAC_LEN 32
|
||||||
#else
|
#else
|
||||||
#define MAX_MAC_KEY 20
|
#define MAX_MAC_LEN 20
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_NAME_LEN 64 /* maximum length of a protocol name, isn't
|
#define MAX_NAME_LEN 64 /* maximum length of a protocol name, isn't
|
||||||
|
Loading…
Reference in New Issue
Block a user