/*1* Copyright (c) 2018-2022 Yubico AB. All rights reserved.2* SPDX-License-Identifier: BSD-2-Clause3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions are6* met:7*8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in12* the documentation and/or other materials provided with the13* distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS16* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT17* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR18* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT19* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,20* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT21* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,22* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY23* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE25* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.26*/2728#ifndef _FIDO_PARAM_H29#define _FIDO_PARAM_H3031/* Authentication data flags. */32#define CTAP_AUTHDATA_USER_PRESENT 0x0133#define CTAP_AUTHDATA_USER_VERIFIED 0x0434#define CTAP_AUTHDATA_ATT_CRED 0x4035#define CTAP_AUTHDATA_EXT_DATA 0x803637/* CTAPHID command opcodes. */38#define CTAP_CMD_PING 0x0139#define CTAP_CMD_MSG 0x0340#define CTAP_CMD_LOCK 0x0441#define CTAP_CMD_INIT 0x0642#define CTAP_CMD_WINK 0x0843#define CTAP_CMD_CBOR 0x1044#define CTAP_CMD_CANCEL 0x1145#define CTAP_KEEPALIVE 0x3b46#define CTAP_FRAME_INIT 0x804748/* CTAPHID CBOR command opcodes. */49#define CTAP_CBOR_MAKECRED 0x0150#define CTAP_CBOR_ASSERT 0x0251#define CTAP_CBOR_GETINFO 0x0452#define CTAP_CBOR_CLIENT_PIN 0x0653#define CTAP_CBOR_RESET 0x0754#define CTAP_CBOR_NEXT_ASSERT 0x0855#define CTAP_CBOR_LARGEBLOB 0x0c56#define CTAP_CBOR_CONFIG 0x0d57#define CTAP_CBOR_BIO_ENROLL_PRE 0x4058#define CTAP_CBOR_CRED_MGMT_PRE 0x415960/* Supported CTAP PIN/UV Auth Protocols. */61#define CTAP_PIN_PROTOCOL1 162#define CTAP_PIN_PROTOCOL2 26364/* U2F command opcodes. */65#define U2F_CMD_REGISTER 0x0166#define U2F_CMD_AUTH 0x026768/* U2F command flags. */69#define U2F_AUTH_SIGN 0x0370#define U2F_AUTH_CHECK 0x077172/* ISO7816-4 status words. */73#define SW1_MORE_DATA 0x6174#define SW_CONDITIONS_NOT_SATISFIED 0x698575#define SW_WRONG_DATA 0x6a8076#define SW_NO_ERROR 0x90007778/* HID Broadcast channel ID. */79#define CTAP_CID_BROADCAST 0xffffffff8081#define CTAP_INIT_HEADER_LEN 782#define CTAP_CONT_HEADER_LEN 58384/* Maximum length of a CTAP HID report in bytes. */85#define CTAP_MAX_REPORT_LEN 648687/* Minimum length of a CTAP HID report in bytes. */88#define CTAP_MIN_REPORT_LEN (CTAP_INIT_HEADER_LEN + 1)8990/* Randomness device on UNIX-like platforms. */91#ifndef FIDO_RANDOM_DEV92#define FIDO_RANDOM_DEV "/dev/urandom"93#endif9495/* Maximum message size in bytes. */96#ifndef FIDO_MAXMSG97#define FIDO_MAXMSG 204898#endif99100/* CTAP capability bits. */101#define FIDO_CAP_WINK 0x01 /* if set, device supports CTAP_CMD_WINK */102#define FIDO_CAP_CBOR 0x04 /* if set, device supports CTAP_CMD_CBOR */103#define FIDO_CAP_NMSG 0x08 /* if set, device doesn't support CTAP_CMD_MSG */104105/* Supported COSE algorithms. */106#define COSE_UNSPEC 0107#define COSE_ES256 -7108#define COSE_EDDSA -8109#define COSE_ECDH_ES256 -25110#define COSE_ES384 -35111#define COSE_RS256 -257112#define COSE_RS1 -65535113114/* Supported COSE types. */115#define COSE_KTY_OKP 1116#define COSE_KTY_EC2 2117#define COSE_KTY_RSA 3118119/* Supported curves. */120#define COSE_P256 1121#define COSE_P384 2122#define COSE_ED25519 6123124/* Supported extensions. */125#define FIDO_EXT_HMAC_SECRET 0x01126#define FIDO_EXT_CRED_PROTECT 0x02127#define FIDO_EXT_LARGEBLOB_KEY 0x04128#define FIDO_EXT_CRED_BLOB 0x08129#define FIDO_EXT_MINPINLEN 0x10130131/* Supported credential protection policies. */132#define FIDO_CRED_PROT_UV_OPTIONAL 0x01133#define FIDO_CRED_PROT_UV_OPTIONAL_WITH_ID 0x02134#define FIDO_CRED_PROT_UV_REQUIRED 0x03135136#ifdef _FIDO_INTERNAL137#define FIDO_EXT_ASSERT_MASK (FIDO_EXT_HMAC_SECRET|FIDO_EXT_LARGEBLOB_KEY| \138FIDO_EXT_CRED_BLOB)139#define FIDO_EXT_CRED_MASK (FIDO_EXT_HMAC_SECRET|FIDO_EXT_CRED_PROTECT| \140FIDO_EXT_LARGEBLOB_KEY|FIDO_EXT_CRED_BLOB| \141FIDO_EXT_MINPINLEN)142#endif /* _FIDO_INTERNAL */143144/* Recognised UV modes. */145#define FIDO_UV_MODE_TUP 0x0001 /* internal test of user presence */146#define FIDO_UV_MODE_FP 0x0002 /* internal fingerprint check */147#define FIDO_UV_MODE_PIN 0x0004 /* internal pin check */148#define FIDO_UV_MODE_VOICE 0x0008 /* internal voice recognition */149#define FIDO_UV_MODE_FACE 0x0010 /* internal face recognition */150#define FIDO_UV_MODE_LOCATION 0x0020 /* internal location check */151#define FIDO_UV_MODE_EYE 0x0040 /* internal eyeprint check */152#define FIDO_UV_MODE_DRAWN 0x0080 /* internal drawn pattern check */153#define FIDO_UV_MODE_HAND 0x0100 /* internal handprint verification */154#define FIDO_UV_MODE_NONE 0x0200 /* TUP/UV not required */155#define FIDO_UV_MODE_ALL 0x0400 /* all supported UV modes required */156#define FIDO_UV_MODE_EXT_PIN 0x0800 /* external pin verification */157#define FIDO_UV_MODE_EXT_DRAWN 0x1000 /* external drawn pattern check */158159#endif /* !_FIDO_PARAM_H */160161162