Files
oemcrypto/oemcrypto/opk/oemcrypto_ta/wtpi/wtpi_clock_interface_layer2.h
Fred Gylys-Colwell 0a16cb2594 Version 17 plus test updates and OPK v17
This is the first public release of OPK v17.
See the file CHANGELOG.md for details.
2022-04-13 19:36:27 -07:00

54 lines
1.5 KiB
C

/* 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 <stdint.h>
#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_ */