ssh.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Dropbear - a SSH2 server
  3. *
  4. * Copyright (c) 2002,2003 Matt Johnston
  5. * All rights reserved.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  23. * SOFTWARE. */
  24. /* This file contains the various numbers in the protocol */
  25. /* message numbers */
  26. #define SSH_MSG_DISCONNECT 1
  27. #define SSH_MSG_IGNORE 2
  28. #define SSH_MSG_UNIMPLEMENTED 3
  29. #define SSH_MSG_DEBUG 4
  30. #define SSH_MSG_SERVICE_REQUEST 5
  31. #define SSH_MSG_SERVICE_ACCEPT 6
  32. #define SSH_MSG_EXT_INFO 7
  33. #define SSH_MSG_KEXINIT 20
  34. #define SSH_MSG_NEWKEYS 21
  35. #define SSH_MSG_KEXDH_INIT 30
  36. #define SSH_MSG_KEXDH_REPLY 31
  37. /* userauth message numbers */
  38. #define SSH_MSG_USERAUTH_REQUEST 50
  39. #define SSH_MSG_USERAUTH_FAILURE 51
  40. #define SSH_MSG_USERAUTH_SUCCESS 52
  41. #define SSH_MSG_USERAUTH_BANNER 53
  42. /* packets 60-79 are method-specific, aren't one-one mapping */
  43. #define SSH_MSG_USERAUTH_SPECIFIC_60 60
  44. #define SSH_MSG_USERAUTH_PASSWD_CHANGEREQ 60
  45. #define SSH_MSG_USERAUTH_PK_OK 60
  46. /* keyboard interactive auth */
  47. #define SSH_MSG_USERAUTH_INFO_REQUEST 60
  48. #define SSH_MSG_USERAUTH_INFO_RESPONSE 61
  49. /* If adding numbers here, check MAX_UNAUTH_PACKET_TYPE in process-packet.c
  50. * is still valid */
  51. /* connect message numbers */
  52. #define SSH_MSG_GLOBAL_REQUEST 80
  53. #define SSH_MSG_REQUEST_SUCCESS 81
  54. #define SSH_MSG_REQUEST_FAILURE 82
  55. #define SSH_MSG_CHANNEL_OPEN 90
  56. #define SSH_MSG_CHANNEL_OPEN_CONFIRMATION 91
  57. #define SSH_MSG_CHANNEL_OPEN_FAILURE 92
  58. #define SSH_MSG_CHANNEL_WINDOW_ADJUST 93
  59. #define SSH_MSG_CHANNEL_DATA 94
  60. #define SSH_MSG_CHANNEL_EXTENDED_DATA 95
  61. #define SSH_MSG_CHANNEL_EOF 96
  62. #define SSH_MSG_CHANNEL_CLOSE 97
  63. #define SSH_MSG_CHANNEL_REQUEST 98
  64. #define SSH_MSG_CHANNEL_SUCCESS 99
  65. #define SSH_MSG_CHANNEL_FAILURE 100
  66. /* extended data types */
  67. #define SSH_EXTENDED_DATA_STDERR 1
  68. /* disconnect codes */
  69. #define SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT 1
  70. #define SSH_DISCONNECT_PROTOCOL_ERROR 2
  71. #define SSH_DISCONNECT_KEY_EXCHANGE_FAILED 3
  72. #define SSH_DISCONNECT_RESERVED 4
  73. #define SSH_DISCONNECT_MAC_ERROR 5
  74. #define SSH_DISCONNECT_COMPRESSION_ERROR 6
  75. #define SSH_DISCONNECT_SERVICE_NOT_AVAILABLE 7
  76. #define SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED 8
  77. #define SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9
  78. #define SSH_DISCONNECT_CONNECTION_LOST 10
  79. #define SSH_DISCONNECT_BY_APPLICATION 11
  80. #define SSH_DISCONNECT_TOO_MANY_CONNECTIONS 12
  81. #define SSH_DISCONNECT_AUTH_CANCELLED_BY_USER 13
  82. #define SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE 14
  83. #define SSH_DISCONNECT_ILLEGAL_USER_NAME 15
  84. /* rfc8308 */
  85. #define SSH_EXT_INFO_S "ext-info-s"
  86. #define SSH_EXT_INFO_C "ext-info-c"
  87. #define SSH_SERVER_SIG_ALGS "server-sig-algs"
  88. /* service types */
  89. #define SSH_SERVICE_USERAUTH "ssh-userauth"
  90. #define SSH_SERVICE_USERAUTH_LEN 12
  91. #define SSH_SERVICE_CONNECTION "ssh-connection"
  92. #define SSH_SERVICE_CONNECTION_LEN 14
  93. /* public/signature key types */
  94. #define SSH_SIGNKEY_DSS "ssh-dss"
  95. #define SSH_SIGNKEY_DSS_LEN 7
  96. #define SSH_SIGNKEY_RSA "ssh-rsa"
  97. #define SSH_SIGNKEY_RSA_LEN 7
  98. #define SSH_SIGNKEY_ED25519 "ssh-ed25519"
  99. #define SSH_SIGNKEY_ED25519_LEN 11
  100. /* signature type */
  101. #define SSH_SIGNATURE_RSA_SHA256 "rsa-sha2-256"
  102. /* Agent commands. These aren't part of the spec, and are defined
  103. * only on the openssh implementation. */
  104. #define SSH_AGENT_FAILURE 5
  105. #define SSH_AGENT_SUCCESS 6
  106. #define SSH2_AGENTC_REQUEST_IDENTITIES 11
  107. #define SSH2_AGENT_IDENTITIES_ANSWER 12
  108. #define SSH2_AGENTC_SIGN_REQUEST 13
  109. #define SSH2_AGENT_SIGN_RESPONSE 14
  110. #define SSH2_AGENT_FAILURE 30
  111. /* Flags defined by OpenSSH U2F key/signature format */
  112. #define SSH_SK_USER_PRESENCE_REQD 0x01
  113. #define SSH_SK_USER_VERIFICATION_REQD 0x04
  114. #define SSH_SK_RESIDENT_KEY 0x20