/* Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary source code may only be used and distributed under the Widevine License Agreement. */ #ifndef OEMCRYPTO_TA_WTPI_CLOCK_INTERFACE_LAYER2_H_ #define OEMCRYPTO_TA_WTPI_CLOCK_INTERFACE_LAYER2_H_ #include #include "OEMCryptoCENC.h" #ifdef __cplusplus extern "C" { #endif /** @defgroup secure-timer Non-monotonic Secure Clock * * Partners implementing a porting layer may either * 1. Implement wtpi_persistent_storage_layer2.h and this * wtpi_clock_interface_layer2.h, and then use the reference implementation * wtpi_clock_and_gn_layer1.c for the clock and generation interfaces. This * is preferred if the hardware secure timer resets to 0 whenever the device * is inactive. * or * 2. Implement both wtpi_clock_interface_layer1.h and * wtpi_generation_number_interface.h. This is preferred if the system has a * hardware secure wall clock. * * @{ */ /** * Retrieves the value of the secure timer and stores it in |time_in_s|. * * This timer should be secure and monotonic, but we allow it to reset to * 0 whenever the system reboots. * * Caller retains ownership of all pointers. * * @param[out] time_in_s: pointer to system time, in seconds. * * @retval OEMCrypto_ERROR_INVALID_CONTEXT if time_in_s is a null pointer * @retval OEMCrypto_SUCCESS on success */ OEMCryptoResult WTPI_GetSecureTimer(uint64_t* time_in_s); /// @} #ifdef __cplusplus } #endif #endif /* OEMCRYPTO_TA_WTPI_CLOCK_INTERFACE_LAYER2_H_ */