Files
odkitee/oemcrypto_ta/tee_interfaces/clock_interface.h
2020-07-24 12:03:58 -07:00

43 lines
1.4 KiB
C

/* Copyright 2019 Google LLC. All Rights Reserved. This file and proprietary
source code may only be used and distributed under the Widevine Master
License Agreement. */
#ifndef OEMCRYPTO_TA_CLOCK_INTERFACE_H_
#define OEMCRYPTO_TA_CLOCK_INTERFACE_H_
#include "stdint.h"
#include "OEMCryptoCENC.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Calculates the system time at the time of call and modifies |time_in_s|.
TODO(b/158719238): This needs some design work. We should wrap this in
something that can upgrade the clock type to being monotonic over reboot.
TODO(b/158719238): Reword this paragraph to say what the real requirements
are:
This time does not need to be strictly increasing across
device reboots, but must be strictly increasing between calls to
OEMCrypto_Initialize and OEMCrypto_Terminate. This does not need to be time
since epoch. This does not need to start at 0 on boot.
If clock_type is not null, set *clock_type to the type of clock, as defined
in the OEMCrypto spec.
Returns OEMCrypto_ERROR_UNKNOWN_FAILURE on failure and OEMCrypto_SUCCESS on
success.
Returns OEMCrypto_ERROR_UNKNOWN_FAILURE if time_in_s is a null pointer.
Caller retains ownership of all pointers. */
OEMCryptoResult GetSystemTime(uint64_t* time_in_s,
OEMCrypto_Clock_Security_Level* clock_type);
#ifdef __cplusplus
}
#endif
#endif /* OEMCRYPTO_TA_CLOCK_INTERFACE_H_ */