luat_crypto_air101.c 478 B

123456789101112131415161718192021222324
  1. #include "string.h"
  2. #include "wm_include.h"
  3. #include "wm_crypto_hard.h"
  4. #include "aes.h"
  5. #include "luat_base.h"
  6. #include "luat_crypto.h"
  7. #define LUAT_LOG_TAG "crypto"
  8. #include "luat_log.h"
  9. #include "FreeRTOS.h"
  10. #include "task.h"
  11. static char trng_init = 0;
  12. int luat_crypto_trng(char* buff, size_t len) {
  13. tls_crypto_random_init(0, CRYPTO_RNG_SWITCH_32);
  14. vTaskDelay(1);
  15. tls_crypto_random_bytes_range(buff, len, 256);
  16. tls_crypto_random_stop();
  17. return 0;
  18. }