Browse Source

add: 添加rsa库的编译,测试可用

Wendal Chen 3 years ago
parent
commit
0c18560737
4 changed files with 14 additions and 6 deletions
  1. 3 0
      app/port/luat_base_air101.c
  2. 2 0
      app/port/luat_conf_bsp.h
  3. 6 6
      app/port/mbedtls_config.h
  4. 3 0
      xmake.lua

+ 3 - 0
app/port/luat_base_air101.c

@@ -202,6 +202,9 @@ static const luaL_Reg loadedlibs[] = {
 #endif
 #ifdef LUAT_USE_IOTAUTH
   {"iotauth", luaopen_iotauth},
+#endif
+#ifdef LUAT_USE_RSA
+  {"rsa", luaopen_rsa},
 #endif
   {NULL, NULL}
 };

+ 2 - 0
app/port/luat_conf_bsp.h

@@ -78,6 +78,8 @@
 // zlib压缩,更快更小的实现
 #define LUAT_USE_MINIZ 1
 
+#define LUAT_USE_RSA 1
+
 // // 使用 TLSF 内存池, 实验性, 内存利用率更高一些
 // #define LUAT_USE_TLSF 1
 

+ 6 - 6
app/port/mbedtls_config.h

@@ -1038,7 +1038,7 @@
  *
  * This enables support for PKCS#1 v1.5 operations.
  */
-// #define MBEDTLS_PKCS1_V15
+#define MBEDTLS_PKCS1_V15
 
 /**
  * \def MBEDTLS_PKCS1_V21
@@ -1694,7 +1694,7 @@
  *          library/pkcs5.c
  *          library/pkparse.c
  */
-// #define MBEDTLS_ASN1_PARSE_C
+#define MBEDTLS_ASN1_PARSE_C
 
 /**
  * \def MBEDTLS_ASN1_WRITE_C
@@ -2229,7 +2229,7 @@
  *
  * This modules adds support for decoding / parsing PEM files.
  */
-// #define MBEDTLS_PEM_PARSE_C
+#define MBEDTLS_PEM_PARSE_C
 
 /**
  * \def MBEDTLS_PEM_WRITE_C
@@ -2261,7 +2261,7 @@
  *
  * Uncomment to enable generic public key wrappers.
  */
-// #define MBEDTLS_PK_C
+#define MBEDTLS_PK_C
 
 /**
  * \def MBEDTLS_PK_PARSE_C
@@ -2276,7 +2276,7 @@
  *
  * Uncomment to enable generic public key parse functions.
  */
-// #define MBEDTLS_PK_PARSE_C
+#define MBEDTLS_PK_PARSE_C
 
 /**
  * \def MBEDTLS_PK_WRITE_C
@@ -2384,7 +2384,7 @@
  *
  * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C
  */
-// #define MBEDTLS_RSA_C
+#define MBEDTLS_RSA_C
 
 /**
  * \def MBEDTLS_SHA1_C

+ 3 - 0
xmake.lua

@@ -421,6 +421,9 @@ target("air10x")
     
     add_includedirs(luatos.."components/nimble/inc")
     add_files(luatos.."components/nimble/src/*.c")
+    
+    add_includedirs(luatos.."components/rsa/inc")
+    add_files(luatos.."components/rsa/**.c")
 
 	after_build(function(target)
         sdk_dir = target:toolchains()[1]:sdkdir().."/"