comparison dss.c @ 34:e2a1eaa19f22

Client mostly works up to password auth Need to rework algo-choosing etc, since server is now broken.
author Matt Johnston <matt@ucc.asn.au>
date Wed, 28 Jul 2004 16:44:16 +0000
parents fe6bca95afa7
children b0316ce64e4b
comparison
equal deleted inserted replaced
33:f789045062e6 34:e2a1eaa19f22
43 * The key will have the same format as buf_put_dss_key. 43 * The key will have the same format as buf_put_dss_key.
44 * These should be freed with dss_key_free. 44 * These should be freed with dss_key_free.
45 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ 45 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
46 int buf_get_dss_pub_key(buffer* buf, dss_key *key) { 46 int buf_get_dss_pub_key(buffer* buf, dss_key *key) {
47 47
48 TRACE(("enter buf_get_dss_pub_key"));
48 assert(key != NULL); 49 assert(key != NULL);
49 key->p = m_malloc(sizeof(mp_int)); 50 key->p = m_malloc(sizeof(mp_int));
50 key->q = m_malloc(sizeof(mp_int)); 51 key->q = m_malloc(sizeof(mp_int));
51 key->g = m_malloc(sizeof(mp_int)); 52 key->g = m_malloc(sizeof(mp_int));
52 key->y = m_malloc(sizeof(mp_int)); 53 key->y = m_malloc(sizeof(mp_int));
56 buf_incrpos(buf, 4+SSH_SIGNKEY_DSS_LEN); /* int + "ssh-dss" */ 57 buf_incrpos(buf, 4+SSH_SIGNKEY_DSS_LEN); /* int + "ssh-dss" */
57 if (buf_getmpint(buf, key->p) == DROPBEAR_FAILURE 58 if (buf_getmpint(buf, key->p) == DROPBEAR_FAILURE
58 || buf_getmpint(buf, key->q) == DROPBEAR_FAILURE 59 || buf_getmpint(buf, key->q) == DROPBEAR_FAILURE
59 || buf_getmpint(buf, key->g) == DROPBEAR_FAILURE 60 || buf_getmpint(buf, key->g) == DROPBEAR_FAILURE
60 || buf_getmpint(buf, key->y) == DROPBEAR_FAILURE) { 61 || buf_getmpint(buf, key->y) == DROPBEAR_FAILURE) {
62 TRACE(("leave buf_get_dss_pub_key: failed reading mpints"));
61 return DROPBEAR_FAILURE; 63 return DROPBEAR_FAILURE;
62 } 64 }
63 65
64 if (mp_count_bits(key->p) < MIN_DSS_KEYLEN) { 66 if (mp_count_bits(key->p) < MIN_DSS_KEYLEN) {
65 dropbear_log(LOG_WARNING, "DSS key too short"); 67 dropbear_log(LOG_WARNING, "DSS key too short");
68 TRACE(("leave buf_get_dss_pub_key: short key"));
66 return DROPBEAR_FAILURE; 69 return DROPBEAR_FAILURE;
67 } 70 }
68 71
72 TRACE(("leave buf_get_dss_pub_key: success"));
69 return DROPBEAR_SUCCESS; 73 return DROPBEAR_SUCCESS;
70 } 74 }
71 75
72 /* Same as buf_get_dss_pub_key, but reads a private "x" key at the end. 76 /* Same as buf_get_dss_pub_key, but reads a private "x" key at the end.
73 * Loads a private dss key from a buffer 77 * Loads a private dss key from a buffer