From c89b04482559dc4db72a03b2f73ee1f413b26c77 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Thu, 1 Dec 2022 19:21:45 +0100 Subject: [PATCH] Added a subcommand to upload an enterprise certificate for enterprise attestation. If present, when requested enterpriseAttestation==2 for MC, this certificate is returned in the x5c field. If not present, a batch attestation is returned. Signed-off-by: Pol Henarejos --- src/fido/cbor_vendor.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/fido/cbor_vendor.c b/src/fido/cbor_vendor.c index 387404c..0252d1b 100644 --- a/src/fido/cbor_vendor.c +++ b/src/fido/cbor_vendor.c @@ -124,7 +124,7 @@ int cbor_vendor_generic(uint8_t cmd, const uint8_t *data, size_t len) { } else if (vendorCmd == 0x02) { if (vendorParam.present == false) - CBOR_ERROR(CTAP2_ERR_MISSING_PARAMETER); + CBOR_ERROR(CTAP2_ERR_MISSING_PARAMETER); uint8_t zeros[32]; memset(zeros, 0, sizeof(zeros)); flash_write_data_to_file(ef_keydev_enc, vendorParam.data, vendorParam.len); @@ -265,6 +265,15 @@ int cbor_vendor_generic(uint8_t cmd, const uint8_t *data, size_t len) { CBOR_CHECK(cbor_encode_uint(&mapEncoder, 0x01)); CBOR_CHECK(cbor_encode_byte_string(&mapEncoder, buffer + sizeof(buffer) - ret, ret)); } + else if (vendorCmd == 0x02) { + if (vendorParam.present == false) + CBOR_ERROR(CTAP2_ERR_MISSING_PARAMETER); + file_t *ef_ee_ea = search_by_fid(EF_EE_DEV_EA, NULL, SPECIFY_EF); + if (ef_ee_ea) + flash_write_data_to_file(ef_ee_ea, vendorParam.data, vendorParam.len); + low_flash_available(); + goto err; + } } else CBOR_ERROR(CTAP2_ERR_UNSUPPORTED_OPTION);