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

fix: 低版本mbedtls也没有mbedtls_cipher_info_get_mode

Wendal Chen 3 лет назад
Родитель
Сommit
87d89c2ecb
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      components/crypto/luat_crypto_mbedtls.c

+ 4 - 0
components/crypto/luat_crypto_mbedtls.c

@@ -49,7 +49,11 @@ int l_crypto_cipher_xxx(lua_State *L, uint8_t flags) {
     	LLOGW("%s not support", cipher);
         goto _error_exit;
     }
+#if MBEDTLS_VERSION_NUMBER >= 0x03000000
     mode = mbedtls_cipher_info_get_mode(_cipher);
+#else
+    mode = _cipher->mode;
+#endif
 
 	ret = mbedtls_cipher_setup(&ctx, _cipher);
     //LLOGD("mbedtls_cipher_setup %d", ret);