10afa8e06SEd Maste /* 2*2ccfa855SEd Maste * Copyright (c) 2018-2022 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_PARAM_H 300afa8e06SEd Maste #define _FIDO_PARAM_H 310afa8e06SEd Maste 320afa8e06SEd Maste /* Authentication data flags. */ 330afa8e06SEd Maste #define CTAP_AUTHDATA_USER_PRESENT 0x01 340afa8e06SEd Maste #define CTAP_AUTHDATA_USER_VERIFIED 0x04 350afa8e06SEd Maste #define CTAP_AUTHDATA_ATT_CRED 0x40 360afa8e06SEd Maste #define CTAP_AUTHDATA_EXT_DATA 0x80 370afa8e06SEd Maste 380afa8e06SEd Maste /* CTAPHID command opcodes. */ 390afa8e06SEd Maste #define CTAP_CMD_PING 0x01 400afa8e06SEd Maste #define CTAP_CMD_MSG 0x03 410afa8e06SEd Maste #define CTAP_CMD_LOCK 0x04 420afa8e06SEd Maste #define CTAP_CMD_INIT 0x06 430afa8e06SEd Maste #define CTAP_CMD_WINK 0x08 440afa8e06SEd Maste #define CTAP_CMD_CBOR 0x10 450afa8e06SEd Maste #define CTAP_CMD_CANCEL 0x11 460afa8e06SEd Maste #define CTAP_KEEPALIVE 0x3b 470afa8e06SEd Maste #define CTAP_FRAME_INIT 0x80 480afa8e06SEd Maste 490afa8e06SEd Maste /* CTAPHID CBOR command opcodes. */ 500afa8e06SEd Maste #define CTAP_CBOR_MAKECRED 0x01 510afa8e06SEd Maste #define CTAP_CBOR_ASSERT 0x02 520afa8e06SEd Maste #define CTAP_CBOR_GETINFO 0x04 530afa8e06SEd Maste #define CTAP_CBOR_CLIENT_PIN 0x06 540afa8e06SEd Maste #define CTAP_CBOR_RESET 0x07 550afa8e06SEd Maste #define CTAP_CBOR_NEXT_ASSERT 0x08 560afa8e06SEd Maste #define CTAP_CBOR_LARGEBLOB 0x0c 570afa8e06SEd Maste #define CTAP_CBOR_CONFIG 0x0d 580afa8e06SEd Maste #define CTAP_CBOR_BIO_ENROLL_PRE 0x40 590afa8e06SEd Maste #define CTAP_CBOR_CRED_MGMT_PRE 0x41 600afa8e06SEd Maste 610afa8e06SEd Maste /* Supported CTAP PIN/UV Auth Protocols. */ 620afa8e06SEd Maste #define CTAP_PIN_PROTOCOL1 1 630afa8e06SEd Maste #define CTAP_PIN_PROTOCOL2 2 640afa8e06SEd Maste 650afa8e06SEd Maste /* U2F command opcodes. */ 660afa8e06SEd Maste #define U2F_CMD_REGISTER 0x01 670afa8e06SEd Maste #define U2F_CMD_AUTH 0x02 680afa8e06SEd Maste 690afa8e06SEd Maste /* U2F command flags. */ 700afa8e06SEd Maste #define U2F_AUTH_SIGN 0x03 710afa8e06SEd Maste #define U2F_AUTH_CHECK 0x07 720afa8e06SEd Maste 730afa8e06SEd Maste /* ISO7816-4 status words. */ 740afa8e06SEd Maste #define SW1_MORE_DATA 0x61 750afa8e06SEd Maste #define SW_CONDITIONS_NOT_SATISFIED 0x6985 760afa8e06SEd Maste #define SW_WRONG_DATA 0x6a80 770afa8e06SEd Maste #define SW_NO_ERROR 0x9000 780afa8e06SEd Maste 790afa8e06SEd Maste /* HID Broadcast channel ID. */ 800afa8e06SEd Maste #define CTAP_CID_BROADCAST 0xffffffff 810afa8e06SEd Maste 820afa8e06SEd Maste #define CTAP_INIT_HEADER_LEN 7 830afa8e06SEd Maste #define CTAP_CONT_HEADER_LEN 5 840afa8e06SEd Maste 850afa8e06SEd Maste /* Maximum length of a CTAP HID report in bytes. */ 860afa8e06SEd Maste #define CTAP_MAX_REPORT_LEN 64 870afa8e06SEd Maste 880afa8e06SEd Maste /* Minimum length of a CTAP HID report in bytes. */ 890afa8e06SEd Maste #define CTAP_MIN_REPORT_LEN (CTAP_INIT_HEADER_LEN + 1) 900afa8e06SEd Maste 910afa8e06SEd Maste /* Randomness device on UNIX-like platforms. */ 920afa8e06SEd Maste #ifndef FIDO_RANDOM_DEV 930afa8e06SEd Maste #define FIDO_RANDOM_DEV "/dev/urandom" 940afa8e06SEd Maste #endif 950afa8e06SEd Maste 960afa8e06SEd Maste /* Maximum message size in bytes. */ 970afa8e06SEd Maste #ifndef FIDO_MAXMSG 980afa8e06SEd Maste #define FIDO_MAXMSG 2048 990afa8e06SEd Maste #endif 1000afa8e06SEd Maste 1010afa8e06SEd Maste /* CTAP capability bits. */ 1020afa8e06SEd Maste #define FIDO_CAP_WINK 0x01 /* if set, device supports CTAP_CMD_WINK */ 1030afa8e06SEd Maste #define FIDO_CAP_CBOR 0x04 /* if set, device supports CTAP_CMD_CBOR */ 1040afa8e06SEd Maste #define FIDO_CAP_NMSG 0x08 /* if set, device doesn't support CTAP_CMD_MSG */ 1050afa8e06SEd Maste 1060afa8e06SEd Maste /* Supported COSE algorithms. */ 107f540a430SEd Maste #define COSE_UNSPEC 0 1080afa8e06SEd Maste #define COSE_ES256 -7 1090afa8e06SEd Maste #define COSE_EDDSA -8 1100afa8e06SEd Maste #define COSE_ECDH_ES256 -25 111*2ccfa855SEd Maste #define COSE_ES384 -35 1120afa8e06SEd Maste #define COSE_RS256 -257 113f540a430SEd Maste #define COSE_RS1 -65535 1140afa8e06SEd Maste 1150afa8e06SEd Maste /* Supported COSE types. */ 1160afa8e06SEd Maste #define COSE_KTY_OKP 1 1170afa8e06SEd Maste #define COSE_KTY_EC2 2 1180afa8e06SEd Maste #define COSE_KTY_RSA 3 1190afa8e06SEd Maste 1200afa8e06SEd Maste /* Supported curves. */ 1210afa8e06SEd Maste #define COSE_P256 1 122*2ccfa855SEd Maste #define COSE_P384 2 1230afa8e06SEd Maste #define COSE_ED25519 6 1240afa8e06SEd Maste 1250afa8e06SEd Maste /* Supported extensions. */ 1260afa8e06SEd Maste #define FIDO_EXT_HMAC_SECRET 0x01 1270afa8e06SEd Maste #define FIDO_EXT_CRED_PROTECT 0x02 1280afa8e06SEd Maste #define FIDO_EXT_LARGEBLOB_KEY 0x04 1290afa8e06SEd Maste #define FIDO_EXT_CRED_BLOB 0x08 130f540a430SEd Maste #define FIDO_EXT_MINPINLEN 0x10 1310afa8e06SEd Maste 1320afa8e06SEd Maste /* Supported credential protection policies. */ 1330afa8e06SEd Maste #define FIDO_CRED_PROT_UV_OPTIONAL 0x01 1340afa8e06SEd Maste #define FIDO_CRED_PROT_UV_OPTIONAL_WITH_ID 0x02 1350afa8e06SEd Maste #define FIDO_CRED_PROT_UV_REQUIRED 0x03 1360afa8e06SEd Maste 1370afa8e06SEd Maste #ifdef _FIDO_INTERNAL 1380afa8e06SEd Maste #define FIDO_EXT_ASSERT_MASK (FIDO_EXT_HMAC_SECRET|FIDO_EXT_LARGEBLOB_KEY| \ 1390afa8e06SEd Maste FIDO_EXT_CRED_BLOB) 1400afa8e06SEd Maste #define FIDO_EXT_CRED_MASK (FIDO_EXT_HMAC_SECRET|FIDO_EXT_CRED_PROTECT| \ 141f540a430SEd Maste FIDO_EXT_LARGEBLOB_KEY|FIDO_EXT_CRED_BLOB| \ 142f540a430SEd Maste FIDO_EXT_MINPINLEN) 1430afa8e06SEd Maste #endif /* _FIDO_INTERNAL */ 1440afa8e06SEd Maste 145*2ccfa855SEd Maste /* Recognised UV modes. */ 146*2ccfa855SEd Maste #define FIDO_UV_MODE_TUP 0x0001 /* internal test of user presence */ 147*2ccfa855SEd Maste #define FIDO_UV_MODE_FP 0x0002 /* internal fingerprint check */ 148*2ccfa855SEd Maste #define FIDO_UV_MODE_PIN 0x0004 /* internal pin check */ 149*2ccfa855SEd Maste #define FIDO_UV_MODE_VOICE 0x0008 /* internal voice recognition */ 150*2ccfa855SEd Maste #define FIDO_UV_MODE_FACE 0x0010 /* internal face recognition */ 151*2ccfa855SEd Maste #define FIDO_UV_MODE_LOCATION 0x0020 /* internal location check */ 152*2ccfa855SEd Maste #define FIDO_UV_MODE_EYE 0x0040 /* internal eyeprint check */ 153*2ccfa855SEd Maste #define FIDO_UV_MODE_DRAWN 0x0080 /* internal drawn pattern check */ 154*2ccfa855SEd Maste #define FIDO_UV_MODE_HAND 0x0100 /* internal handprint verification */ 155*2ccfa855SEd Maste #define FIDO_UV_MODE_NONE 0x0200 /* TUP/UV not required */ 156*2ccfa855SEd Maste #define FIDO_UV_MODE_ALL 0x0400 /* all supported UV modes required */ 157*2ccfa855SEd Maste #define FIDO_UV_MODE_EXT_PIN 0x0800 /* external pin verification */ 158*2ccfa855SEd Maste #define FIDO_UV_MODE_EXT_DRAWN 0x1000 /* external drawn pattern check */ 159*2ccfa855SEd Maste 1600afa8e06SEd Maste #endif /* !_FIDO_PARAM_H */ 161