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