请问产生真随随机数是不是需要一个物理信号?这个信号怎么获得呢?

发布于 2023-12-08 09:11:55

在调用 tls_crypto_trng() 函数时,在开始阶段,是不是需要收到物理信号才会产生随机数?那么这端程序逻辑是什么流程呢?如何搭配物理设备可以收到这个信号?现在有温湿度传感器,陀螺仪,气压传感器。

image.png

image.png

image.png

查看更多

关注者
0
被浏览
794
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.

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,这样有一个地方获取了锁的使用权后,其他地方就需要等待这里释放了才能获取,起到防止出现同一个模块或者变量或者接口被同时操作的情况。并不是一个物理信号。

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览