constants.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. var i;
  2. var keys;
  3. var len;
  4. var crypto = require('crypto');
  5. var eddsaSupported = (function() {
  6. if (typeof crypto.sign === 'function'
  7. && typeof crypto.verify === 'function') {
  8. var key = '-----BEGIN PRIVATE KEY-----\r\nMC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD'
  9. + '/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r\n-----END PRIVATE KEY-----';
  10. var data = Buffer.from('a');
  11. var sig;
  12. var verified;
  13. try {
  14. sig = crypto.sign(null, data, key);
  15. verified = crypto.verify(null, data, key, sig);
  16. } catch (ex) {}
  17. return (Buffer.isBuffer(sig) && sig.length === 64 && verified === true);
  18. }
  19. return false;
  20. })();
  21. var curve25519Supported = (typeof crypto.diffieHellman === 'function'
  22. && typeof crypto.generateKeyPairSync === 'function'
  23. && typeof crypto.createPublicKey === 'function');
  24. var MESSAGE = exports.MESSAGE = {
  25. // Transport layer protocol -- generic (1-19)
  26. DISCONNECT: 1,
  27. IGNORE: 2,
  28. UNIMPLEMENTED: 3,
  29. DEBUG: 4,
  30. SERVICE_REQUEST: 5,
  31. SERVICE_ACCEPT: 6,
  32. // Transport layer protocol -- algorithm negotiation (20-29)
  33. KEXINIT: 20,
  34. NEWKEYS: 21,
  35. // Transport layer protocol -- key exchange method-specific (30-49)
  36. // User auth protocol -- generic (50-59)
  37. USERAUTH_REQUEST: 50,
  38. USERAUTH_FAILURE: 51,
  39. USERAUTH_SUCCESS: 52,
  40. USERAUTH_BANNER: 53,
  41. // User auth protocol -- user auth method-specific (60-79)
  42. // Connection protocol -- generic (80-89)
  43. GLOBAL_REQUEST: 80,
  44. REQUEST_SUCCESS: 81,
  45. REQUEST_FAILURE: 82,
  46. // Connection protocol -- channel-related (90-127)
  47. CHANNEL_OPEN: 90,
  48. CHANNEL_OPEN_CONFIRMATION: 91,
  49. CHANNEL_OPEN_FAILURE: 92,
  50. CHANNEL_WINDOW_ADJUST: 93,
  51. CHANNEL_DATA: 94,
  52. CHANNEL_EXTENDED_DATA: 95,
  53. CHANNEL_EOF: 96,
  54. CHANNEL_CLOSE: 97,
  55. CHANNEL_REQUEST: 98,
  56. CHANNEL_SUCCESS: 99,
  57. CHANNEL_FAILURE: 100
  58. // Reserved for client protocols (128-191)
  59. // Local extensions (192-155)
  60. };
  61. for (i = 0, keys = Object.keys(MESSAGE), len = keys.length; i < len; ++i)
  62. MESSAGE[MESSAGE[keys[i]]] = keys[i];
  63. // context-specific message codes:
  64. MESSAGE.KEXDH_INIT = 30;
  65. MESSAGE.KEXDH_REPLY = 31;
  66. MESSAGE.KEXDH_GEX_REQUEST = 34;
  67. MESSAGE.KEXDH_GEX_GROUP = 31;
  68. MESSAGE.KEXDH_GEX_INIT = 32;
  69. MESSAGE.KEXDH_GEX_REPLY = 33;
  70. MESSAGE.KEXECDH_INIT = 30; // included here for completeness
  71. MESSAGE.KEXECDH_REPLY = 31; // included here for completeness
  72. MESSAGE.USERAUTH_PASSWD_CHANGEREQ = 60;
  73. MESSAGE.USERAUTH_PK_OK = 60;
  74. MESSAGE.USERAUTH_INFO_REQUEST = 60;
  75. MESSAGE.USERAUTH_INFO_RESPONSE = 61;
  76. var DYNAMIC_KEXDH_MESSAGE = exports.DYNAMIC_KEXDH_MESSAGE = {};
  77. DYNAMIC_KEXDH_MESSAGE[MESSAGE.KEXDH_GEX_GROUP] = 'KEXDH_GEX_GROUP';
  78. DYNAMIC_KEXDH_MESSAGE[MESSAGE.KEXDH_GEX_REPLY] = 'KEXDH_GEX_REPLY';
  79. var KEXDH_MESSAGE = exports.KEXDH_MESSAGE = {};
  80. KEXDH_MESSAGE[MESSAGE.KEXDH_INIT] = 'KEXDH_INIT';
  81. KEXDH_MESSAGE[MESSAGE.KEXDH_REPLY] = 'KEXDH_REPLY';
  82. var DISCONNECT_REASON = exports.DISCONNECT_REASON = {
  83. HOST_NOT_ALLOWED_TO_CONNECT: 1,
  84. PROTOCOL_ERROR: 2,
  85. KEY_EXCHANGE_FAILED: 3,
  86. RESERVED: 4,
  87. MAC_ERROR: 5,
  88. COMPRESSION_ERROR: 6,
  89. SERVICE_NOT_AVAILABLE: 7,
  90. PROTOCOL_VERSION_NOT_SUPPORTED: 8,
  91. HOST_KEY_NOT_VERIFIABLE: 9,
  92. CONNECTION_LOST: 10,
  93. BY_APPLICATION: 11,
  94. TOO_MANY_CONNECTIONS: 12,
  95. AUTH_CANCELED_BY_USER: 13,
  96. NO_MORE_AUTH_METHODS_AVAILABLE: 14,
  97. ILLEGAL_USER_NAME: 15
  98. };
  99. for (i = 0, keys = Object.keys(DISCONNECT_REASON), len = keys.length;
  100. i < len;
  101. ++i) {
  102. DISCONNECT_REASON[DISCONNECT_REASON[keys[i]]] = keys[i];
  103. }
  104. var CHANNEL_OPEN_FAILURE = exports.CHANNEL_OPEN_FAILURE = {
  105. ADMINISTRATIVELY_PROHIBITED: 1,
  106. CONNECT_FAILED: 2,
  107. UNKNOWN_CHANNEL_TYPE: 3,
  108. RESOURCE_SHORTAGE: 4
  109. };
  110. for (i = 0, keys = Object.keys(CHANNEL_OPEN_FAILURE), len = keys.length;
  111. i < len;
  112. ++i) {
  113. CHANNEL_OPEN_FAILURE[CHANNEL_OPEN_FAILURE[keys[i]]] = keys[i];
  114. }
  115. var TERMINAL_MODE = exports.TERMINAL_MODE = {
  116. TTY_OP_END: 0, // Indicates end of options.
  117. VINTR: 1, // Interrupt character; 255 if none. Similarly for the
  118. // other characters. Not all of these characters are
  119. // supported on all systems.
  120. VQUIT: 2, // The quit character (sends SIGQUIT signal on POSIX
  121. // systems).
  122. VERASE: 3, // Erase the character to left of the cursor.
  123. VKILL: 4, // Kill the current input line.
  124. VEOF: 5, // End-of-file character (sends EOF from the terminal).
  125. VEOL: 6, // End-of-line character in addition to carriage return
  126. // and/or linefeed.
  127. VEOL2: 7, // Additional end-of-line character.
  128. VSTART: 8, // Continues paused output (normally control-Q).
  129. VSTOP: 9, // Pauses output (normally control-S).
  130. VSUSP: 10, // Suspends the current program.
  131. VDSUSP: 11, // Another suspend character.
  132. VREPRINT: 12, // Reprints the current input line.
  133. VWERASE: 13, // Erases a word left of cursor.
  134. VLNEXT: 14, // Enter the next character typed literally, even if it
  135. // is a special character
  136. VFLUSH: 15, // Character to flush output.
  137. VSWTCH: 16, // Switch to a different shell layer.
  138. VSTATUS: 17, // Prints system status line (load, command, pid, etc).
  139. VDISCARD: 18, // Toggles the flushing of terminal output.
  140. IGNPAR: 30, // The ignore parity flag. The parameter SHOULD be 0
  141. // if this flag is FALSE, and 1 if it is TRUE.
  142. PARMRK: 31, // Mark parity and framing errors.
  143. INPCK: 32, // Enable checking of parity errors.
  144. ISTRIP: 33, // Strip 8th bit off characters.
  145. INLCR: 34, // Map NL into CR on input.
  146. IGNCR: 35, // Ignore CR on input.
  147. ICRNL: 36, // Map CR to NL on input.
  148. IUCLC: 37, // Translate uppercase characters to lowercase.
  149. IXON: 38, // Enable output flow control.
  150. IXANY: 39, // Any char will restart after stop.
  151. IXOFF: 40, // Enable input flow control.
  152. IMAXBEL: 41, // Ring bell on input queue full.
  153. ISIG: 50, // Enable signals INTR, QUIT, [D]SUSP.
  154. ICANON: 51, // Canonicalize input lines.
  155. XCASE: 52, // Enable input and output of uppercase characters by
  156. // preceding their lowercase equivalents with "\".
  157. ECHO: 53, // Enable echoing.
  158. ECHOE: 54, // Visually erase chars.
  159. ECHOK: 55, // Kill character discards current line.
  160. ECHONL: 56, // Echo NL even if ECHO is off.
  161. NOFLSH: 57, // Don't flush after interrupt.
  162. TOSTOP: 58, // Stop background jobs from output.
  163. IEXTEN: 59, // Enable extensions.
  164. ECHOCTL: 60, // Echo control characters as ^(Char).
  165. ECHOKE: 61, // Visual erase for line kill.
  166. PENDIN: 62, // Retype pending input.
  167. OPOST: 70, // Enable output processing.
  168. OLCUC: 71, // Convert lowercase to uppercase.
  169. ONLCR: 72, // Map NL to CR-NL.
  170. OCRNL: 73, // Translate carriage return to newline (output).
  171. ONOCR: 74, // Translate newline to carriage return-newline
  172. // (output).
  173. ONLRET: 75, // Newline performs a carriage return (output).
  174. CS7: 90, // 7 bit mode.
  175. CS8: 91, // 8 bit mode.
  176. PARENB: 92, // Parity enable.
  177. PARODD: 93, // Odd parity, else even.
  178. TTY_OP_ISPEED: 128, // Specifies the input baud rate in bits per second.
  179. TTY_OP_OSPEED: 129 // Specifies the output baud rate in bits per second.
  180. };
  181. for (i = 0, keys = Object.keys(TERMINAL_MODE), len = keys.length; i < len; ++i)
  182. TERMINAL_MODE[TERMINAL_MODE[keys[i]]] = keys[i];
  183. var CHANNEL_EXTENDED_DATATYPE = exports.CHANNEL_EXTENDED_DATATYPE = {
  184. STDERR: 1
  185. };
  186. for (i = 0, keys = Object.keys(CHANNEL_EXTENDED_DATATYPE), len = keys.length;
  187. i < len;
  188. ++i) {
  189. CHANNEL_EXTENDED_DATATYPE[CHANNEL_EXTENDED_DATATYPE[keys[i]]] = keys[i];
  190. }
  191. exports.SIGNALS = ['ABRT', 'ALRM', 'FPE', 'HUP', 'ILL', 'INT',
  192. 'QUIT', 'SEGV', 'TERM', 'USR1', 'USR2', 'KILL',
  193. 'PIPE'];
  194. var DEFAULT_KEX = [
  195. // https://tools.ietf.org/html/rfc5656#section-10.1
  196. 'ecdh-sha2-nistp256',
  197. 'ecdh-sha2-nistp384',
  198. 'ecdh-sha2-nistp521',
  199. // https://tools.ietf.org/html/rfc4419#section-4
  200. 'diffie-hellman-group-exchange-sha256',
  201. 'diffie-hellman-group14-sha256',
  202. 'diffie-hellman-group16-sha512',
  203. 'diffie-hellman-group18-sha512',
  204. 'diffie-hellman-group14-sha1', // REQUIRED
  205. ];
  206. if (curve25519Supported) {
  207. DEFAULT_KEX.unshift('curve25519-sha256');
  208. DEFAULT_KEX.unshift('curve25519-sha256@libssh.org');
  209. }
  210. var SUPPORTED_KEX = [
  211. // https://tools.ietf.org/html/rfc4419#section-4
  212. 'diffie-hellman-group-exchange-sha1',
  213. 'diffie-hellman-group1-sha1' // REQUIRED
  214. ];
  215. var KEX_BUF = Buffer.from(DEFAULT_KEX.join(','), 'ascii');
  216. SUPPORTED_KEX = DEFAULT_KEX.concat(SUPPORTED_KEX);
  217. var DEFAULT_SERVER_HOST_KEY = [
  218. 'ecdsa-sha2-nistp256',
  219. 'ecdsa-sha2-nistp384',
  220. 'ecdsa-sha2-nistp521',
  221. 'ssh-rsa',
  222. ];
  223. if (eddsaSupported)
  224. DEFAULT_SERVER_HOST_KEY.unshift('ssh-ed25519');
  225. var SUPPORTED_SERVER_HOST_KEY = [
  226. 'ssh-dss'
  227. ];
  228. var SERVER_HOST_KEY_BUF = Buffer.from(DEFAULT_SERVER_HOST_KEY.join(','),
  229. 'ascii');
  230. SUPPORTED_SERVER_HOST_KEY = DEFAULT_SERVER_HOST_KEY.concat(
  231. SUPPORTED_SERVER_HOST_KEY
  232. );
  233. var DEFAULT_CIPHER = [
  234. // http://tools.ietf.org/html/rfc4344#section-4
  235. 'aes128-ctr',
  236. 'aes192-ctr',
  237. 'aes256-ctr',
  238. // http://tools.ietf.org/html/rfc5647
  239. 'aes128-gcm',
  240. 'aes128-gcm@openssh.com',
  241. 'aes256-gcm',
  242. 'aes256-gcm@openssh.com'
  243. ];
  244. var SUPPORTED_CIPHER = [
  245. 'aes256-cbc',
  246. 'aes192-cbc',
  247. 'aes128-cbc',
  248. 'blowfish-cbc',
  249. '3des-cbc',
  250. // http://tools.ietf.org/html/rfc4345#section-4:
  251. 'arcfour256',
  252. 'arcfour128',
  253. 'cast128-cbc',
  254. 'arcfour'
  255. ];
  256. var CIPHER_BUF = Buffer.from(DEFAULT_CIPHER.join(','), 'ascii');
  257. SUPPORTED_CIPHER = DEFAULT_CIPHER.concat(SUPPORTED_CIPHER);
  258. var DEFAULT_HMAC = [
  259. 'hmac-sha2-256',
  260. 'hmac-sha2-512',
  261. 'hmac-sha1',
  262. ];
  263. var SUPPORTED_HMAC = [
  264. 'hmac-md5',
  265. 'hmac-sha2-256-96', // first 96 bits of HMAC-SHA256
  266. 'hmac-sha2-512-96', // first 96 bits of HMAC-SHA512
  267. 'hmac-ripemd160',
  268. 'hmac-sha1-96', // first 96 bits of HMAC-SHA1
  269. 'hmac-md5-96' // first 96 bits of HMAC-MD5
  270. ];
  271. var HMAC_BUF = Buffer.from(DEFAULT_HMAC.join(','), 'ascii');
  272. SUPPORTED_HMAC = DEFAULT_HMAC.concat(SUPPORTED_HMAC);
  273. var DEFAULT_COMPRESS = [
  274. 'none',
  275. 'zlib@openssh.com', // ZLIB (LZ77) compression, except
  276. // compression/decompression does not start until after
  277. // successful user authentication
  278. 'zlib' // ZLIB (LZ77) compression
  279. ];
  280. var SUPPORTED_COMPRESS = [];
  281. var COMPRESS_BUF = Buffer.from(DEFAULT_COMPRESS.join(','), 'ascii');
  282. SUPPORTED_COMPRESS = DEFAULT_COMPRESS.concat(SUPPORTED_COMPRESS);
  283. function makeCipherInfo(blockLen, keyLen, ivLen, authLen, discardLen, stream) {
  284. return {
  285. blockLen: blockLen,
  286. keyLen: keyLen,
  287. ivLen: ivLen === 0 ? blockLen : ivLen,
  288. authLen: authLen,
  289. discardLen: discardLen,
  290. stream: stream,
  291. };
  292. }
  293. exports.CIPHER_INFO = {
  294. 'aes128-gcm': makeCipherInfo(16, 16, 12, 16, 0, false),
  295. 'aes256-gcm': makeCipherInfo(16, 32, 12, 16, 0, false),
  296. 'aes128-gcm@openssh.com': makeCipherInfo(16, 16, 12, 16, 0, false),
  297. 'aes256-gcm@openssh.com': makeCipherInfo(16, 32, 12, 16, 0, false),
  298. 'aes128-cbc': makeCipherInfo(16, 16, 0, 0, 0, false),
  299. 'aes192-cbc': makeCipherInfo(16, 24, 0, 0, 0, false),
  300. 'aes256-cbc': makeCipherInfo(16, 32, 0, 0, 0, false),
  301. 'rijndael-cbc@lysator.liu.se': makeCipherInfo(16, 32, 0, 0, 0, false),
  302. '3des-cbc': makeCipherInfo(8, 24, 0, 0, 0, false),
  303. 'blowfish-cbc': makeCipherInfo(8, 16, 0, 0, 0, false),
  304. 'idea-cbc': makeCipherInfo(8, 16, 0, 0, 0, false),
  305. 'cast128-cbc': makeCipherInfo(8, 16, 0, 0, 0, false),
  306. 'camellia128-cbc': makeCipherInfo(16, 16, 0, 0, 0, false),
  307. 'camellia192-cbc': makeCipherInfo(16, 24, 0, 0, 0, false),
  308. 'camellia256-cbc': makeCipherInfo(16, 32, 0, 0, 0, false),
  309. 'camellia128-cbc@openssh.com': makeCipherInfo(16, 16, 0, 0, 0, false),
  310. 'camellia192-cbc@openssh.com': makeCipherInfo(16, 24, 0, 0, 0, false),
  311. 'camellia256-cbc@openssh.com': makeCipherInfo(16, 32, 0, 0, 0, false),
  312. 'aes128-ctr': makeCipherInfo(16, 16, 0, 0, 0, false),
  313. 'aes192-ctr': makeCipherInfo(16, 24, 0, 0, 0, false),
  314. 'aes256-ctr': makeCipherInfo(16, 32, 0, 0, 0, false),
  315. '3des-ctr': makeCipherInfo(8, 24, 0, 0, 0, false),
  316. 'blowfish-ctr': makeCipherInfo(8, 16, 0, 0, 0, false),
  317. 'cast128-ctr': makeCipherInfo(8, 16, 0, 0, 0, false),
  318. 'camellia128-ctr': makeCipherInfo(16, 16, 0, 0, 0, false),
  319. 'camellia192-ctr': makeCipherInfo(16, 24, 0, 0, 0, false),
  320. 'camellia256-ctr': makeCipherInfo(16, 32, 0, 0, 0, false),
  321. 'camellia128-ctr@openssh.com': makeCipherInfo(16, 16, 0, 0, 0, false),
  322. 'camellia192-ctr@openssh.com': makeCipherInfo(16, 24, 0, 0, 0, false),
  323. 'camellia256-ctr@openssh.com': makeCipherInfo(16, 32, 0, 0, 0, false),
  324. /* The "arcfour128" algorithm is the RC4 cipher, as described in
  325. [SCHNEIER], using a 128-bit key. The first 1536 bytes of keystream
  326. generated by the cipher MUST be discarded, and the first byte of the
  327. first encrypted packet MUST be encrypted using the 1537th byte of
  328. keystream.
  329. -- http://tools.ietf.org/html/rfc4345#section-4 */
  330. 'arcfour': makeCipherInfo(8, 16, 0, 0, 1536, true),
  331. 'arcfour128': makeCipherInfo(8, 16, 0, 0, 1536, true),
  332. 'arcfour256': makeCipherInfo(8, 32, 0, 0, 1536, true),
  333. 'arcfour512': makeCipherInfo(8, 64, 0, 0, 1536, true),
  334. };
  335. function makeHMACInfo(len, actualLen) {
  336. return { len: len, actualLen: actualLen };
  337. }
  338. exports.HMAC_INFO = {
  339. 'hmac-md5': makeHMACInfo(16, 16),
  340. 'hmac-md5-96': makeHMACInfo(16, 12),
  341. 'hmac-ripemd160': makeHMACInfo(20, 20),
  342. 'hmac-sha1': makeHMACInfo(20, 20),
  343. 'hmac-sha1-96': makeHMACInfo(20, 12),
  344. 'hmac-sha2-256': makeHMACInfo(32, 32),
  345. 'hmac-sha2-256-96': makeHMACInfo(32, 12),
  346. 'hmac-sha2-512': makeHMACInfo(64, 64),
  347. 'hmac-sha2-512-96': makeHMACInfo(64, 12),
  348. };
  349. exports.ALGORITHMS = {
  350. KEX: DEFAULT_KEX,
  351. KEX_BUF: KEX_BUF,
  352. SUPPORTED_KEX: SUPPORTED_KEX,
  353. SERVER_HOST_KEY: DEFAULT_SERVER_HOST_KEY,
  354. SERVER_HOST_KEY_BUF: SERVER_HOST_KEY_BUF,
  355. SUPPORTED_SERVER_HOST_KEY: SUPPORTED_SERVER_HOST_KEY,
  356. CIPHER: DEFAULT_CIPHER,
  357. CIPHER_BUF: CIPHER_BUF,
  358. SUPPORTED_CIPHER: SUPPORTED_CIPHER,
  359. HMAC: DEFAULT_HMAC,
  360. HMAC_BUF: HMAC_BUF,
  361. SUPPORTED_HMAC: SUPPORTED_HMAC,
  362. COMPRESS: DEFAULT_COMPRESS,
  363. COMPRESS_BUF: COMPRESS_BUF,
  364. SUPPORTED_COMPRESS: SUPPORTED_COMPRESS
  365. };
  366. exports.SSH_TO_OPENSSL = {
  367. // ECDH key exchange
  368. 'ecdh-sha2-nistp256': 'prime256v1', // OpenSSL's name for 'secp256r1'
  369. 'ecdh-sha2-nistp384': 'secp384r1',
  370. 'ecdh-sha2-nistp521': 'secp521r1',
  371. // Ciphers
  372. 'aes128-gcm': 'aes-128-gcm',
  373. 'aes256-gcm': 'aes-256-gcm',
  374. 'aes128-gcm@openssh.com': 'aes-128-gcm',
  375. 'aes256-gcm@openssh.com': 'aes-256-gcm',
  376. '3des-cbc': 'des-ede3-cbc',
  377. 'blowfish-cbc': 'bf-cbc',
  378. 'aes256-cbc': 'aes-256-cbc',
  379. 'aes192-cbc': 'aes-192-cbc',
  380. 'aes128-cbc': 'aes-128-cbc',
  381. 'idea-cbc': 'idea-cbc',
  382. 'cast128-cbc': 'cast-cbc',
  383. 'rijndael-cbc@lysator.liu.se': 'aes-256-cbc',
  384. 'arcfour128': 'rc4',
  385. 'arcfour256': 'rc4',
  386. 'arcfour512': 'rc4',
  387. 'arcfour': 'rc4',
  388. 'camellia128-cbc': 'camellia-128-cbc',
  389. 'camellia192-cbc': 'camellia-192-cbc',
  390. 'camellia256-cbc': 'camellia-256-cbc',
  391. 'camellia128-cbc@openssh.com': 'camellia-128-cbc',
  392. 'camellia192-cbc@openssh.com': 'camellia-192-cbc',
  393. 'camellia256-cbc@openssh.com': 'camellia-256-cbc',
  394. '3des-ctr': 'des-ede3',
  395. 'blowfish-ctr': 'bf-ecb',
  396. 'aes256-ctr': 'aes-256-ctr',
  397. 'aes192-ctr': 'aes-192-ctr',
  398. 'aes128-ctr': 'aes-128-ctr',
  399. 'cast128-ctr': 'cast5-ecb',
  400. 'camellia128-ctr': 'camellia-128-ecb',
  401. 'camellia192-ctr': 'camellia-192-ecb',
  402. 'camellia256-ctr': 'camellia-256-ecb',
  403. 'camellia128-ctr@openssh.com': 'camellia-128-ecb',
  404. 'camellia192-ctr@openssh.com': 'camellia-192-ecb',
  405. 'camellia256-ctr@openssh.com': 'camellia-256-ecb',
  406. // HMAC
  407. 'hmac-sha1-96': 'sha1',
  408. 'hmac-sha1': 'sha1',
  409. 'hmac-sha2-256': 'sha256',
  410. 'hmac-sha2-256-96': 'sha256',
  411. 'hmac-sha2-512': 'sha512',
  412. 'hmac-sha2-512-96': 'sha512',
  413. 'hmac-md5-96': 'md5',
  414. 'hmac-md5': 'md5',
  415. 'hmac-ripemd160': 'ripemd160'
  416. };
  417. var BUGS = exports.BUGS = {
  418. BAD_DHGEX: 1,
  419. OLD_EXIT: 2,
  420. DYN_RPORT_BUG: 4
  421. };
  422. exports.BUGGY_IMPLS = [
  423. [ 'Cisco-1.25', BUGS.BAD_DHGEX ],
  424. [ /^[0-9.]+$/, BUGS.OLD_EXIT ], // old SSH.com implementations
  425. [ /^OpenSSH_5\.\d+/, BUGS.DYN_RPORT_BUG ]
  426. ];
  427. exports.EDDSA_SUPPORTED = eddsaSupported;
  428. exports.CURVE25519_SUPPORTED = curve25519Supported;