mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 13:21:15 +00:00
check p and q lengths
--HG-- branch : fuzz
This commit is contained in:
parent
88ce30beb6
commit
e3246ceb7e
13
dss.c
13
dss.c
@ -61,8 +61,15 @@ int buf_get_dss_pub_key(buffer* buf, dropbear_dss_key *key) {
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mp_count_bits(key->p) < MIN_DSS_KEYLEN) {
|
if (mp_count_bits(key->p) < DSS_P_BITS) {
|
||||||
dropbear_log(LOG_WARNING, "DSS key too short");
|
dropbear_log(LOG_WARNING, "Bad DSS p");
|
||||||
|
TRACE(("leave buf_get_dss_pub_key: short key"))
|
||||||
|
ret = DROPBEAR_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mp_count_bits(key->q) < DSS_Q_BITS) {
|
||||||
|
dropbear_log(LOG_WARNING, "Bad DSS q");
|
||||||
TRACE(("leave buf_get_dss_pub_key: short key"))
|
TRACE(("leave buf_get_dss_pub_key: short key"))
|
||||||
ret = DROPBEAR_FAILURE;
|
ret = DROPBEAR_FAILURE;
|
||||||
goto out;
|
goto out;
|
||||||
@ -94,7 +101,7 @@ int buf_get_dss_priv_key(buffer* buf, dropbear_dss_key *key) {
|
|||||||
m_mp_alloc_init_multi(&key->x, NULL);
|
m_mp_alloc_init_multi(&key->x, NULL);
|
||||||
ret = buf_getmpint(buf, key->x);
|
ret = buf_getmpint(buf, key->x);
|
||||||
if (ret == DROPBEAR_FAILURE) {
|
if (ret == DROPBEAR_FAILURE) {
|
||||||
m_mp_free_multi(&key->x);
|
m_mp_free_multi(&key->x, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
3
dss.h
3
dss.h
@ -41,6 +41,9 @@ typedef struct {
|
|||||||
|
|
||||||
} dropbear_dss_key;
|
} dropbear_dss_key;
|
||||||
|
|
||||||
|
#define DSS_P_BITS 1024
|
||||||
|
#define DSS_Q_BITS 160
|
||||||
|
|
||||||
void buf_put_dss_sign(buffer* buf, dropbear_dss_key *key, buffer *data_buf);
|
void buf_put_dss_sign(buffer* buf, dropbear_dss_key *key, buffer *data_buf);
|
||||||
#if DROPBEAR_SIGNKEY_VERIFY
|
#if DROPBEAR_SIGNKEY_VERIFY
|
||||||
int buf_dss_verify(buffer* buf, dropbear_dss_key *key, buffer *data_buf);
|
int buf_dss_verify(buffer* buf, dropbear_dss_key *key, buffer *data_buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user