summaryrefslogtreecommitdiff
path: root/ecdsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'ecdsa.c')
-rw-r--r--ecdsa.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/ecdsa.c b/ecdsa.c
index 56e5355..5ac4e7b 100644
--- a/ecdsa.c
+++ b/ecdsa.c
@@ -81,18 +81,25 @@ ecc_key *buf_get_ecdsa_pub_key(buffer* buf) {
struct dropbear_ecc_curve **curve;
ecc_key *new_key = NULL;
- /* string "ecdsa-sha2-[identifier]" */
+ /* string "ecdsa-sha2-[identifier]" or "sk-ecdsa-sha2-nistp256@openssh.com" */
key_ident = (unsigned char*)buf_getstring(buf, &key_ident_len);
/* string "[identifier]" */
identifier = (unsigned char*)buf_getstring(buf, &identifier_len);
- if (key_ident_len != identifier_len + strlen("ecdsa-sha2-")) {
- TRACE(("Bad identifier lengths"))
- goto out;
- }
- if (memcmp(&key_ident[strlen("ecdsa-sha2-")], identifier, identifier_len) != 0) {
- TRACE(("mismatching identifiers"))
- goto out;
+ if (strcmp (key_ident, "sk-ecdsa-sha2-nistp256@openssh.com") == 0) {
+ if (strcmp (identifier, "nistp256") != 0) {
+ TRACE(("mismatching identifiers"))
+ goto out;
+ }
+ } else {
+ if (key_ident_len != identifier_len + strlen ("ecdsa-sha2-")) {
+ TRACE(("Bad identifier lengths"))
+ goto out;
+ }
+ if (memcmp(&key_ident[strlen ("ecdsa-sha2-")], identifier, identifier_len) != 0) {
+ TRACE(("mismatching identifiers"))
+ goto out;
+ }
}
for (curve = dropbear_ecc_curves; *curve; curve++) {