# crypto **Repository Path**: playepic/crypto ## Basic Information - **Project Name**: crypto - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-07 - **Last Updated**: 2025-04-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README **step1. pc端加密:** ``` #生成密钥(key & iv) openssl rand -hex 32 > key.txt openssl rand -hex 16 > iv.txt #将密钥转为头文件供解密代码使用 xxd -r -p key.txt | xxd -i - > key.h xxd -r -p iv.txt | xxd -i - > iv.h #对目标文件(input_file)进行加密,输出加密文件crypted_file openssl enc -aes-256-cbc -K $(cat key.txt) -iv $(cat iv.txt) -in input_file -out crypted_file ``` **step2. 编译cryptodev-linux,请将替换为编译环境的实际路径:** ``` git clone --depth 1 https://github.com/cryptodev-linux/cryptodev-linux.git cd cryptodev-linux export KERNEL_DIR= ARCH=arm64 CROSS_COMPILE=$KERNEL_DIR/../../crossgcc/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- make -j clean build # 编译生成cryptodev.ko,将此文件复制到平台rootfs中,并修改启动脚本使用modprobe或insmod在系统启动时自动加载此ko ``` **step3. 平台端解密代码,请参考decrypt.c**
此代码是将命令行指定的加密文件使用 **step1** 生成的key.h & iv.h调用cryptodev接口解密输出为out文件,请按实际需求进行修改