ccnp.eventlog package

Submodules

ccnp.eventlog.eventlog_sdk module

This package provides the definitions and helper class for the event log of TD or TPM.

Reference: 1. https://github.com/tpm2-software/tpm2-tcti-uefi/blob/master/src/tcg2-protocol.h

class ccnp.eventlog.eventlog_sdk.CCAlgorithms

Bases: object

Algorithms class for confidential computing.

The definitions are aligning with TCG specification - “TCG Algorithm Registry” at https://trustedcomputinggroup.org/wp-content/uploads/TCGAlgorithmRegistry_Rev01.15.pdf

ALG_INVALID = 4294967295
ALG_SHA1 = 10
ALG_SHA256 = 11
ALG_SHA384 = 12
ALG_SHA512 = 13
ALG_SM3_256 = 14
classmethod algo_dict()

Class method to construct the algo dict

property algo_id

Property of algorithms ID

property block_size

Property of block size

property digest_size

Property of digest size

property is_valid

Property of algorithm id valid check

class ccnp.eventlog.eventlog_sdk.CCEventLogEntry

Bases: object

INVALID_ALGORITHMS_ID = -1
INVALID_EVENT_TYPE = -1
INVALID_MEASURE_REGISTER_INDEX = -1
UNKNOWN_EVENT_TYPE_NAME = 'UNKNOWN'
property alg_id

Property for type algorithm id

property digest

Property for type digest

property event

Property for type event

property evt_size

Property for type event size

property evt_type

Property for type event type

property evt_type_str

Property for type event type string

property reg_idx

Property for type register index

class ccnp.eventlog.eventlog_sdk.CCEventLogType

Bases: object

Event log type for Confidential Computing

EV_ACTION = 5
EV_COMPACT_HASH = 12
EV_CPU_MICROCODE = 9
EV_EFI_ACTION = 2147483655
EV_EFI_BOOT_SERVICES_APPLICATION = 2147483651
EV_EFI_BOOT_SERVICES_DRIVER = 2147483652
EV_EFI_EVENT_BASE = 2147483648
EV_EFI_GPT_EVENT = 2147483654
EV_EFI_HANDOFF_TABLES = 2147483657
EV_EFI_PLATFORM_FIRMWARE_BLOB = 2147483656
EV_EFI_RUNTIME_SERVICES_DRIVER = 2147483653
EV_EFI_VARIABLE_AUTHORITY = 2147483872
EV_EFI_VARIABLE_BOOT = 2147483650
EV_EFI_VARIABLE_DRIVER_CONFIG = 2147483649
EV_EVENT_TAG = 6
EV_INVALID = 4294967295
EV_IPL = 13
EV_IPL_PARTITION_DATA = 14
EV_NONHOST_CODE = 15
EV_NONHOST_CONFIG = 16
EV_NONHOST_INFO = 17
EV_NO_ACTION = 3
EV_OMIT_BOOT_DEVICE_EVENTS = 18
EV_PLATFORM_CONFIG_FLAGS = 10
EV_POST_CODE = 1
EV_PREBOOT_CERT = 0
EV_SEPARATOR = 4
EV_S_CRTM_CONTENTS = 7
EV_S_CRTM_VERSION = 8
EV_TABLE_OF_DEVICES = 11
EV_UNKNOWN_A = 2147483658
EV_UNKNOWN_B = 2147483659
EV_UNKNOWN_C = 2147483660
EV_UNUSED = 2
classmethod event_log_dict()

Class method to construct the event log dict

property log_type

Property for type of event log

classmethod log_type_string(value)

Get string of eventlog type

class ccnp.eventlog.eventlog_sdk.EventlogType

Bases: object

TYPE_TDX = 0
TYPE_TPM = 1
classmethod event_log_type_dict()

Class method to construct the event log typedict

classmethod is_valid_type(value)

Class method to check if value is a valid eventlog type

class ccnp.eventlog.eventlog_sdk.EventlogUtility(target='unix:/run/ccnp/uds/eventlog.sock')

Bases: object

Common utility for eventlog related actions

cleanup_channel()

Close the channel used for grpc

classmethod get_container_eventlog()

Get eventlogs from container perspective

get_eventlog() List[CCEventLogEntry]

Get eventlog function to fetch event logs

Returns:

list of CCEventLogEntry

Return type:

array

classmethod get_platform_eventlog(eventlog_type=0, start_position=None, count=None) List[CCEventLogEntry]

Get eventlogs from platform perspective. Currently, support eventlog fetching on Intel TDX and TPM.

Parameters:

eventlog_type (EventlogType) – type of eventlog to fetch

Returns:

list of CCEventlogEntry

Return type:

array

get_raw_eventlogs()

Get raw eventlogs

Parameters:
  • request (GetEventlogRequest) – request data

  • stub (EventlogStub) – the stub to call server

Returns:

json string of eventlogs

Return type:

string

parse_eventlogs(eventlogs) List[CCEventLogEntry]

Parse eventlog into CCEventLogEntry

Parameters:

eventlogs (dict) – raw eventlog data

Returns:

list of CCEventLogEntry

Return type:

array

parse_saas_eventlogs(eventlogs) List[CCEventLogEntry]

Parse SaaS level eventlog into CCEventLogEntry

Parameters:

eventlogs (dict) – raw eventlog data

Returns:

list of CCEventLogEntry

Return type:

array

setup_eventlog_request(eventlog_level=0, eventlog_category=0, start_position=None, count=None)

Generate grpc request to get eventlog

Module contents