comparison signkey.c @ 1094:c45d65392c1a

Fix pointer differ in signess warnings [-Werror=pointer-sign]
author Gaël PORTAY <gael.portay@gmail.com>
date Sat, 02 May 2015 15:59:06 +0200
parents 063c38ea622b
children aaf576b27a10
comparison
equal deleted inserted replaced
1093:aae71c5f7d5b 1094:c45d65392c1a
136 /* returns DROPBEAR_SUCCESS on success, DROPBEAR_FAILURE on fail. 136 /* returns DROPBEAR_SUCCESS on success, DROPBEAR_FAILURE on fail.
137 * type should be set by the caller to specify the type to read, and 137 * type should be set by the caller to specify the type to read, and
138 * on return is set to the type read (useful when type = _ANY) */ 138 * on return is set to the type read (useful when type = _ANY) */
139 int buf_get_pub_key(buffer *buf, sign_key *key, enum signkey_type *type) { 139 int buf_get_pub_key(buffer *buf, sign_key *key, enum signkey_type *type) {
140 140
141 unsigned char* ident; 141 char *ident;
142 unsigned int len; 142 unsigned int len;
143 enum signkey_type keytype; 143 enum signkey_type keytype;
144 int ret = DROPBEAR_FAILURE; 144 int ret = DROPBEAR_FAILURE;
145 145
146 TRACE2(("enter buf_get_pub_key")) 146 TRACE2(("enter buf_get_pub_key"))
147 147
148 ident = buf_getstring(buf, &len); 148 ident = (char *) buf_getstring(buf, &len);
149 keytype = signkey_type_from_name(ident, len); 149 keytype = signkey_type_from_name(ident, len);
150 m_free(ident); 150 m_free(ident);
151 151
152 if (*type != DROPBEAR_SIGNKEY_ANY && *type != keytype) { 152 if (*type != DROPBEAR_SIGNKEY_ANY && *type != keytype) {
153 TRACE(("buf_get_pub_key bad type - got %d, expected %d", keytype, *type)) 153 TRACE(("buf_get_pub_key bad type - got %d, expected %d", keytype, *type))
207 /* returns DROPBEAR_SUCCESS on success, DROPBEAR_FAILURE on fail. 207 /* returns DROPBEAR_SUCCESS on success, DROPBEAR_FAILURE on fail.
208 * type should be set by the caller to specify the type to read, and 208 * type should be set by the caller to specify the type to read, and
209 * on return is set to the type read (useful when type = _ANY) */ 209 * on return is set to the type read (useful when type = _ANY) */
210 int buf_get_priv_key(buffer *buf, sign_key *key, enum signkey_type *type) { 210 int buf_get_priv_key(buffer *buf, sign_key *key, enum signkey_type *type) {
211 211
212 unsigned char* ident; 212 char *ident;
213 unsigned int len; 213 unsigned int len;
214 enum signkey_type keytype; 214 enum signkey_type keytype;
215 int ret = DROPBEAR_FAILURE; 215 int ret = DROPBEAR_FAILURE;
216 216
217 TRACE2(("enter buf_get_priv_key")) 217 TRACE2(("enter buf_get_priv_key"))
218 218
219 ident = buf_getstring(buf, &len); 219 ident = (char *)buf_getstring(buf, &len);
220 keytype = signkey_type_from_name(ident, len); 220 keytype = signkey_type_from_name(ident, len);
221 m_free(ident); 221 m_free(ident);
222 222
223 if (*type != DROPBEAR_SIGNKEY_ANY && *type != keytype) { 223 if (*type != DROPBEAR_SIGNKEY_ANY && *type != keytype) {
224 TRACE(("wrong key type: %d %d", *type, keytype)) 224 TRACE(("wrong key type: %d %d", *type, keytype))
513 * If FAILURE is returned, the position of 513 * If FAILURE is returned, the position of
514 * buf is undefined. If SUCCESS is returned, buf will be positioned after the 514 * buf is undefined. If SUCCESS is returned, buf will be positioned after the
515 * signature blob */ 515 * signature blob */
516 int buf_verify(buffer * buf, sign_key *key, buffer *data_buf) { 516 int buf_verify(buffer * buf, sign_key *key, buffer *data_buf) {
517 517
518 unsigned char * type_name = NULL; 518 char *type_name = NULL;
519 unsigned int type_name_len = 0; 519 unsigned int type_name_len = 0;
520 enum signkey_type type; 520 enum signkey_type type;
521 521
522 TRACE(("enter buf_verify")) 522 TRACE(("enter buf_verify"))
523 523
524 buf_getint(buf); /* blob length */ 524 buf_getint(buf); /* blob length */
525 type_name = buf_getstring(buf, &type_name_len); 525 type_name = (char *) buf_getstring(buf, &type_name_len);
526 type = signkey_type_from_name(type_name, type_name_len); 526 type = signkey_type_from_name(type_name, type_name_len);
527 m_free(type_name); 527 m_free(type_name);
528 528
529 #ifdef DROPBEAR_DSS 529 #ifdef DROPBEAR_DSS
530 if (type == DROPBEAR_SIGNKEY_DSS) { 530 if (type == DROPBEAR_SIGNKEY_DSS) {