IC TA代码调试
static const uint8_t hbkTest[16] = {0};
// hbkReal需要对接到具体系统中的API,该密钥需要具备每台设备唯一的特性,而且每次开机都需要保持不变
static const uint8_t hbkReal[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};***
const uint8_t* eicOpsGetHardwareBoundKey(bool testCredential) {
if (testCredential) {
return hbkTest;
}
return hbkReal;
}
//challenge: gatekeeper的token传入的;
//secureUserId: gatekeeper的token传入的;
//authenticatorId: gatekeeper的token传入的;没有被反序
//timeStamp: gatekeeper的token传入的;没有反序
//mac: gatekeeper的token传入的;
//注意计算与对比mac的时候,需要保证gatekeeper模块的hmac key与此模块相同,
//并保证timeStap,authenticatorId,authenticatorType是否反序与gatekeeper模块保持一致;
//verificationTokenChallenge: IC模块产生,传入keymaster,
//verificationTokenTimeStamp, keymaster模块产生;
//verificationTokenSecurityLevel: keymaster模块产生;
// verificationTokenMac: keymaster模块产生;
//注意:这里边的时间戳都是boot time,是开机时间,单位是ms
//此函数的实现需要验证两个token中的mac,并比较challenge
// 这个地方要不要比较两个token中的timestap,目前不确定?
bool eicOpsValidateAuthToken(uint64_t challenge, uint64_t secureUserId, uint64_t authenticatorId,
int hardwareAuthenticatorType, uint64_t timeStamp, const uint8_t* mac,
size_t macSize, uint64_t verificationTokenChallenge,
uint64_t verificationTokenTimeStamp,
int verificationTokenSecurityLevel,
const uint8_t* verificationTokenMac, size_t verificationTokenMacSize);
IC CA代码调试
FakeSecureHardwareProxy.h文件中定义了如下静态类成员函数:
static EicPresentation ctx_;
static EicSession ctx_;
static EicProvisioning ctx_;
ctx中保存了关键的机密信息,这个部分的实现需要对接到TA中实现,防止机密信息泄露;
并且此处如果再REE实现,也会有一个并发的问题,如果多个CA调用,那么会导致ctx信息错乱,保存不住,因此这个地方换成TEE实现的时候,需要考虑使用数组或者动态内存申请的方式来实现。