Просмотр исходного кода

change: gmssl,删掉原有的rand_bytes函数,使用宏定义代理到luat_crypto_trng

Wendal Chen 5 месяцев назад
Родитель
Сommit
0d33ce588a
2 измененных файлов с 3 добавлено и 25 удалено
  1. 3 2
      components/gmssl/include/gmssl/rand.h
  2. 0 23
      components/gmssl/src/rand.c

+ 3 - 2
components/gmssl/include/gmssl/rand.h

@@ -25,8 +25,9 @@ Rand Public API
 	rand_bytes
 
 */
-
-_gmssl_export int rand_bytes(uint8_t *buf, size_t buflen);
+extern int luat_crypto_trng(char* buff, size_t len);
+#define rand_bytes(x, y) luat_crypto_trng((char*)x, y)
+// _gmssl_export int rand_bytes(uint8_t *buf, size_t buflen);
 
 
 #ifdef __cplusplus

+ 0 - 23
components/gmssl/src/rand.c

@@ -1,23 +0,0 @@
-/*
- *  Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
- *
- *  Licensed under the Apache License, Version 2.0 (the License); you may
- *  not use this file except in compliance with the License.
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- */
-
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <gmssl/rand.h>
-#include <gmssl/error.h>
-
-extern int luat_crypto_trng(char* buff, size_t len);
-
-LUAT_WEAK int rand_bytes(uint8_t *buf, size_t len)
-{
-	luat_crypto_trng((char*)buf, len);
-	return 1;
-}