From fae3b4e0d2f6afb3752afe85a4193cecb1557d0d Mon Sep 17 00:00:00 2001 From: Ludvig Michaelsson Date: Tue, 15 Oct 2024 14:24:51 +0200 Subject: [PATCH] regress: test enterprise attestation Recorded from a device provisioned with the FIDO alliance test data [0]. [0] https://github.com/fido-alliance/conformance-test-tools-resources/blob/821c7114ae193148d276464a80c98d5535fa5681/docs/FIDO2/Authenticator/README.md --- regress/cred.c | 260 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 260 insertions(+) diff --git a/regress/cred.c b/regress/cred.c index d9f3f896..a9be954d 100644 --- a/regress/cred.c +++ b/regress/cred.c @@ -164,6 +164,144 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +#define REGRESS_WIREDATA_MAKECRED_ENTATTEST \ + 0x00, 0x22, 0x00, 0x02, 0x90, 0x03, 0xcd, 0x00, \ + 0xa4, 0x01, 0x66, 0x70, 0x61, 0x63, 0x6b, 0x65, \ + 0x64, 0x02, 0x58, 0xc4, 0x92, 0x36, 0x01, 0x1e, \ + 0x1f, 0xd0, 0x97, 0x79, 0xef, 0xba, 0x2f, 0x03, \ + 0xa6, 0xa0, 0x74, 0x65, 0xc2, 0x1c, 0x8d, 0x11, \ + 0x8e, 0x40, 0x5e, 0x87, 0xfd, 0xe4, 0x43, 0xf2, \ + 0x78, 0x18, 0xa4, 0xa7, 0x41, 0x00, 0x00, 0x00, \ + 0x04, 0xf8, 0xa0, 0x11, 0xf3, 0x8c, 0x0a, 0x4d, \ + 0x00, 0x22, 0x00, 0x02, 0x00, 0x15, 0x80, 0x06, \ + 0x17, 0x11, 0x1f, 0x9e, 0xdc, 0x7d, 0x00, 0x40, \ + 0xdf, 0x57, 0x2d, 0x2d, 0x1f, 0x2f, 0x0a, 0x70, \ + 0x12, 0xe3, 0x69, 0x3e, 0x98, 0x96, 0xdb, 0xbb, \ + 0x5a, 0x80, 0xdc, 0x5e, 0x98, 0x58, 0x3b, 0x4e, \ + 0x23, 0xb8, 0x07, 0xc6, 0x84, 0x64, 0x2d, 0x39, \ + 0xf1, 0x76, 0x8b, 0x80, 0xcb, 0xb8, 0x09, 0x1d, \ + 0x0b, 0xcb, 0xad, 0x7f, 0x18, 0xce, 0x3b, 0xc9, \ + 0x00, 0x22, 0x00, 0x02, 0x01, 0x1c, 0x3f, 0xda, \ + 0x9e, 0x03, 0x5f, 0xce, 0xee, 0x7c, 0xcd, 0x65, \ + 0x77, 0xff, 0x0a, 0xd3, 0x08, 0xa5, 0x01, 0x02, \ + 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0xa2, \ + 0xdb, 0x38, 0xba, 0x4b, 0x61, 0x81, 0x05, 0x97, \ + 0xf2, 0xdf, 0x48, 0xfd, 0x4d, 0xf5, 0x3f, 0x07, \ + 0x86, 0x44, 0x8e, 0xdb, 0x07, 0x69, 0x12, 0x42, \ + 0xac, 0x81, 0x2a, 0x2c, 0x46, 0xcf, 0xea, 0x22, \ + 0x00, 0x22, 0x00, 0x02, 0x02, 0x58, 0x20, 0xef, \ + 0x31, 0x8d, 0xc9, 0x7e, 0xda, 0xfd, 0x5b, 0x7d, \ + 0x68, 0xe0, 0x41, 0x40, 0xb2, 0x27, 0xdd, 0x8e, \ + 0x6d, 0x6b, 0xc4, 0x51, 0xe5, 0x36, 0xb6, 0x99, \ + 0xda, 0x71, 0xdb, 0x5d, 0xed, 0x0d, 0x51, 0x03, \ + 0xa3, 0x63, 0x61, 0x6c, 0x67, 0x26, 0x63, 0x73, \ + 0x69, 0x67, 0x58, 0x47, 0x30, 0x45, 0x02, 0x20, \ + 0x17, 0x04, 0x53, 0x07, 0xcd, 0x3d, 0x45, 0xc9, \ + 0x00, 0x22, 0x00, 0x02, 0x03, 0x98, 0x50, 0x38, \ + 0xa5, 0x30, 0x9e, 0x53, 0xd9, 0xe1, 0xfe, 0xd0, \ + 0xde, 0xca, 0xbd, 0x38, 0x99, 0x0b, 0xec, 0x9e, \ + 0xe6, 0xb8, 0xd3, 0x35, 0x82, 0x02, 0x21, 0x00, \ + 0xb3, 0x3a, 0xf7, 0xb9, 0x30, 0x4e, 0x7a, 0xc4, \ + 0x7f, 0xa7, 0xdc, 0x85, 0x2f, 0x4e, 0x26, 0x06, \ + 0xb0, 0xd4, 0xa7, 0x3a, 0x1a, 0x48, 0xf8, 0x11, \ + 0x5f, 0x9b, 0x5f, 0xd3, 0x5e, 0xf4, 0x1b, 0xce, \ + 0x00, 0x22, 0x00, 0x02, 0x04, 0x63, 0x78, 0x35, \ + 0x63, 0x81, 0x59, 0x02, 0x9e, 0x30, 0x82, 0x02, \ + 0x9a, 0x30, 0x82, 0x02, 0x40, 0xa0, 0x03, 0x02, \ + 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x0a, 0x06, \ + 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, \ + 0x02, 0x30, 0x81, 0xb0, 0x31, 0x2f, 0x30, 0x2d, \ + 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x26, 0x46, \ + 0x49, 0x44, 0x4f, 0x32, 0x20, 0x45, 0x6e, 0x74, \ + 0x00, 0x22, 0x00, 0x02, 0x05, 0x65, 0x72, 0x70, \ + 0x72, 0x69, 0x73, 0x65, 0x20, 0x41, 0x74, 0x74, \ + 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, \ + 0x20, 0x54, 0x45, 0x53, 0x54, 0x20, 0x52, 0x4f, \ + 0x4f, 0x54, 0x31, 0x25, 0x30, 0x23, 0x06, 0x09, \ + 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, \ + 0x01, 0x16, 0x16, 0x74, 0x6f, 0x6f, 0x6c, 0x73, \ + 0x40, 0x66, 0x69, 0x64, 0x6f, 0x61, 0x6c, 0x6c, \ + 0x00, 0x22, 0x00, 0x02, 0x06, 0x69, 0x61, 0x6e, \ + 0x63, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x31, 0x16, \ + 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, \ + 0x0d, 0x46, 0x49, 0x44, 0x4f, 0x20, 0x41, 0x6c, \ + 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x31, 0x0c, \ + 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, \ + 0x03, 0x43, 0x57, 0x47, 0x31, 0x0b, 0x30, 0x09, \ + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, \ + 0x00, 0x22, 0x00, 0x02, 0x07, 0x53, 0x31, 0x0b, \ + 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, \ + 0x02, 0x43, 0x41, 0x31, 0x16, 0x30, 0x14, 0x06, \ + 0x03, 0x55, 0x04, 0x07, 0x0c, 0x0d, 0x4d, 0x6f, \ + 0x75, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x56, \ + 0x69, 0x65, 0x77, 0x30, 0x1e, 0x17, 0x0d, 0x32, \ + 0x31, 0x30, 0x35, 0x31, 0x33, 0x31, 0x33, 0x31, \ + 0x39, 0x30, 0x38, 0x5a, 0x17, 0x0d, 0x32, 0x36, \ + 0x00, 0x22, 0x00, 0x02, 0x08, 0x31, 0x31, 0x30, \ + 0x33, 0x31, 0x33, 0x31, 0x39, 0x30, 0x38, 0x5a, \ + 0x30, 0x81, 0xcd, 0x31, 0x3a, 0x30, 0x38, 0x06, \ + 0x03, 0x55, 0x04, 0x03, 0x0c, 0x31, 0x46, 0x49, \ + 0x44, 0x4f, 0x32, 0x20, 0x45, 0x6e, 0x74, 0x65, \ + 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x20, 0x41, \ + 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, \ + 0x6f, 0x6e, 0x20, 0x42, 0x41, 0x54, 0x43, 0x48, \ + 0x00, 0x22, 0x00, 0x02, 0x09, 0x20, 0x4b, 0x45, \ + 0x59, 0x20, 0x70, 0x72, 0x69, 0x6d, 0x65, 0x32, \ + 0x35, 0x36, 0x76, 0x31, 0x31, 0x25, 0x30, 0x23, \ + 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, \ + 0x01, 0x09, 0x01, 0x16, 0x16, 0x74, 0x6f, 0x6f, \ + 0x6c, 0x73, 0x40, 0x66, 0x69, 0x64, 0x6f, 0x61, \ + 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x2e, \ + 0x6f, 0x72, 0x67, 0x31, 0x16, 0x30, 0x14, 0x06, \ + 0x00, 0x22, 0x00, 0x02, 0x0a, 0x03, 0x55, 0x04, \ + 0x0a, 0x0c, 0x0d, 0x46, 0x49, 0x44, 0x4f, 0x20, \ + 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, \ + 0x31, 0x22, 0x30, 0x20, 0x06, 0x03, 0x55, 0x04, \ + 0x0b, 0x0c, 0x19, 0x41, 0x75, 0x74, 0x68, 0x65, \ + 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, \ + 0x20, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, \ + 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x0b, 0x30, 0x09, \ + 0x00, 0x22, 0x00, 0x02, 0x0b, 0x06, 0x03, 0x55, \ + 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, \ + 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, \ + 0x02, 0x4d, 0x59, 0x31, 0x12, 0x30, 0x10, 0x06, \ + 0x03, 0x55, 0x04, 0x07, 0x0c, 0x09, 0x57, 0x61, \ + 0x6b, 0x65, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x30, \ + 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, \ + 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, \ + 0x00, 0x22, 0x00, 0x02, 0x0c, 0x48, 0xce, 0x3d, \ + 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xad, \ + 0x51, 0xdc, 0x74, 0x2c, 0x37, 0x7f, 0x78, 0x38, \ + 0x2d, 0x2a, 0x3f, 0x40, 0xe9, 0xe3, 0xae, 0xb5, \ + 0x9e, 0x45, 0x93, 0xf2, 0x82, 0xc6, 0xc4, 0x82, \ + 0xfb, 0xd6, 0xd7, 0x1b, 0xda, 0x7c, 0xec, 0x0c, \ + 0x5c, 0x8e, 0x8a, 0xd3, 0xdd, 0x0a, 0xf5, 0x56, \ + 0x43, 0xf0, 0xfc, 0x0b, 0x0d, 0xd7, 0xe9, 0x0a, \ + 0x00, 0x22, 0x00, 0x02, 0x0d, 0xeb, 0x0e, 0xbc, \ + 0x4f, 0x12, 0x27, 0xd7, 0xbc, 0xb0, 0xa9, 0x15, \ + 0x1f, 0x49, 0x6e, 0x10, 0xa3, 0x2c, 0x30, 0x2a, \ + 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, \ + 0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, \ + 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x1e, 0xd3, \ + 0xe9, 0x9a, 0xaf, 0x89, 0x9a, 0xb7, 0x10, 0x61, \ + 0xa3, 0xae, 0x74, 0x7f, 0x3a, 0x96, 0x96, 0xda, \ + 0x00, 0x22, 0x00, 0x02, 0x0e, 0xce, 0x61, 0x30, \ + 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, \ + 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, \ + 0x02, 0x21, 0x00, 0x8e, 0xd7, 0x9c, 0xbe, 0x8f, \ + 0x99, 0xe0, 0xcf, 0x88, 0x04, 0x7e, 0xc0, 0xe1, \ + 0x5a, 0xaa, 0x4a, 0xa3, 0xd7, 0xfc, 0x53, 0x9f, \ + 0x8f, 0x13, 0x66, 0xe7, 0x03, 0x8f, 0xb8, 0x6d, \ + 0x8b, 0xb1, 0x44, 0x02, 0x20, 0x16, 0x68, 0xa5, \ + 0x00, 0x22, 0x00, 0x02, 0x0f, 0xf9, 0x62, 0x9a, \ + 0xc9, 0xf9, 0x27, 0x88, 0x38, 0x91, 0x69, 0x2f, \ + 0x1f, 0xdf, 0xb0, 0xe3, 0x49, 0x0c, 0xaa, 0x3d, \ + 0x4c, 0x10, 0xf4, 0x9c, 0xee, 0xd8, 0xd8, 0x28, \ + 0x01, 0x26, 0x04, 0xf5, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + static const unsigned char cdh[32] = { 0xf9, 0x64, 0x57, 0xe7, 0x2d, 0x97, 0xf6, 0xbb, 0xdd, 0xd7, 0xfb, 0x06, 0x37, 0x62, 0xea, 0x26, @@ -1924,6 +2062,93 @@ const unsigned char x509_1_tpm_es256[1775] = { 0xfe, 0x9a, 0x82, 0x4d, 0x75, 0xb8, 0x6d }; +static const uint8_t x509_entattest[] = { + 0x30, 0x82, 0x02, 0x9a, 0x30, 0x82, 0x02, 0x40, + 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, + 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, + 0x3d, 0x04, 0x03, 0x02, 0x30, 0x81, 0xb0, 0x31, + 0x2f, 0x30, 0x2d, 0x06, 0x03, 0x55, 0x04, 0x03, + 0x0c, 0x26, 0x46, 0x49, 0x44, 0x4f, 0x32, 0x20, + 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, + 0x73, 0x65, 0x20, 0x41, 0x74, 0x74, 0x65, 0x73, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x45, 0x53, 0x54, 0x20, 0x52, 0x4f, 0x4f, 0x54, + 0x31, 0x25, 0x30, 0x23, 0x06, 0x09, 0x2a, 0x86, + 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, + 0x16, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x40, 0x66, + 0x69, 0x64, 0x6f, 0x61, 0x6c, 0x6c, 0x69, 0x61, + 0x6e, 0x63, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x31, + 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x0a, + 0x0c, 0x0d, 0x46, 0x49, 0x44, 0x4f, 0x20, 0x41, + 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x31, + 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0b, + 0x0c, 0x03, 0x43, 0x57, 0x47, 0x31, 0x0b, 0x30, + 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, + 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, + 0x55, 0x04, 0x08, 0x0c, 0x02, 0x43, 0x41, 0x31, + 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x07, + 0x0c, 0x0d, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x20, 0x56, 0x69, 0x65, 0x77, 0x30, + 0x1e, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x35, 0x31, + 0x33, 0x31, 0x33, 0x31, 0x39, 0x30, 0x38, 0x5a, + 0x17, 0x0d, 0x32, 0x36, 0x31, 0x31, 0x30, 0x33, + 0x31, 0x33, 0x31, 0x39, 0x30, 0x38, 0x5a, 0x30, + 0x81, 0xcd, 0x31, 0x3a, 0x30, 0x38, 0x06, 0x03, + 0x55, 0x04, 0x03, 0x0c, 0x31, 0x46, 0x49, 0x44, + 0x4f, 0x32, 0x20, 0x45, 0x6e, 0x74, 0x65, 0x72, + 0x70, 0x72, 0x69, 0x73, 0x65, 0x20, 0x41, 0x74, + 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x20, 0x42, 0x41, 0x54, 0x43, 0x48, 0x20, + 0x4b, 0x45, 0x59, 0x20, 0x70, 0x72, 0x69, 0x6d, + 0x65, 0x32, 0x35, 0x36, 0x76, 0x31, 0x31, 0x25, + 0x30, 0x23, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, + 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x16, 0x74, + 0x6f, 0x6f, 0x6c, 0x73, 0x40, 0x66, 0x69, 0x64, + 0x6f, 0x61, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x31, 0x16, 0x30, + 0x14, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0d, + 0x46, 0x49, 0x44, 0x4f, 0x20, 0x41, 0x6c, 0x6c, + 0x69, 0x61, 0x6e, 0x63, 0x65, 0x31, 0x22, 0x30, + 0x20, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x19, + 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, + 0x63, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x41, 0x74, + 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, + 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, + 0x02, 0x4d, 0x59, 0x31, 0x12, 0x30, 0x10, 0x06, + 0x03, 0x55, 0x04, 0x07, 0x0c, 0x09, 0x57, 0x61, + 0x6b, 0x65, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x30, + 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, + 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, + 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, + 0x00, 0x04, 0xad, 0x51, 0xdc, 0x74, 0x2c, 0x37, + 0x7f, 0x78, 0x38, 0x2d, 0x2a, 0x3f, 0x40, 0xe9, + 0xe3, 0xae, 0xb5, 0x9e, 0x45, 0x93, 0xf2, 0x82, + 0xc6, 0xc4, 0x82, 0xfb, 0xd6, 0xd7, 0x1b, 0xda, + 0x7c, 0xec, 0x0c, 0x5c, 0x8e, 0x8a, 0xd3, 0xdd, + 0x0a, 0xf5, 0x56, 0x43, 0xf0, 0xfc, 0x0b, 0x0d, + 0xd7, 0xe9, 0x0a, 0xeb, 0x0e, 0xbc, 0x4f, 0x12, + 0x27, 0xd7, 0xbc, 0xb0, 0xa9, 0x15, 0x1f, 0x49, + 0x6e, 0x10, 0xa3, 0x2c, 0x30, 0x2a, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, + 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, + 0x04, 0x16, 0x04, 0x14, 0x1e, 0xd3, 0xe9, 0x9a, + 0xaf, 0x89, 0x9a, 0xb7, 0x10, 0x61, 0xa3, 0xae, + 0x74, 0x7f, 0x3a, 0x96, 0x96, 0xda, 0xce, 0x61, + 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, + 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, + 0x45, 0x02, 0x21, 0x00, 0x8e, 0xd7, 0x9c, 0xbe, + 0x8f, 0x99, 0xe0, 0xcf, 0x88, 0x04, 0x7e, 0xc0, + 0xe1, 0x5a, 0xaa, 0x4a, 0xa3, 0xd7, 0xfc, 0x53, + 0x9f, 0x8f, 0x13, 0x66, 0xe7, 0x03, 0x8f, 0xb8, + 0x6d, 0x8b, 0xb1, 0x44, 0x02, 0x20, 0x16, 0x68, + 0xa5, 0xf9, 0x62, 0x9a, 0xc9, 0xf9, 0x27, 0x88, + 0x38, 0x91, 0x69, 0x2f, 0x1f, 0xdf, 0xb0, 0xe3, + 0x49, 0x0c, 0xaa, 0x3d, 0x4c, 0x10, 0xf4, 0x9c, + 0xee, 0xd8, 0xd8, 0x28, 0x01, 0x26 +}; + /* * Security Key By Yubico * 5.1.X @@ -2763,6 +2988,40 @@ makecred(void) fido_dev_free(&dev); } +static void +entattest(void) +{ + const uint8_t makecred_wiredata[] = { + WIREDATA_CTAP_CBOR_INFO, + REGRESS_WIREDATA_MAKECRED_ENTATTEST, + }; + uint8_t *wiredata; + fido_cred_t *c; + fido_dev_t *dev; + + assert((dev = fido_dev_new())); + wiredata = wiredata_setup(makecred_wiredata, sizeof(makecred_wiredata)); + setup_dummy_io(dev); + assert(fido_dev_open(dev, "dummy") == FIDO_OK); + + c = alloc_cred(); + assert(fido_cred_set_type(c, COSE_ES256) == FIDO_OK); + assert(fido_cred_set_entattest(c, 3) == FIDO_ERR_INVALID_ARGUMENT); + assert(fido_cred_set_entattest(c, FIDO_ENTATTEST_VENDOR) == FIDO_OK); + assert(fido_cred_set_clientdata_hash(c, cdh, sizeof(cdh)) == FIDO_OK); + assert(fido_cred_set_rp(c, "ep.fidoalliance.co.nz", NULL) == FIDO_OK); + assert(fido_dev_make_cred(dev, c, NULL) == FIDO_OK); + assert(fido_cred_x5c_len(c) == sizeof(x509_entattest)); + assert(memcmp(fido_cred_x5c_ptr(c), x509_entattest, sizeof(x509_entattest)) == 0); + assert(fido_cred_verify(c) == FIDO_OK); + assert(fido_cred_entattest(c)); + + fido_cred_free(&c); + wiredata_clear(&wiredata); + assert(fido_dev_close(dev) == FIDO_OK); + fido_dev_free(&dev); +} + int main(void) { @@ -2798,6 +3057,7 @@ main(void) valid_tpm_es256_cred(xfail); attestation_object(); makecred(); + entattest(); exit(0); }