# HG changeset patch # User Matt Johnston # Date 1497623718 -28800 # Node ID 92717c0fec395b48946f2c97c1e26edd8d907af6 # Parent 33d90d219e0327ad20e6466fe5f8d46d80f1bcb8 check p and q lengths diff -r 33d90d219e03 -r 92717c0fec39 dss.c --- a/dss.c Fri Jun 23 21:31:25 2017 +0800 +++ b/dss.c Fri Jun 16 22:35:18 2017 +0800 @@ -61,8 +61,15 @@ goto out; } - if (mp_count_bits(key->p) < MIN_DSS_KEYLEN) { - dropbear_log(LOG_WARNING, "DSS key too short"); + if (mp_count_bits(key->p) < DSS_P_BITS) { + 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")) ret = DROPBEAR_FAILURE; goto out; diff -r 33d90d219e03 -r 92717c0fec39 dss.h --- a/dss.h Fri Jun 23 21:31:25 2017 +0800 +++ b/dss.h Fri Jun 16 22:35:18 2017 +0800 @@ -41,6 +41,9 @@ } 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); #if DROPBEAR_SIGNKEY_VERIFY int buf_dss_verify(buffer* buf, dropbear_dss_key *key, buffer *data_buf);