Mercurial > dropbear
comparison ecc.c @ 761:ac2158e3e403 ecc
ecc kind of works, needs fixing/testing
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 07 Apr 2013 01:36:42 +0800 |
parents | 76fba0856749 |
children | a78a38e402d1 |
comparison
equal
deleted
inserted
replaced
760:f336d232fc63 | 761:ac2158e3e403 |
---|---|
108 } | 108 } |
109 | 109 |
110 ecc_key * buf_get_ecc_pubkey(buffer *buf, const struct dropbear_ecc_curve *curve) { | 110 ecc_key * buf_get_ecc_pubkey(buffer *buf, const struct dropbear_ecc_curve *curve) { |
111 ecc_key *key = NULL; | 111 ecc_key *key = NULL; |
112 int ret = DROPBEAR_FAILURE; | 112 int ret = DROPBEAR_FAILURE; |
113 const int size = curve->dp->size; | 113 const unsigned int size = curve->dp->size; |
114 buf_setpos(buf, 0); | 114 buf_setpos(buf, 0); |
115 unsigned int len = buf->len; | 115 unsigned int len = buf->len; |
116 unsigned char first = buf_getbyte(buf); | 116 unsigned char first = buf_getbyte(buf); |
117 if (first == 2 || first == 3) { | 117 if (first == 2 || first == 3) { |
118 dropbear_log(LOG_WARNING, "Dropbear doesn't support ECC point compression"); | 118 dropbear_log(LOG_WARNING, "Dropbear doesn't support ECC point compression"); |
121 if (first != 4 || len != 1+2*size) { | 121 if (first != 4 || len != 1+2*size) { |
122 return NULL; | 122 return NULL; |
123 } | 123 } |
124 | 124 |
125 key = new_ecc_key(); | 125 key = new_ecc_key(); |
126 key->dp = curve->dp; | |
126 | 127 |
127 if (mp_read_unsigned_bin(key->pubkey.x, buf_getptr(buf, size), size) != MP_OKAY) { | 128 if (mp_read_unsigned_bin(key->pubkey.x, buf_getptr(buf, size), size) != MP_OKAY) { |
128 goto out; | 129 goto out; |
129 } | 130 } |
130 buf_incrpos(buf, size); | 131 buf_incrpos(buf, size); |