comparison common-algo.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 2c9dac2d6707
children 533e070b3126
comparison
equal deleted inserted replaced
1458:bdd3802c8ac6 1459:06d52bcb8094
312 312
313 /* algolen specifies the length of algo, algos is our local list to match 313 /* algolen specifies the length of algo, algos is our local list to match
314 * against. 314 * against.
315 * Returns DROPBEAR_SUCCESS if we have a match for algo, DROPBEAR_FAILURE 315 * Returns DROPBEAR_SUCCESS if we have a match for algo, DROPBEAR_FAILURE
316 * otherwise */ 316 * otherwise */
317 int have_algo(char* algo, size_t algolen, algo_type algos[]) { 317 int have_algo(const char* algo, size_t algolen, const algo_type algos[]) {
318 318
319 int i; 319 int i;
320 320
321 for (i = 0; algos[i].name != NULL; i++) { 321 for (i = 0; algos[i].name != NULL; i++) {
322 if (strlen(algos[i].name) == algolen 322 if (strlen(algos[i].name) == algolen
327 327
328 return DROPBEAR_FAILURE; 328 return DROPBEAR_FAILURE;
329 } 329 }
330 330
331 /* Output a comma separated list of algorithms to a buffer */ 331 /* Output a comma separated list of algorithms to a buffer */
332 void buf_put_algolist(buffer * buf, algo_type localalgos[]) { 332 void buf_put_algolist(buffer * buf, const algo_type localalgos[]) {
333 333
334 unsigned int i, len; 334 unsigned int i, len;
335 unsigned int donefirst = 0; 335 unsigned int donefirst = 0;
336 buffer *algolist = NULL; 336 buffer *algolist = NULL;
337 337
499 #endif /* DROPBEAR_NONE_CIPHER */ 499 #endif /* DROPBEAR_NONE_CIPHER */
500 500
501 #if DROPBEAR_USER_ALGO_LIST 501 #if DROPBEAR_USER_ALGO_LIST
502 502
503 char * 503 char *
504 algolist_string(algo_type algos[]) 504 algolist_string(const algo_type algos[])
505 { 505 {
506 char *ret_list; 506 char *ret_list;
507 buffer *b = buf_new(200); 507 buffer *b = buf_new(200);
508 buf_put_algolist(b, algos); 508 buf_put_algolist(b, algos);
509 buf_setpos(b, b->len); 509 buf_setpos(b, b->len);