|
|
中文 / EN
|
部分客户为保护存储在emmc中的模型不被非法拷贝,需要一种加密模型的方法来保护模型。Rockchip为用户提供了统一的数据加解密接口,每一台设备的加解密密钥都不相同,客户可以使用该接口加解密模型,黑客非法拷贝模型到其他设备上将无法正常运行。
使用该功能需要计算棒烧写v1.4.1及以上版本固件,或者使用sudo dnf update命令更新
按照“Wiki教程”-- “TB-RK1808S0”--“配置计算棒网络共享”确认计算棒可以正常联网
ssh toybrick@192.168.180.8登录计算棒
sudo dnf install rk-tee-service
vi test.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "rockchip/rk_tee_service_host.h" int main(int argc, char *argv[]) { int test_size = 64*1024+110; unsigned char *plaint = malloc(test_size); memset(plaint, 0x11, test_size); unsigned char *cipher = malloc(test_size); unsigned int cipher_len = test_size; unsigned char *plaint2 = malloc(test_size); unsigned int plaint2_len = test_size; rk_encrypt_data(plaint, test_size, cipher, &cipher_len); printf("cipher_len=%d\n", cipher_len); rk_decrypt_data(cipher, cipher_len, plaint2, &plaint2_len); printf("plaint2_len=%d\n", plaint2_len); if (memcmp(plaint, plaint2, plaint2_len) == 0) printf("success!\n"); else printf("fail!\n"); }
gcc test.c -o test -lrktee_service
sudo ./test