constants.js 16 KB

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