請問產生真隨隨機數是不是需要一個物理信號?這個信號怎麼獲得呢?

發布於 2023-12-08 09:11:55

在調用 tls_crypto_trng() 函數時,在開始階段,是不是需要收到物理信號才會產生隨機數?那麼這端程序邏輯是什麼流程呢?如何搭配物理設備可以收到這個信號?現在有溫濕度傳感器,陀螺儀,氣壓傳感器。

image.png

image.png

image.png

查看更多

關注者
0
被浏覽
890
abcd
abcd 2024-04-18
我只是個路過的老年人~

g_crypto_ctx.gpsec_lock定義的是一個互斥鎖,在SDK的初始化時有調用tls_crypto_init,在這裡創建了該信號量,初始值是1,所以在沒有其他地方用到該模塊時,調用tls_os_sem_acquire(g_crypto_ctx.gpsec_lock, 0);會立即返回接著往下執行。如果有其他地方調用了就會等待,直到能獲取到信號量才能接著往下執行,起到一個互斥鎖的功能。調用tls_os_sem_acquire獲取,信號量的個數會減一,調用tls_os_sem_release釋放,信號量的個數會加一,這兩個接口是成對使用的。在使用信號量實現互斥鎖的功能時,創建信號量時初始值會設置為1,這樣有一個地方獲取了鎖的使用權後,其他地方就需要等待這裡釋放了才能獲取,起到防止出現同一個模塊或者變量或者接口被同時操作的情況。並不是一個物理信號。

2 個回答
AnatolSher
AnatolSher 認證專家 2023-12-08
Lover of the ocean, yachts and Arduino

Hello! SDK for w80x is still at the conceptual stage in our team.
We have not yet thoroughly understood how this pie works :)) For HAL 0.6.0, extracting true random numbers was easy. You can see this technique in our Arduino core. Methods trng_init() and rng_Get(). There is no need for a special signal to generate a random number. A noise-like signal is generated on the cryptomodule crystal. There is a description of this in the datasheet.

撰寫答案

請登錄後再發布答案,點擊登錄

發布
問題

分享
好友

手機
浏覽

掃碼手機浏覽