in src/local_gpu_verifier/src/verifier/nvml/gpu_cert_chains.py [0:0]
def get_gpu_certificate_chains(cls, handle):
""" A class method that fetches the GPU attestation certificate chain data in PEM format.
Args:
handle (pynvml.nvml.LP_struct_c_nvmlDevice_t): handle of the GPU.
Raises:
CertChainFetchError: raises exception if there is any problem while fetching the certificate chains.
Returns:
[bytes]: attestation certificate chain data.
"""
try:
cert_struct = function_wrapper_with_timeout([nvmlDeviceGetConfComputeGpuCertificate,
handle,
"nvmlDeviceGetConfComputeGpuCertificate"],
BaseSettings.MAX_NVML_TIME_DELAY)
# fetching the attestation cert chain.
length_of_attestation_cert_chain = cert_struct.attestationCertChainSize
attestation_cert_chain = cert_struct.attestationCertChain
attestation_cert_data = list()
for i in range(length_of_attestation_cert_chain):
attestation_cert_data.append(attestation_cert_chain[i])
bin_attestation_cert_data = bytes(attestation_cert_data)
return bin_attestation_cert_data
except TimeoutError as err:
raise TimeoutError("\tThe call to fetch GPU Cert chain timed out.")
except Exception as err:
info_log.error(err)
err_msg = "\tSomething went wrong while fetching the certificate chains from the gpu."
event_log.error(err_msg)
raise CertChainFetchError(err_msg)