{"action":"created","issue":{"url":"https://api.github.com/repos/contiki-os/contiki/issues/1727","repository_url":"https://api.github.com/repos/contiki-os/contiki","labels_url":"https://api.github.com/repos/contiki-os/contiki/issues/1727/labels{/name}","comments_url":"https://api.github.com/repos/contiki-os/contiki/issues/1727/comments","events_url":"https://api.github.com/repos/contiki-os/contiki/issues/1727/events","html_url":"https://github.com/contiki-os/contiki/pull/1727","id":160295160,"number":1727,"title":"Add CC13xx/CC26xx TRNG Support","user":{"login":"g-oikonomou","id":705207,"avatar_url":"https://avatars.githubusercontent.com/u/705207?v=3","gravatar_id":"","url":"https://api.github.com/users/g-oikonomou","html_url":"https://github.com/g-oikonomou","followers_url":"https://api.github.com/users/g-oikonomou/followers","following_url":"https://api.github.com/users/g-oikonomou/following{/other_user}","gists_url":"https://api.github.com/users/g-oikonomou/gists{/gist_id}","starred_url":"https://api.github.com/users/g-oikonomou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/g-oikonomou/subscriptions","organizations_url":"https://api.github.com/users/g-oikonomou/orgs","repos_url":"https://api.github.com/users/g-oikonomou/repos","events_url":"https://api.github.com/users/g-oikonomou/events{/privacy}","received_events_url":"https://api.github.com/users/g-oikonomou/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/contiki-os/contiki/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/contiki-os/contiki/labels/Platform%20/%20CPU%20/%20ARM%20/%20CC13xx-CC26xx","name":"Platform / CPU / ARM / CC13xx-CC26xx","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-14T22:04:26Z","updated_at":"2016-07-04T11:39:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/contiki-os/contiki/pulls/1727","html_url":"https://github.com/contiki-os/contiki/pull/1727","diff_url":"https://github.com/contiki-os/contiki/pull/1727.diff","patch_url":"https://github.com/contiki-os/contiki/pull/1727.patch"},"body":"This pull request adds support for the CC13xx/CC26xx hardware RNG.\r\n\r\nThe hardware has 24 free-running oscillators (FROs) and generates random numbers by sampling them. The longer we let the hardware sample the FROs, the more entropy we will get in our random number. Thus, the hardware can generate low-entropy random numbers super quickly, or it can generate high-entropy random numbers, but this takes longer.\r\n\r\nIn this context, the driver can work in two modes:\r\n\r\n* Synchronous mode: We issue a request to the hardware to generate a new, minimum-entropy random number and we block till it's ready. This function is thread-safe and can be called from inside an interrupt context. It is recommended to use this mode when a low-entropy number is required and therefore generation can be performed quickly. \r\n* Asynchronous: We issue a request to the RNG to generate a number with configurable degree of entropy and we return immediately. Once the number is ready, the caller will be notified through a callback. This mode is recommended for random numbers of higher entropy. This call should not be made from within an interrupt context. While generation is in progress, the driver will allow CM3 to sleep, but it will prohibit Deep Sleep.\r\n\r\nOnly one asynchronous generation can be in progress at any given point in time. If a request is made while a previous one is still in progress, the new request will be rejected.\r\n\r\nBefore an asynchronous generation starts, the driver will cache a small number of randoms. If a synchronous request is made while an asynchronous generation is in progress, the synchronous call will return one of those cached numbers. The number of randoms to be cached is configurable through `SOC_TRNG_CONF_CACHE_LEN`.\r\n\r\nAsynchronous mode accepts the `samples` argument, which basically controls the amount of time the RNG will spend sampling the FROs. Minimum entropy can be achieved when `samples` is `SOC_TRNG_REFILL_CYCLES_MIN` and this will take about 1.5usecs to generate a number. Increasing the value of `samples` will increase entropy, but it will also increase latency. Maximum entropy is achieved when the value of `samples` is 0 (`SOC_TRNG_REFILL_CYCLES_MAX`), in which case generation takes approximately 350msec.\r\n\r\nThe intended usage is for synchronous mode to be used when we need a low-entropy number very quickly. These numbers are suitable for retransmission back-offs etc, but not suitable for crypto operations. When a high-entropy number is required, it is recommended to use asynchronous mode.\r\n\r\nWith all of this in place, this pull also implements the random API. `random_rand()` will use synchronous mode and will return the 2 LS bytes of the generated number. \r\n\r\nCloses #1238"},"comment":{"url":"https://api.github.com/repos/contiki-os/contiki/issues/comments/230271292","html_url":"https://github.com/contiki-os/contiki/pull/1727#issuecomment-230271292","issue_url":"https://api.github.com/repos/contiki-os/contiki/issues/1727","id":230271292,"user":{"login":"atiselsts","id":3797089,"avatar_url":"https://avatars.githubusercontent.com/u/3797089?v=3","gravatar_id":"","url":"https://api.github.com/users/atiselsts","html_url":"https://github.com/atiselsts","followers_url":"https://api.github.com/users/atiselsts/followers","following_url":"https://api.github.com/users/atiselsts/following{/other_user}","gists_url":"https://api.github.com/users/atiselsts/gists{/gist_id}","starred_url":"https://api.github.com/users/atiselsts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atiselsts/subscriptions","organizations_url":"https://api.github.com/users/atiselsts/orgs","repos_url":"https://api.github.com/users/atiselsts/repos","events_url":"https://api.github.com/users/atiselsts/events{/privacy}","received_events_url":"https://api.github.com/users/atiselsts/received_events","type":"User","site_admin":false},"created_at":"2016-07-04T11:39:42Z","updated_at":"2016-07-04T11:39:42Z","body":":+1: \r\n\r\nI like that after reboot `random_rand()` does not return the same sequence of numbers anymore."}}
{"actor":{"display_login":"atiselsts"}}