Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement RTC timer in OP-TEE? #1352

Closed
JackyBai opened this issue Feb 14, 2017 · 4 comments
Closed

implement RTC timer in OP-TEE? #1352

JackyBai opened this issue Feb 14, 2017 · 4 comments

Comments

@JackyBai
Copy link
Contributor

hello all,

Is it necessary to implement a RTC timer in OP-TEE? Is there any example code as a reference ?

BR
Jacky Bai

@jforissier
Copy link
Contributor

Hi @JackyBai,

Short answer: yes, highly recommended.
Long answer: there is currently no RTC driver in OP-TEE. Because of this, the Trusted Application persistent time API (TEE_SetTAPersistentTime() and TEE_GetTAPersistentTime()) cannot comply with the GP specification, as the time origin set through this API it won't survive reboots.
In fact the TA persistent time implementation has two problems:

  1. It is not based on a RTC (not even the Normal World RTC)
  2. It does not use Trusted Storage to save the TA time origin (doing so would be useless without a RTC)

So in my opinion the "to-do" list on this topic is:

  1. Implement a secure RTC time source (maybe extend the time_source struct, add a flag to identify RTC vs non-RTC)
  2. Use this time source in tee_time_get_ta_time()
  3. Use secure storage so that TAs will properly save time on TEE_SetTAPersistentTime() and restore the time origin on first call to TEE_GetTAPersistentTime() (or upon TA initialization).

If you happen to have access to a platform that has a secure RTC and are willing to share code, that would be quite welcome and we can certainly help with the implementation and integration in the current code.

@ghost
Copy link

ghost commented Feb 15, 2017

We're closing this issue since the question has been answered. If you however feel that you have additional questions or still thinks this is an issue, please feel free to re-open the issue again.

@ghost ghost closed this as completed Feb 15, 2017
@MrVan
Copy link
Contributor

MrVan commented Feb 28, 2017

@jforissier
I have a few question regarding RTC in TEE. on i.MX6, there is SRTC and RTC in SNVS_LP and SNVS_HP. SRTC will always be functional even power off, RTC will be off when system power down.
Currently Linux use SRTC as the rtc device.

  • Is it correct that optee use SRTC, Linux use RTC?
  • Do we need to export SRTC to Linux, if SRTC is used by TEE? If not exported to Linux, how to set the value of SRTC?

Thanks

@railabouni
Copy link

hi all,
in regards to SRTC and OP-TEE (and trusted applications), in which use cases is SRTC needed (other than complying to the GP spec)? in which cases do we need real time and time differences (as in OP-TEE) are not enough?

Thank you!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants