xref: /freebsd-src/contrib/libfido2/src/fido/err.h (revision 2ccfa855b2fc331819953e3de1b1c15ce5b95a7e)
10afa8e06SEd Maste /*
20afa8e06SEd Maste  * Copyright (c) 2018 Yubico AB. All rights reserved.
3*2ccfa855SEd Maste  * SPDX-License-Identifier: BSD-2-Clause
4*2ccfa855SEd Maste  *
5*2ccfa855SEd Maste  * Redistribution and use in source and binary forms, with or without
6*2ccfa855SEd Maste  * modification, are permitted provided that the following conditions are
7*2ccfa855SEd Maste  * met:
8*2ccfa855SEd Maste  *
9*2ccfa855SEd Maste  *    1. Redistributions of source code must retain the above copyright
10*2ccfa855SEd Maste  *       notice, this list of conditions and the following disclaimer.
11*2ccfa855SEd Maste  *    2. Redistributions in binary form must reproduce the above copyright
12*2ccfa855SEd Maste  *       notice, this list of conditions and the following disclaimer in
13*2ccfa855SEd Maste  *       the documentation and/or other materials provided with the
14*2ccfa855SEd Maste  *       distribution.
15*2ccfa855SEd Maste  *
16*2ccfa855SEd Maste  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17*2ccfa855SEd Maste  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18*2ccfa855SEd Maste  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19*2ccfa855SEd Maste  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20*2ccfa855SEd Maste  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21*2ccfa855SEd Maste  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22*2ccfa855SEd Maste  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23*2ccfa855SEd Maste  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24*2ccfa855SEd Maste  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25*2ccfa855SEd Maste  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26*2ccfa855SEd Maste  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
270afa8e06SEd Maste  */
280afa8e06SEd Maste 
290afa8e06SEd Maste #ifndef _FIDO_ERR_H
300afa8e06SEd Maste #define _FIDO_ERR_H
310afa8e06SEd Maste 
320afa8e06SEd Maste #define FIDO_ERR_SUCCESS		0x00
330afa8e06SEd Maste #define FIDO_ERR_INVALID_COMMAND	0x01
340afa8e06SEd Maste #define FIDO_ERR_INVALID_PARAMETER	0x02
350afa8e06SEd Maste #define FIDO_ERR_INVALID_LENGTH		0x03
360afa8e06SEd Maste #define FIDO_ERR_INVALID_SEQ		0x04
370afa8e06SEd Maste #define FIDO_ERR_TIMEOUT		0x05
380afa8e06SEd Maste #define FIDO_ERR_CHANNEL_BUSY		0x06
390afa8e06SEd Maste #define FIDO_ERR_LOCK_REQUIRED		0x0a
400afa8e06SEd Maste #define FIDO_ERR_INVALID_CHANNEL	0x0b
410afa8e06SEd Maste #define FIDO_ERR_CBOR_UNEXPECTED_TYPE	0x11
420afa8e06SEd Maste #define FIDO_ERR_INVALID_CBOR		0x12
430afa8e06SEd Maste #define FIDO_ERR_MISSING_PARAMETER	0x14
440afa8e06SEd Maste #define FIDO_ERR_LIMIT_EXCEEDED		0x15
450afa8e06SEd Maste #define FIDO_ERR_UNSUPPORTED_EXTENSION	0x16
460afa8e06SEd Maste #define FIDO_ERR_FP_DATABASE_FULL	0x17
470afa8e06SEd Maste #define FIDO_ERR_LARGEBLOB_STORAGE_FULL	0x18
480afa8e06SEd Maste #define FIDO_ERR_CREDENTIAL_EXCLUDED	0x19
490afa8e06SEd Maste #define FIDO_ERR_PROCESSING		0x21
500afa8e06SEd Maste #define FIDO_ERR_INVALID_CREDENTIAL	0x22
510afa8e06SEd Maste #define FIDO_ERR_USER_ACTION_PENDING	0x23
520afa8e06SEd Maste #define FIDO_ERR_OPERATION_PENDING	0x24
530afa8e06SEd Maste #define FIDO_ERR_NO_OPERATIONS		0x25
540afa8e06SEd Maste #define FIDO_ERR_UNSUPPORTED_ALGORITHM	0x26
550afa8e06SEd Maste #define FIDO_ERR_OPERATION_DENIED	0x27
560afa8e06SEd Maste #define FIDO_ERR_KEY_STORE_FULL		0x28
570afa8e06SEd Maste #define FIDO_ERR_NOT_BUSY		0x29
580afa8e06SEd Maste #define FIDO_ERR_NO_OPERATION_PENDING	0x2a
590afa8e06SEd Maste #define FIDO_ERR_UNSUPPORTED_OPTION	0x2b
600afa8e06SEd Maste #define FIDO_ERR_INVALID_OPTION		0x2c
610afa8e06SEd Maste #define FIDO_ERR_KEEPALIVE_CANCEL	0x2d
620afa8e06SEd Maste #define FIDO_ERR_NO_CREDENTIALS		0x2e
630afa8e06SEd Maste #define FIDO_ERR_USER_ACTION_TIMEOUT	0x2f
640afa8e06SEd Maste #define FIDO_ERR_NOT_ALLOWED		0x30
650afa8e06SEd Maste #define FIDO_ERR_PIN_INVALID		0x31
660afa8e06SEd Maste #define FIDO_ERR_PIN_BLOCKED		0x32
670afa8e06SEd Maste #define FIDO_ERR_PIN_AUTH_INVALID	0x33
680afa8e06SEd Maste #define FIDO_ERR_PIN_AUTH_BLOCKED	0x34
690afa8e06SEd Maste #define FIDO_ERR_PIN_NOT_SET		0x35
700afa8e06SEd Maste #define FIDO_ERR_PIN_REQUIRED		0x36
710afa8e06SEd Maste #define FIDO_ERR_PIN_POLICY_VIOLATION	0x37
720afa8e06SEd Maste #define FIDO_ERR_PIN_TOKEN_EXPIRED	0x38
730afa8e06SEd Maste #define FIDO_ERR_REQUEST_TOO_LARGE	0x39
740afa8e06SEd Maste #define FIDO_ERR_ACTION_TIMEOUT		0x3a
750afa8e06SEd Maste #define FIDO_ERR_UP_REQUIRED		0x3b
760afa8e06SEd Maste #define FIDO_ERR_UV_BLOCKED		0x3c
770afa8e06SEd Maste #define FIDO_ERR_UV_INVALID		0x3f
780afa8e06SEd Maste #define FIDO_ERR_UNAUTHORIZED_PERM	0x40
790afa8e06SEd Maste #define FIDO_ERR_ERR_OTHER		0x7f
800afa8e06SEd Maste #define FIDO_ERR_SPEC_LAST		0xdf
810afa8e06SEd Maste 
820afa8e06SEd Maste /* defined internally */
830afa8e06SEd Maste #define FIDO_OK				FIDO_ERR_SUCCESS
840afa8e06SEd Maste #define FIDO_ERR_TX			-1
850afa8e06SEd Maste #define FIDO_ERR_RX			-2
860afa8e06SEd Maste #define FIDO_ERR_RX_NOT_CBOR		-3
870afa8e06SEd Maste #define FIDO_ERR_RX_INVALID_CBOR	-4
880afa8e06SEd Maste #define FIDO_ERR_INVALID_PARAM		-5
890afa8e06SEd Maste #define FIDO_ERR_INVALID_SIG		-6
900afa8e06SEd Maste #define FIDO_ERR_INVALID_ARGUMENT	-7
910afa8e06SEd Maste #define FIDO_ERR_USER_PRESENCE_REQUIRED	-8
920afa8e06SEd Maste #define FIDO_ERR_INTERNAL		-9
930afa8e06SEd Maste #define FIDO_ERR_NOTFOUND		-10
940afa8e06SEd Maste #define FIDO_ERR_COMPRESS		-11
950afa8e06SEd Maste 
960afa8e06SEd Maste #ifdef __cplusplus
970afa8e06SEd Maste extern "C" {
980afa8e06SEd Maste #endif /* __cplusplus */
990afa8e06SEd Maste 
1000afa8e06SEd Maste const char *fido_strerr(int);
1010afa8e06SEd Maste 
1020afa8e06SEd Maste #ifdef __cplusplus
1030afa8e06SEd Maste } /* extern "C" */
1040afa8e06SEd Maste #endif /* __cplusplus */
1050afa8e06SEd Maste 
1060afa8e06SEd Maste #endif /* _FIDO_ERR_H */
107