ssh2.h revision 296853
1164190Sjkoshy/* $OpenBSD: ssh2.h,v 1.17 2016/01/14 16:17:40 markus Exp $ */
2164190Sjkoshy
3164190Sjkoshy/*
4164190Sjkoshy * Copyright (c) 2000 Markus Friedl.  All rights reserved.
5164190Sjkoshy *
6164190Sjkoshy * Redistribution and use in source and binary forms, with or without
7164190Sjkoshy * modification, are permitted provided that the following conditions
8164190Sjkoshy * are met:
9164190Sjkoshy * 1. Redistributions of source code must retain the above copyright
10164190Sjkoshy *    notice, this list of conditions and the following disclaimer.
11164190Sjkoshy * 2. Redistributions in binary form must reproduce the above copyright
12164190Sjkoshy *    notice, this list of conditions and the following disclaimer in the
13164190Sjkoshy *    documentation and/or other materials provided with the distribution.
14164190Sjkoshy *
15164190Sjkoshy * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16164190Sjkoshy * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17164190Sjkoshy * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18164190Sjkoshy * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19164190Sjkoshy * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20164190Sjkoshy * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21164190Sjkoshy * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22164190Sjkoshy * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23164190Sjkoshy * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24164190Sjkoshy * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25164190Sjkoshy */
26164190Sjkoshy
27164190Sjkoshy/*
28164190Sjkoshy * draft-ietf-secsh-architecture-05.txt
29164190Sjkoshy *
30164190Sjkoshy *   Transport layer protocol:
31165317Sjkoshy *
32165317Sjkoshy *     1-19     Transport layer generic (e.g. disconnect, ignore, debug,
33165317Sjkoshy *              etc)
34165317Sjkoshy *     20-29    Algorithm negotiation
35165317Sjkoshy *     30-49    Key exchange method specific (numbers can be reused for
36165317Sjkoshy *              different authentication methods)
37165317Sjkoshy *
38165317Sjkoshy *   User authentication protocol:
39165317Sjkoshy *
40165317Sjkoshy *     50-59    User authentication generic
41164190Sjkoshy *     60-79    User authentication method specific (numbers can be reused
42164190Sjkoshy *              for different authentication methods)
43164190Sjkoshy *
44165317Sjkoshy *   Connection protocol:
45165317Sjkoshy *
46165317Sjkoshy *     80-89    Connection protocol generic
47165317Sjkoshy *     90-127   Channel related messages
48165317Sjkoshy *
49210341Skaiw *   Reserved for client protocols:
50165317Sjkoshy *
51165317Sjkoshy *     128-191  Reserved
52165317Sjkoshy *
53165317Sjkoshy *   Local extensions:
54165317Sjkoshy *
55165317Sjkoshy *     192-255  Local extensions
56165317Sjkoshy */
57165317Sjkoshy
58165317Sjkoshy/* ranges */
59165317Sjkoshy
60165317Sjkoshy#define SSH2_MSG_TRANSPORT_MIN				1
61165317Sjkoshy#define SSH2_MSG_TRANSPORT_MAX				49
62165317Sjkoshy#define SSH2_MSG_USERAUTH_MIN				50
63165317Sjkoshy#define SSH2_MSG_USERAUTH_MAX				79
64165317Sjkoshy#define SSH2_MSG_USERAUTH_PER_METHOD_MIN		60
65165317Sjkoshy#define SSH2_MSG_USERAUTH_PER_METHOD_MAX		SSH2_MSG_USERAUTH_MAX
66165317Sjkoshy#define SSH2_MSG_CONNECTION_MIN				80
67165317Sjkoshy#define SSH2_MSG_CONNECTION_MAX				127
68165317Sjkoshy#define SSH2_MSG_RESERVED_MIN				128
69164190Sjkoshy#define SSH2_MSG_RESERVED_MAX				191
70164190Sjkoshy#define SSH2_MSG_LOCAL_MIN				192
71164190Sjkoshy#define SSH2_MSG_LOCAL_MAX				255
72164190Sjkoshy#define SSH2_MSG_MIN					1
73164190Sjkoshy#define SSH2_MSG_MAX					255
74164190Sjkoshy
75164190Sjkoshy/* transport layer: generic */
76164190Sjkoshy
77164190Sjkoshy#define SSH2_MSG_DISCONNECT				1
78164190Sjkoshy#define SSH2_MSG_IGNORE					2
79164190Sjkoshy#define SSH2_MSG_UNIMPLEMENTED				3
80164190Sjkoshy#define SSH2_MSG_DEBUG					4
81164190Sjkoshy#define SSH2_MSG_SERVICE_REQUEST			5
82164190Sjkoshy#define SSH2_MSG_SERVICE_ACCEPT				6
83164190Sjkoshy#define SSH2_MSG_EXT_INFO				7
84164190Sjkoshy
85164190Sjkoshy/* transport layer: alg negotiation */
86164190Sjkoshy
87164190Sjkoshy#define SSH2_MSG_KEXINIT				20
88164190Sjkoshy#define SSH2_MSG_NEWKEYS				21
89164190Sjkoshy
90164190Sjkoshy/* transport layer: kex specific messages, can be reused */
91164190Sjkoshy
92164190Sjkoshy#define SSH2_MSG_KEXDH_INIT				30
93164190Sjkoshy#define SSH2_MSG_KEXDH_REPLY				31
94164190Sjkoshy
95164190Sjkoshy/* dh-group-exchange */
96164190Sjkoshy#define SSH2_MSG_KEX_DH_GEX_REQUEST_OLD			30
97164190Sjkoshy#define SSH2_MSG_KEX_DH_GEX_GROUP			31
98164190Sjkoshy#define SSH2_MSG_KEX_DH_GEX_INIT			32
99164190Sjkoshy#define SSH2_MSG_KEX_DH_GEX_REPLY			33
100164190Sjkoshy#define SSH2_MSG_KEX_DH_GEX_REQUEST			34
101164190Sjkoshy
102164190Sjkoshy/* ecdh */
103164190Sjkoshy#define SSH2_MSG_KEX_ECDH_INIT				30
104164190Sjkoshy#define SSH2_MSG_KEX_ECDH_REPLY				31
105164190Sjkoshy
106164190Sjkoshy/* user authentication: generic */
107164190Sjkoshy
108164190Sjkoshy#define SSH2_MSG_USERAUTH_REQUEST			50
109164190Sjkoshy#define SSH2_MSG_USERAUTH_FAILURE			51
110164190Sjkoshy#define SSH2_MSG_USERAUTH_SUCCESS			52
111164190Sjkoshy#define SSH2_MSG_USERAUTH_BANNER			53
112164190Sjkoshy
113164190Sjkoshy/* user authentication: method specific, can be reused */
114164190Sjkoshy
115164190Sjkoshy#define SSH2_MSG_USERAUTH_PK_OK				60
116164190Sjkoshy#define SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ		60
117164190Sjkoshy#define SSH2_MSG_USERAUTH_INFO_REQUEST			60
118164190Sjkoshy#define SSH2_MSG_USERAUTH_INFO_RESPONSE			61
119164190Sjkoshy
120164190Sjkoshy/* connection protocol: generic */
121164190Sjkoshy
122164190Sjkoshy#define SSH2_MSG_GLOBAL_REQUEST				80
123164190Sjkoshy#define SSH2_MSG_REQUEST_SUCCESS			81
124164190Sjkoshy#define SSH2_MSG_REQUEST_FAILURE			82
125164190Sjkoshy
126164190Sjkoshy/* channel related messages */
127164190Sjkoshy
128164190Sjkoshy#define SSH2_MSG_CHANNEL_OPEN				90
129164190Sjkoshy#define SSH2_MSG_CHANNEL_OPEN_CONFIRMATION		91
130164190Sjkoshy#define SSH2_MSG_CHANNEL_OPEN_FAILURE			92
131164190Sjkoshy#define SSH2_MSG_CHANNEL_WINDOW_ADJUST			93
132164190Sjkoshy#define SSH2_MSG_CHANNEL_DATA				94
133164190Sjkoshy#define SSH2_MSG_CHANNEL_EXTENDED_DATA			95
134164190Sjkoshy#define SSH2_MSG_CHANNEL_EOF				96
135164190Sjkoshy#define SSH2_MSG_CHANNEL_CLOSE				97
136164190Sjkoshy#define SSH2_MSG_CHANNEL_REQUEST			98
137164190Sjkoshy#define SSH2_MSG_CHANNEL_SUCCESS			99
138164190Sjkoshy#define SSH2_MSG_CHANNEL_FAILURE			100
139164190Sjkoshy
140164190Sjkoshy/* disconnect reason code */
141164190Sjkoshy
142164190Sjkoshy#define SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT	1
143164190Sjkoshy#define SSH2_DISCONNECT_PROTOCOL_ERROR			2
144164190Sjkoshy#define SSH2_DISCONNECT_KEY_EXCHANGE_FAILED		3
145164190Sjkoshy#define SSH2_DISCONNECT_HOST_AUTHENTICATION_FAILED	4
146164190Sjkoshy#define SSH2_DISCONNECT_RESERVED			4
147164190Sjkoshy#define SSH2_DISCONNECT_MAC_ERROR			5
148164190Sjkoshy#define SSH2_DISCONNECT_COMPRESSION_ERROR		6
149164190Sjkoshy#define SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE		7
150164190Sjkoshy#define SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED	8
151164190Sjkoshy#define SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE		9
152164190Sjkoshy#define SSH2_DISCONNECT_CONNECTION_LOST			10
153164190Sjkoshy#define SSH2_DISCONNECT_BY_APPLICATION			11
154164190Sjkoshy#define SSH2_DISCONNECT_TOO_MANY_CONNECTIONS		12
155164190Sjkoshy#define SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER		13
156164190Sjkoshy#define SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE	14
157164190Sjkoshy#define SSH2_DISCONNECT_ILLEGAL_USER_NAME		15
158164190Sjkoshy
159164190Sjkoshy/* misc */
160164190Sjkoshy
161164190Sjkoshy#define SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED		1
162164190Sjkoshy#define SSH2_OPEN_CONNECT_FAILED			2
163164190Sjkoshy#define SSH2_OPEN_UNKNOWN_CHANNEL_TYPE			3
164164190Sjkoshy#define SSH2_OPEN_RESOURCE_SHORTAGE			4
165164190Sjkoshy
166164190Sjkoshy#define SSH2_EXTENDED_DATA_STDERR			1
167164190Sjkoshy
168164190Sjkoshy/* Certificate types for OpenSSH certificate keys extension */
169164190Sjkoshy#define SSH2_CERT_TYPE_USER				1
170164190Sjkoshy#define SSH2_CERT_TYPE_HOST				2
171164190Sjkoshy