diff options
author | Matt Johnston <matt@ucc.asn.au> | 2017-08-14 00:00:10 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2017-08-14 00:00:10 +0800 |
commit | d6158b1efebbacd769c41fd470a0e27d3974f40e (patch) | |
tree | 1c387ddaf695826a84cce73393f7861e9d4599e6 | |
parent | 8abef6b9611ffbed3a4a242e89e1ee50db10b492 (diff) | |
download | dropbear-d6158b1efebbacd769c41fd470a0e27d3974f40e.tar.gz |
check dss g range
-rw-r--r-- | dss.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -73,6 +73,18 @@ int buf_get_dss_pub_key(buffer* buf, dropbear_dss_key *key) { goto out; } + /* test 1 < g < p */ + if (mp_cmp_d(key->g, 1) != MP_GT) { + dropbear_log(LOG_WARNING, "Bad DSS g"); + ret = DROPBEAR_FAILURE; + goto out; + } + if (mp_cmp(key->g, key->p) != MP_LT) { + dropbear_log(LOG_WARNING, "Bad DSS g"); + ret = DROPBEAR_FAILURE; + goto out; + } + ret = DROPBEAR_SUCCESS; TRACE(("leave buf_get_dss_pub_key: success")) out: |