Mercurial > dropbear
comparison dss.c @ 1459:06d52bcb8094
Pointer parameter could be declared as pointing to const
author | Francois Perrad <francois.perrad@gadz.org> |
---|---|
date | Sat, 19 Aug 2017 17:16:13 +0200 |
parents | 7aebe7da3a35 |
children | 5916af64acd4 |
comparison
equal
deleted
inserted
replaced
1458:bdd3802c8ac6 | 1459:06d52bcb8094 |
---|---|
125 * mpint p | 125 * mpint p |
126 * mpint q | 126 * mpint q |
127 * mpint g | 127 * mpint g |
128 * mpint y | 128 * mpint y |
129 */ | 129 */ |
130 void buf_put_dss_pub_key(buffer* buf, dropbear_dss_key *key) { | 130 void buf_put_dss_pub_key(buffer* buf, const dropbear_dss_key *key) { |
131 | 131 |
132 dropbear_assert(key != NULL); | 132 dropbear_assert(key != NULL); |
133 buf_putstring(buf, SSH_SIGNKEY_DSS, SSH_SIGNKEY_DSS_LEN); | 133 buf_putstring(buf, SSH_SIGNKEY_DSS, SSH_SIGNKEY_DSS_LEN); |
134 buf_putmpint(buf, key->p); | 134 buf_putmpint(buf, key->p); |
135 buf_putmpint(buf, key->q); | 135 buf_putmpint(buf, key->q); |
137 buf_putmpint(buf, key->y); | 137 buf_putmpint(buf, key->y); |
138 | 138 |
139 } | 139 } |
140 | 140 |
141 /* Same as buf_put_dss_pub_key, but with the private "x" key appended */ | 141 /* Same as buf_put_dss_pub_key, but with the private "x" key appended */ |
142 void buf_put_dss_priv_key(buffer* buf, dropbear_dss_key *key) { | 142 void buf_put_dss_priv_key(buffer* buf, const dropbear_dss_key *key) { |
143 | 143 |
144 dropbear_assert(key != NULL); | 144 dropbear_assert(key != NULL); |
145 buf_put_dss_pub_key(buf, key); | 145 buf_put_dss_pub_key(buf, key); |
146 buf_putmpint(buf, key->x); | 146 buf_putmpint(buf, key->x); |
147 | 147 |
148 } | 148 } |
149 | 149 |
150 #if DROPBEAR_SIGNKEY_VERIFY | 150 #if DROPBEAR_SIGNKEY_VERIFY |
151 /* Verify a DSS signature (in buf) made on data by the key given. | 151 /* Verify a DSS signature (in buf) made on data by the key given. |
152 * returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ | 152 * returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ |
153 int buf_dss_verify(buffer* buf, dropbear_dss_key *key, buffer *data_buf) { | 153 int buf_dss_verify(buffer* buf, const dropbear_dss_key *key, const buffer *data_buf) { |
154 unsigned char msghash[SHA1_HASH_SIZE]; | 154 unsigned char msghash[SHA1_HASH_SIZE]; |
155 hash_state hs; | 155 hash_state hs; |
156 int ret = DROPBEAR_FAILURE; | 156 int ret = DROPBEAR_FAILURE; |
157 DEF_MP_INT(val1); | 157 DEF_MP_INT(val1); |
158 DEF_MP_INT(val2); | 158 DEF_MP_INT(val2); |
253 } | 253 } |
254 #endif /* DROPBEAR_SIGNKEY_VERIFY */ | 254 #endif /* DROPBEAR_SIGNKEY_VERIFY */ |
255 | 255 |
256 /* Sign the data presented with key, writing the signature contents | 256 /* Sign the data presented with key, writing the signature contents |
257 * to the buffer */ | 257 * to the buffer */ |
258 void buf_put_dss_sign(buffer* buf, dropbear_dss_key *key, buffer *data_buf) { | 258 void buf_put_dss_sign(buffer* buf, const dropbear_dss_key *key, const buffer *data_buf) { |
259 unsigned char msghash[SHA1_HASH_SIZE]; | 259 unsigned char msghash[SHA1_HASH_SIZE]; |
260 unsigned int writelen; | 260 unsigned int writelen; |
261 unsigned int i; | 261 unsigned int i; |
262 DEF_MP_INT(dss_k); | 262 DEF_MP_INT(dss_k); |
263 DEF_MP_INT(dss_m); | 263 DEF_MP_INT(dss_m); |