示例#1
0
static ae_error_t msg4_field1_msg_checking(const TLVsMsg& tlvs_field1)
{
    uint32_t tlv_count = tlvs_field1.get_tlv_count();
    if(tlv_count!=MSG4_FIELD1_COUNT) {
        return PVE_MSG_ERROR;
    }
    uint32_t i;
    for(i=0; i<tlv_count; ++i)
        if(tlvs_field1[i].version != TLV_VERSION_1)
            return PVE_MSG_ERROR;

    if(MSG4_FIELD1_Nonce2.type != TLV_NONCE ||
            MSG4_FIELD1_Nonce2.size != NONCE_2_SIZE ||
            MSG4_FIELD1_Nonce2.header_size != SMALL_TLV_HEADER_SIZE)
        return PVE_MSG_ERROR;
    if(MSG4_FIELD1_ENC_Axf.type != TLV_BLOCK_CIPHER_TEXT||
            MSG4_FIELD1_ENC_Axf.size != BLOCK_CIPHER_TEXT_TLV_PAYLOAD_SIZE(HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE))
        return PVE_MSG_ERROR;
    if(MSG4_FIELD1_MAC_Axf.type != TLV_MESSAGE_AUTHENTICATION_CODE||
            MSG4_FIELD1_MAC_Axf.size != MAC_SIZE||
            MSG4_FIELD1_MAC_Axf.header_size != SMALL_TLV_HEADER_SIZE)
        return PVE_MSG_ERROR;
    if(MSG4_FIELD1_GROUP_CERT.type != TLV_EPID_GROUP_CERT||
            MSG4_FIELD1_GROUP_CERT.size != sizeof(signed_epid_group_cert_t)||
            MSG4_FIELD1_GROUP_CERT.header_size != SMALL_TLV_HEADER_SIZE)
        return PVE_MSG_ERROR;
    if (MSG4_FIELD1_PLATFORM_INFO.type != TLV_PLATFORM_INFO ||
            MSG4_FIELD1_PLATFORM_INFO.size != sizeof(bk_platform_info_t) ||
            MSG4_FIELD1_PLATFORM_INFO.header_size != SMALL_TLV_HEADER_SIZE)
        return PVE_MSG_ERROR;
    return AE_SUCCESS;
}
示例#2
0
static ae_error_t msg4_integrity_checking(const TLVsMsg& tlvs_msg4)
{
    uint32_t tlv_count = tlvs_msg4.get_tlv_count();
    if(tlv_count != MSG4_TOP_FIELDS_COUNT)
        return PVE_INTEGRITY_CHECK_ERROR;
    if(MSG4_TOP_FIELD_NONCE.type != TLV_NONCE || MSG4_TOP_FIELD_NONCE.size != NONCE_SIZE || 
        MSG4_TOP_FIELD_NONCE.version != TLV_VERSION_1 || MSG4_TOP_FIELD_NONCE.header_size != SMALL_TLV_HEADER_SIZE)
        return PVE_INTEGRITY_CHECK_ERROR;
    if(MSG4_TOP_FIELD_DATA.type != TLV_BLOCK_CIPHER_TEXT || MSG4_TOP_FIELD_DATA.version != TLV_VERSION_1)
        return PVE_INTEGRITY_CHECK_ERROR;
    if(MSG4_TOP_FIELD_MAC.type != TLV_MESSAGE_AUTHENTICATION_CODE || MSG4_TOP_FIELD_MAC.version != TLV_VERSION_1 ||
        MSG4_TOP_FIELD_MAC.size != MAC_SIZE || MSG4_TOP_FIELD_MAC.header_size != SMALL_TLV_HEADER_SIZE)
        return PVE_INTEGRITY_CHECK_ERROR;
    return AE_SUCCESS;
}