comparison common-runopts.c @ 682:4edea9f363d0

Add rough support for choosing ciphers/hashes with "-c" or "-m"
author Matt Johnston <matt@ucc.asn.au>
date Thu, 17 May 2012 00:12:42 +0800
parents 4b53a43f0082
children 167fdc091c05
comparison
equal deleted inserted replaced
678:6e0899b56ac4 682:4edea9f363d0
26 #include "runopts.h" 26 #include "runopts.h"
27 #include "signkey.h" 27 #include "signkey.h"
28 #include "buffer.h" 28 #include "buffer.h"
29 #include "dbutil.h" 29 #include "dbutil.h"
30 #include "auth.h" 30 #include "auth.h"
31 #include "algo.h"
31 32
32 runopts opts; /* GLOBAL */ 33 runopts opts; /* GLOBAL */
33 34
34 /* returns success or failure, and the keytype in *type. If we want 35 /* returns success or failure, and the keytype in *type. If we want
35 * to restrict the type, type can contain a type to return */ 36 * to restrict the type, type can contain a type to return */
53 54
54 buf_burn(buf); 55 buf_burn(buf);
55 buf_free(buf); 56 buf_free(buf);
56 return ret; 57 return ret;
57 } 58 }
59
60 #ifdef ENABLE_USER_ALGO_LIST
61 void
62 parse_ciphers_macs()
63 {
64 if (opts.cipher_list)
65 {
66 if (strcmp(opts.cipher_list, "help") == 0)
67 {
68 char *ciphers = algolist_string(sshciphers);
69 dropbear_log(LOG_INFO, "Available ciphers:\n%s\n", ciphers);
70 m_free(ciphers);
71 dropbear_exit(".");
72 }
73
74 if (check_user_algos(opts.cipher_list, sshciphers, "cipher") == 0)
75 {
76 dropbear_exit("No valid ciphers specified for '-c'");
77 }
78 }
79
80 if (opts.mac_list)
81 {
82 if (strcmp(opts.mac_list, "help") == 0)
83 {
84 char *macs = algolist_string(sshhashes);
85 dropbear_log(LOG_INFO, "Available MACs:\n%s\n", macs);
86 m_free(macs);
87 dropbear_exit(".");
88 }
89
90 if (check_user_algos(opts.mac_list, sshhashes, "MAC") == 0)
91 {
92 dropbear_exit("No valid MACs specified for '-m'");
93 }
94 }
95 }
96 #endif
97