1/* $NetBSD: ssh2.h,v 1.15 2023/12/20 17:15:21 christos Exp $ */ 2/* $OpenBSD: ssh2.h,v 1.22 2023/10/10 03:57:45 djm Exp $ */ 3 4/* 5 * Copyright (c) 2000 Markus Friedl. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28/* 29 * RFC4251: 30 * 31 * Transport layer protocol: 32 * 33 * 1-19 Transport layer generic (e.g. disconnect, ignore, debug, 34 * etc) 35 * 20-29 Algorithm negotiation 36 * 30-49 Key exchange method specific (numbers can be reused for 37 * different authentication methods) 38 * 39 * User authentication protocol: 40 * 41 * 50-59 User authentication generic 42 * 60-79 User authentication method specific (numbers can be reused 43 * for different authentication methods) 44 * 45 * Connection protocol: 46 * 47 * 80-89 Connection protocol generic 48 * 90-127 Channel related messages 49 * 50 * Reserved for client protocols: 51 * 52 * 128-191 Reserved 53 * 54 * Local extensions: 55 * 56 * 192-255 Local extensions 57 * 248-255 Local extensions (OpenSSH will never use numbers in this range) 58 */ 59 60/* special marker for no message */ 61 62#define SSH_MSG_NONE 0 63 64/* ranges */ 65 66#define SSH2_MSG_TRANSPORT_MIN 1 67#define SSH2_MSG_TRANSPORT_MAX 49 68#define SSH2_MSG_USERAUTH_MIN 50 69#define SSH2_MSG_USERAUTH_MAX 79 70#define SSH2_MSG_USERAUTH_PER_METHOD_MIN 60 71#define SSH2_MSG_USERAUTH_PER_METHOD_MAX SSH2_MSG_USERAUTH_MAX 72#define SSH2_MSG_CONNECTION_MIN 80 73#define SSH2_MSG_CONNECTION_MAX 127 74#define SSH2_MSG_RESERVED_MIN 128 75#define SSH2_MSG_RESERVED_MAX 191 76#define SSH2_MSG_LOCAL_MIN 192 77#define SSH2_MSG_LOCAL_MAX 255 78#define SSH2_MSG_MIN 1 79#define SSH2_MSG_MAX 255 80 81/* transport layer: generic */ 82 83#define SSH2_MSG_DISCONNECT 1 84#define SSH2_MSG_IGNORE 2 85#define SSH2_MSG_UNIMPLEMENTED 3 86#define SSH2_MSG_DEBUG 4 87#define SSH2_MSG_SERVICE_REQUEST 5 88#define SSH2_MSG_SERVICE_ACCEPT 6 89#define SSH2_MSG_EXT_INFO 7 90#define SSH2_MSG_NEWCOMPRESS 8 91 92/* transport layer: alg negotiation */ 93 94#define SSH2_MSG_KEXINIT 20 95#define SSH2_MSG_NEWKEYS 21 96 97/* transport layer: kex specific messages, can be reused */ 98 99#define SSH2_MSG_KEXDH_INIT 30 100#define SSH2_MSG_KEXDH_REPLY 31 101 102/* dh-group-exchange */ 103#define SSH2_MSG_KEX_DH_GEX_REQUEST_OLD 30 104#define SSH2_MSG_KEX_DH_GEX_GROUP 31 105#define SSH2_MSG_KEX_DH_GEX_INIT 32 106#define SSH2_MSG_KEX_DH_GEX_REPLY 33 107#define SSH2_MSG_KEX_DH_GEX_REQUEST 34 108 109/* ecdh */ 110#define SSH2_MSG_KEX_ECDH_INIT 30 111#define SSH2_MSG_KEX_ECDH_REPLY 31 112 113/* transport layer: OpenSSH extensions */ 114#define SSH2_MSG_PING 192 115#define SSH2_MSG_PONG 193 116 117/* user authentication: generic */ 118 119#define SSH2_MSG_USERAUTH_REQUEST 50 120#define SSH2_MSG_USERAUTH_FAILURE 51 121#define SSH2_MSG_USERAUTH_SUCCESS 52 122#define SSH2_MSG_USERAUTH_BANNER 53 123 124/* user authentication: method specific, can be reused */ 125 126#define SSH2_MSG_USERAUTH_PK_OK 60 127#define SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ 60 128#define SSH2_MSG_USERAUTH_INFO_REQUEST 60 129#define SSH2_MSG_USERAUTH_INFO_RESPONSE 61 130 131/* connection protocol: generic */ 132 133#define SSH2_MSG_GLOBAL_REQUEST 80 134#define SSH2_MSG_REQUEST_SUCCESS 81 135#define SSH2_MSG_REQUEST_FAILURE 82 136 137/* channel related messages */ 138 139#define SSH2_MSG_CHANNEL_OPEN 90 140#define SSH2_MSG_CHANNEL_OPEN_CONFIRMATION 91 141#define SSH2_MSG_CHANNEL_OPEN_FAILURE 92 142#define SSH2_MSG_CHANNEL_WINDOW_ADJUST 93 143#define SSH2_MSG_CHANNEL_DATA 94 144#define SSH2_MSG_CHANNEL_EXTENDED_DATA 95 145#define SSH2_MSG_CHANNEL_EOF 96 146#define SSH2_MSG_CHANNEL_CLOSE 97 147#define SSH2_MSG_CHANNEL_REQUEST 98 148#define SSH2_MSG_CHANNEL_SUCCESS 99 149#define SSH2_MSG_CHANNEL_FAILURE 100 150 151/* disconnect reason code */ 152 153#define SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT 1 154#define SSH2_DISCONNECT_PROTOCOL_ERROR 2 155#define SSH2_DISCONNECT_KEY_EXCHANGE_FAILED 3 156#define SSH2_DISCONNECT_HOST_AUTHENTICATION_FAILED 4 157#define SSH2_DISCONNECT_RESERVED 4 158#define SSH2_DISCONNECT_MAC_ERROR 5 159#define SSH2_DISCONNECT_COMPRESSION_ERROR 6 160#define SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE 7 161#define SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED 8 162#define SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9 163#define SSH2_DISCONNECT_CONNECTION_LOST 10 164#define SSH2_DISCONNECT_BY_APPLICATION 11 165#define SSH2_DISCONNECT_TOO_MANY_CONNECTIONS 12 166#define SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER 13 167#define SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE 14 168#define SSH2_DISCONNECT_ILLEGAL_USER_NAME 15 169 170/* misc */ 171 172#define SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED 1 173#define SSH2_OPEN_CONNECT_FAILED 2 174#define SSH2_OPEN_UNKNOWN_CHANNEL_TYPE 3 175#define SSH2_OPEN_RESOURCE_SHORTAGE 4 176 177#define SSH2_EXTENDED_DATA_STDERR 1 178 179/* Certificate types for OpenSSH certificate keys extension */ 180#define SSH2_CERT_TYPE_USER 1 181#define SSH2_CERT_TYPE_HOST 2 182