1/*	$NetBSD: ssherr.h,v 1.4 2020/02/27 00:24:40 christos Exp $	*/
2/*	$OpenBSD: ssherr.h,v 1.8 2020/01/25 23:13:09 djm Exp $	*/
3
4/*
5 * Copyright (c) 2011 Damien Miller
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef _SSHERR_H
21#define _SSHERR_H
22
23/* XXX are these too granular? not granular enough? I can't decide - djm */
24
25/* Error codes */
26#define SSH_ERR_SUCCESS				0
27#define SSH_ERR_INTERNAL_ERROR			-1
28#define SSH_ERR_ALLOC_FAIL			-2
29#define SSH_ERR_MESSAGE_INCOMPLETE		-3
30#define SSH_ERR_INVALID_FORMAT			-4
31#define SSH_ERR_BIGNUM_IS_NEGATIVE		-5
32#define SSH_ERR_STRING_TOO_LARGE		-6
33#define SSH_ERR_BIGNUM_TOO_LARGE		-7
34#define SSH_ERR_ECPOINT_TOO_LARGE		-8
35#define SSH_ERR_NO_BUFFER_SPACE			-9
36#define SSH_ERR_INVALID_ARGUMENT		-10
37#define SSH_ERR_KEY_BITS_MISMATCH		-11
38#define SSH_ERR_EC_CURVE_INVALID		-12
39#define SSH_ERR_KEY_TYPE_MISMATCH		-13
40#define SSH_ERR_KEY_TYPE_UNKNOWN		-14 /* XXX UNSUPPORTED? */
41#define SSH_ERR_EC_CURVE_MISMATCH		-15
42#define SSH_ERR_EXPECTED_CERT			-16
43#define SSH_ERR_KEY_LACKS_CERTBLOB		-17
44#define SSH_ERR_KEY_CERT_UNKNOWN_TYPE		-18
45#define SSH_ERR_KEY_CERT_INVALID_SIGN_KEY	-19
46#define SSH_ERR_KEY_INVALID_EC_VALUE		-20
47#define SSH_ERR_SIGNATURE_INVALID		-21
48#define SSH_ERR_LIBCRYPTO_ERROR			-22
49#define SSH_ERR_UNEXPECTED_TRAILING_DATA	-23
50#define SSH_ERR_SYSTEM_ERROR			-24
51#define SSH_ERR_KEY_CERT_INVALID		-25
52#define SSH_ERR_AGENT_COMMUNICATION		-26
53#define SSH_ERR_AGENT_FAILURE			-27
54#define SSH_ERR_DH_GEX_OUT_OF_RANGE		-28
55#define SSH_ERR_DISCONNECTED			-29
56#define SSH_ERR_MAC_INVALID			-30
57#define SSH_ERR_NO_CIPHER_ALG_MATCH		-31
58#define SSH_ERR_NO_MAC_ALG_MATCH		-32
59#define SSH_ERR_NO_COMPRESS_ALG_MATCH		-33
60#define SSH_ERR_NO_KEX_ALG_MATCH		-34
61#define SSH_ERR_NO_HOSTKEY_ALG_MATCH		-35
62#define SSH_ERR_NO_HOSTKEY_LOADED		-36
63#define SSH_ERR_PROTOCOL_MISMATCH		-37
64#define SSH_ERR_NO_PROTOCOL_VERSION		-38
65#define SSH_ERR_NEED_REKEY			-39
66#define SSH_ERR_PASSPHRASE_TOO_SHORT		-40
67#define SSH_ERR_FILE_CHANGED			-41
68#define SSH_ERR_KEY_UNKNOWN_CIPHER		-42
69#define SSH_ERR_KEY_WRONG_PASSPHRASE		-43
70#define SSH_ERR_KEY_BAD_PERMISSIONS		-44
71#define SSH_ERR_KEY_CERT_MISMATCH		-45
72#define SSH_ERR_KEY_NOT_FOUND			-46
73#define SSH_ERR_AGENT_NOT_PRESENT		-47
74#define SSH_ERR_AGENT_NO_IDENTITIES		-48
75#define SSH_ERR_BUFFER_READ_ONLY		-49
76#define SSH_ERR_KRL_BAD_MAGIC			-50
77#define SSH_ERR_KEY_REVOKED			-51
78#define SSH_ERR_CONN_CLOSED			-52
79#define SSH_ERR_CONN_TIMEOUT			-53
80#define SSH_ERR_CONN_CORRUPT			-54
81#define SSH_ERR_PROTOCOL_ERROR			-55
82#define SSH_ERR_KEY_LENGTH			-56
83#define SSH_ERR_NUMBER_TOO_LARGE		-57
84#define SSH_ERR_SIGN_ALG_UNSUPPORTED		-58
85#define SSH_ERR_FEATURE_UNSUPPORTED		-59
86#define SSH_ERR_DEVICE_NOT_FOUND		-60
87
88/* Translate a numeric error code to a human-readable error string */
89const char *ssh_err(int n);
90
91#endif /* _SSHERR_H */
92