comparison common-algo.c @ 686:983a817f8e41 insecure-nocrypto

- Only request "none" cipher after auth has succeeded
author Matt Johnston <matt@ucc.asn.au>
date Thu, 17 May 2012 20:52:57 +0800
parents c37857676924
children cd3d3c63d189
comparison
equal deleted inserted replaced
685:5af8993f7529 686:983a817f8e41
299 } 299 }
300 buf_putstring(buf, algolist->data, algolist->len); 300 buf_putstring(buf, algolist->data, algolist->len);
301 buf_free(algolist); 301 buf_free(algolist);
302 } 302 }
303 303
304 #ifdef DROPBEAR_NONE_CIPHER
305
306 void
307 set_algo_usable(algo_type algos[], const char * algo_name, int usable)
308 {
309 algo_type *a;
310 for (a = algos; a->name != NULL; a++)
311 {
312 if (strcmp(a->name, algo_name) == 0)
313 {
314 a->usable = usable;
315 return;
316 }
317 }
318 }
319
320 int
321 get_algo_usable(algo_type algos[], const char * algo_name)
322 {
323 algo_type *a;
324 for (a = algos; a->name != NULL; a++)
325 {
326 if (strcmp(a->name, algo_name) == 0)
327 {
328 return a->usable;
329 }
330 }
331 return 0;
332 }
333
334 #endif // DROPBEAR_NONE_CIPHER
335
304 #ifdef ENABLE_USER_ALGO_LIST 336 #ifdef ENABLE_USER_ALGO_LIST
305 337
306 char * 338 char *
307 algolist_string(algo_type algos[]) 339 algolist_string(algo_type algos[])
308 { 340 {
365 { 397 {
366 if (*c == ',') 398 if (*c == ',')
367 { 399 {
368 *c = '\0'; 400 *c = '\0';
369 try_add_algo(last_name, algos, algo_desc, new_algos, &num_ret); 401 try_add_algo(last_name, algos, algo_desc, new_algos, &num_ret);
370 last_name = c++; 402 c++;
403 last_name = c;
371 } 404 }
372 } 405 }
373 try_add_algo(last_name, algos, algo_desc, new_algos, &num_ret); 406 try_add_algo(last_name, algos, algo_desc, new_algos, &num_ret);
374 m_free(work_list); 407 m_free(work_list);
375 408