comparison common-algo.c @ 908:3ca7113936c1 asm

aes and sha1 for arm
author Matt Johnston <matt@ucc.asn.au>
date Sun, 06 Oct 2013 21:49:15 +0800
parents 077bbe1eb220
children 89555751c489
comparison
equal deleted inserted replaced
826:125012c4d107 908:3ca7113936c1
47 /* Mappings for ciphers, parameters are 47 /* Mappings for ciphers, parameters are
48 {&cipher_desc, keysize, blocksize} */ 48 {&cipher_desc, keysize, blocksize} */
49 49
50 /* Remember to add new ciphers/hashes to regciphers/reghashes too */ 50 /* Remember to add new ciphers/hashes to regciphers/reghashes too */
51 51
52 #ifdef DROPBEAR_AES_ASM
53 extern const struct ltc_cipher_descriptor aes_asm_desc;
54 #define DROPBEAR_AES_DESC (aes_asm_desc)
55 #else
56 #define DROPBEAR_AES_DESC (aes_desc)
57 #endif
58
59 #ifdef DROPBEAR_SHA1_ASM
60 extern const struct ltc_hash_descriptor sha1_asm_desc;
61 #define DROPBEAR_SHA1_DESC (sha1_asm_desc)
62 #else
63 #define DROPBEAR_SHA1_DESC (sha1_desc)
64 #endif
65
66
52 #ifdef DROPBEAR_AES256 67 #ifdef DROPBEAR_AES256
53 static const struct dropbear_cipher dropbear_aes256 = 68 static const struct dropbear_cipher dropbear_aes256 =
54 {&aes_desc, 32, 16}; 69 {&DROPBEAR_AES_DESC, 32, 16};
55 #endif 70 #endif
56 #ifdef DROPBEAR_AES128 71 #ifdef DROPBEAR_AES128
57 static const struct dropbear_cipher dropbear_aes128 = 72 static const struct dropbear_cipher dropbear_aes128 =
58 {&aes_desc, 16, 16}; 73 {&DROPBEAR_AES_DESC, 16, 16};
59 #endif 74 #endif
60 #ifdef DROPBEAR_BLOWFISH 75 #ifdef DROPBEAR_BLOWFISH
61 static const struct dropbear_cipher dropbear_blowfish = 76 static const struct dropbear_cipher dropbear_blowfish =
62 {&blowfish_desc, 16, 8}; 77 {&blowfish_desc, 16, 8};
63 #endif 78 #endif
99 /* Mapping of ssh hashes to libtomcrypt hashes, including keysize etc. 114 /* Mapping of ssh hashes to libtomcrypt hashes, including keysize etc.
100 {&hash_desc, keysize, hashsize} */ 115 {&hash_desc, keysize, hashsize} */
101 116
102 #ifdef DROPBEAR_SHA1_HMAC 117 #ifdef DROPBEAR_SHA1_HMAC
103 static const struct dropbear_hash dropbear_sha1 = 118 static const struct dropbear_hash dropbear_sha1 =
104 {&sha1_desc, 20, 20}; 119 {&DROPBEAR_SHA1_DESC, 20, 20};
105 #endif 120 #endif
106 #ifdef DROPBEAR_SHA1_96_HMAC 121 #ifdef DROPBEAR_SHA1_96_HMAC
107 static const struct dropbear_hash dropbear_sha1_96 = 122 static const struct dropbear_hash dropbear_sha1_96 =
108 {&sha1_desc, 20, 12}; 123 {&DROPBEAR_SHA1_DESC, 20, 12};
109 #endif 124 #endif
110 #ifdef DROPBEAR_SHA2_256_HMAC 125 #ifdef DROPBEAR_SHA2_256_HMAC
111 static const struct dropbear_hash dropbear_sha2_256 = 126 static const struct dropbear_hash dropbear_sha2_256 =
112 {&sha256_desc, 32, 32}; 127 {&sha256_desc, 32, 32};
113 #endif 128 #endif
189 {NULL, 0, NULL, 0, NULL} 204 {NULL, 0, NULL, 0, NULL}
190 }; 205 };
191 206
192 #ifndef DISABLE_ZLIB 207 #ifndef DISABLE_ZLIB
193 algo_type ssh_compress[] = { 208 algo_type ssh_compress[] = {
194 {"zlib", DROPBEAR_COMP_ZLIB, NULL, 1, NULL}, 209 // {"zlib", DROPBEAR_COMP_ZLIB, NULL, 1, NULL},
195 {"[email protected]", DROPBEAR_COMP_ZLIB_DELAY, NULL, 1, NULL}, 210 // {"[email protected]", DROPBEAR_COMP_ZLIB_DELAY, NULL, 1, NULL},
196 {"none", DROPBEAR_COMP_NONE, NULL, 1, NULL}, 211 {"none", DROPBEAR_COMP_NONE, NULL, 1, NULL},
197 {NULL, 0, NULL, 0, NULL} 212 {NULL, 0, NULL, 0, NULL}
198 }; 213 };
199 #endif 214 #endif
200 215
227 * This should be run before using any of the ciphers/hashes */ 242 * This should be run before using any of the ciphers/hashes */
228 void crypto_init() { 243 void crypto_init() {
229 244
230 const struct ltc_cipher_descriptor *regciphers[] = { 245 const struct ltc_cipher_descriptor *regciphers[] = {
231 #ifdef DROPBEAR_AES 246 #ifdef DROPBEAR_AES
232 &aes_desc, 247 &DROPBEAR_AES_DESC,
233 #endif 248 #endif
234 #ifdef DROPBEAR_BLOWFISH 249 #ifdef DROPBEAR_BLOWFISH
235 &blowfish_desc, 250 &blowfish_desc,
236 #endif 251 #endif
237 #ifdef DROPBEAR_TWOFISH 252 #ifdef DROPBEAR_TWOFISH
243 NULL 258 NULL
244 }; 259 };
245 260
246 const struct ltc_hash_descriptor *reghashes[] = { 261 const struct ltc_hash_descriptor *reghashes[] = {
247 /* we need sha1 for hostkey stuff regardless */ 262 /* we need sha1 for hostkey stuff regardless */
248 &sha1_desc, 263 &DROPBEAR_SHA1_DESC,
249 #ifdef DROPBEAR_MD5_HMAC 264 #ifdef DROPBEAR_MD5_HMAC
250 &md5_desc, 265 &md5_desc,
251 #endif 266 #endif
252 #ifdef DROPBEAR_SHA2_256_HMAC 267 #ifdef DROPBEAR_SHA2_256_HMAC
253 &sha256_desc, 268 &sha256_desc,