Mercurial > dropbear
comparison common-algo.c @ 1120:391bb7d560c6
Merge branch 'fix-pointer-sign-warnings' into fix-warnings
author | Gaël PORTAY <gael.portay@gmail.com> |
---|---|
date | Tue, 05 May 2015 20:42:38 +0200 |
parents | 2052b53d3034 |
children | bb3a03feb31f aaf576b27a10 |
comparison
equal
deleted
inserted
replaced
1093:aae71c5f7d5b | 1120:391bb7d560c6 |
---|---|
320 if (localalgos[i].usable) { | 320 if (localalgos[i].usable) { |
321 if (donefirst) | 321 if (donefirst) |
322 buf_putbyte(algolist, ','); | 322 buf_putbyte(algolist, ','); |
323 donefirst = 1; | 323 donefirst = 1; |
324 len = strlen(localalgos[i].name); | 324 len = strlen(localalgos[i].name); |
325 buf_putbytes(algolist, localalgos[i].name, len); | 325 buf_putbytes(algolist, (const unsigned char *) localalgos[i].name, len); |
326 } | 326 } |
327 } | 327 } |
328 buf_putstring(buf, algolist->data, algolist->len); | 328 buf_putstring(buf, algolist->data, algolist->len); |
329 buf_free(algolist); | 329 buf_free(algolist); |
330 } | 330 } |
336 * guessed correctly */ | 336 * guessed correctly */ |
337 algo_type * buf_match_algo(buffer* buf, algo_type localalgos[], | 337 algo_type * buf_match_algo(buffer* buf, algo_type localalgos[], |
338 enum kexguess2_used *kexguess2, int *goodguess) | 338 enum kexguess2_used *kexguess2, int *goodguess) |
339 { | 339 { |
340 | 340 |
341 unsigned char * algolist = NULL; | 341 char * algolist = NULL; |
342 const unsigned char *remotenames[MAX_PROPOSED_ALGO], *localnames[MAX_PROPOSED_ALGO]; | 342 const char *remotenames[MAX_PROPOSED_ALGO], *localnames[MAX_PROPOSED_ALGO]; |
343 unsigned int len; | 343 unsigned int len; |
344 unsigned int remotecount, localcount, clicount, servcount, i, j; | 344 unsigned int remotecount, localcount, clicount, servcount, i, j; |
345 algo_type * ret = NULL; | 345 algo_type * ret = NULL; |
346 const unsigned char **clinames, **servnames; | 346 const char **clinames, **servnames; |
347 | 347 |
348 if (goodguess) { | 348 if (goodguess) { |
349 *goodguess = 0; | 349 *goodguess = 0; |
350 } | 350 } |
351 | 351 |
352 /* get the comma-separated list from the buffer ie "algo1,algo2,algo3" */ | 352 /* get the comma-separated list from the buffer ie "algo1,algo2,algo3" */ |
353 algolist = buf_getstring(buf, &len); | 353 algolist = (char *) buf_getstring(buf, &len); |
354 TRACE(("buf_match_algo: %s", algolist)) | 354 TRACE(("buf_match_algo: %s", algolist)) |
355 if (len > MAX_PROPOSED_ALGO*(MAX_NAME_LEN+1)) { | 355 if (len > MAX_PROPOSED_ALGO*(MAX_NAME_LEN+1)) { |
356 goto out; | 356 goto out; |
357 } | 357 } |
358 | 358 |
486 buffer *b = buf_new(200); | 486 buffer *b = buf_new(200); |
487 buf_put_algolist(b, algos); | 487 buf_put_algolist(b, algos); |
488 buf_setpos(b, b->len); | 488 buf_setpos(b, b->len); |
489 buf_putbyte(b, '\0'); | 489 buf_putbyte(b, '\0'); |
490 buf_setpos(b, 4); | 490 buf_setpos(b, 4); |
491 ret_list = m_strdup(buf_getptr(b, b->len - b->pos)); | 491 ret_list = m_strdup((const char *) buf_getptr(b, b->len - b->pos)); |
492 buf_free(b); | 492 buf_free(b); |
493 return ret_list; | 493 return ret_list; |
494 } | 494 } |
495 | 495 |
496 static algo_type* | 496 static algo_type* |