Mercurial > dropbear
comparison common-algo.c @ 1129:45830474d83c coverity
merge up to date, attempt to fix travis.yml
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 12 Jun 2015 23:02:15 +0800 |
parents | 6aeadee3f16b |
children | d2f9ef67af15 |
comparison
equal
deleted
inserted
replaced
1077:26c1f9b8f82e | 1129:45830474d83c |
---|---|
142 {"aes128-ctr", 0, &dropbear_aes128, 1, &dropbear_mode_ctr}, | 142 {"aes128-ctr", 0, &dropbear_aes128, 1, &dropbear_mode_ctr}, |
143 #endif | 143 #endif |
144 #ifdef DROPBEAR_AES256 | 144 #ifdef DROPBEAR_AES256 |
145 {"aes256-ctr", 0, &dropbear_aes256, 1, &dropbear_mode_ctr}, | 145 {"aes256-ctr", 0, &dropbear_aes256, 1, &dropbear_mode_ctr}, |
146 #endif | 146 #endif |
147 #ifdef DROPBEAR_TWOFISH_CTR | |
148 /* twofish ctr is conditional as it hasn't been tested for interoperability, see options.h */ | |
147 #ifdef DROPBEAR_TWOFISH256 | 149 #ifdef DROPBEAR_TWOFISH256 |
148 {"twofish256-ctr", 0, &dropbear_twofish256, 1, &dropbear_mode_ctr}, | 150 {"twofish256-ctr", 0, &dropbear_twofish256, 1, &dropbear_mode_ctr}, |
149 #endif | 151 #endif |
150 #ifdef DROPBEAR_TWOFISH128 | 152 #ifdef DROPBEAR_TWOFISH128 |
151 {"twofish128-ctr", 0, &dropbear_twofish128, 1, &dropbear_mode_ctr}, | 153 {"twofish128-ctr", 0, &dropbear_twofish128, 1, &dropbear_mode_ctr}, |
152 #endif | 154 #endif |
155 #endif /* DROPBEAR_TWOFISH_CTR */ | |
153 #endif /* DROPBEAR_ENABLE_CTR_MODE */ | 156 #endif /* DROPBEAR_ENABLE_CTR_MODE */ |
154 | 157 |
155 #ifdef DROPBEAR_ENABLE_CBC_MODE | 158 #ifdef DROPBEAR_ENABLE_CBC_MODE |
156 #ifdef DROPBEAR_AES128 | 159 #ifdef DROPBEAR_AES128 |
157 {"aes128-cbc", 0, &dropbear_aes128, 1, &dropbear_mode_cbc}, | 160 {"aes128-cbc", 0, &dropbear_aes128, 1, &dropbear_mode_cbc}, |
320 if (localalgos[i].usable) { | 323 if (localalgos[i].usable) { |
321 if (donefirst) | 324 if (donefirst) |
322 buf_putbyte(algolist, ','); | 325 buf_putbyte(algolist, ','); |
323 donefirst = 1; | 326 donefirst = 1; |
324 len = strlen(localalgos[i].name); | 327 len = strlen(localalgos[i].name); |
325 buf_putbytes(algolist, localalgos[i].name, len); | 328 buf_putbytes(algolist, (const unsigned char *) localalgos[i].name, len); |
326 } | 329 } |
327 } | 330 } |
328 buf_putstring(buf, algolist->data, algolist->len); | 331 buf_putstring(buf, (const char*)algolist->data, algolist->len); |
329 buf_free(algolist); | 332 buf_free(algolist); |
330 } | 333 } |
331 | 334 |
332 /* match the first algorithm in the comma-separated list in buf which is | 335 /* match the first algorithm in the comma-separated list in buf which is |
333 * also in localalgos[], or return NULL on failure. | 336 * also in localalgos[], or return NULL on failure. |
336 * guessed correctly */ | 339 * guessed correctly */ |
337 algo_type * buf_match_algo(buffer* buf, algo_type localalgos[], | 340 algo_type * buf_match_algo(buffer* buf, algo_type localalgos[], |
338 enum kexguess2_used *kexguess2, int *goodguess) | 341 enum kexguess2_used *kexguess2, int *goodguess) |
339 { | 342 { |
340 | 343 |
341 unsigned char * algolist = NULL; | 344 char * algolist = NULL; |
342 const unsigned char *remotenames[MAX_PROPOSED_ALGO], *localnames[MAX_PROPOSED_ALGO]; | 345 const char *remotenames[MAX_PROPOSED_ALGO], *localnames[MAX_PROPOSED_ALGO]; |
343 unsigned int len; | 346 unsigned int len; |
344 unsigned int remotecount, localcount, clicount, servcount, i, j; | 347 unsigned int remotecount, localcount, clicount, servcount, i, j; |
345 algo_type * ret = NULL; | 348 algo_type * ret = NULL; |
346 const unsigned char **clinames, **servnames; | 349 const char **clinames, **servnames; |
347 | 350 |
348 if (goodguess) { | 351 if (goodguess) { |
349 *goodguess = 0; | 352 *goodguess = 0; |
350 } | 353 } |
351 | 354 |
486 buffer *b = buf_new(200); | 489 buffer *b = buf_new(200); |
487 buf_put_algolist(b, algos); | 490 buf_put_algolist(b, algos); |
488 buf_setpos(b, b->len); | 491 buf_setpos(b, b->len); |
489 buf_putbyte(b, '\0'); | 492 buf_putbyte(b, '\0'); |
490 buf_setpos(b, 4); | 493 buf_setpos(b, 4); |
491 ret_list = m_strdup(buf_getptr(b, b->len - b->pos)); | 494 ret_list = m_strdup((const char *) buf_getptr(b, b->len - b->pos)); |
492 buf_free(b); | 495 buf_free(b); |
493 return ret_list; | 496 return ret_list; |
494 } | 497 } |
495 | 498 |
496 static algo_type* | 499 static algo_type* |