关于环境的安装大体命令如下,后续有时间整理,解决了个大BUG,真爽
git clone https://github.com/openssl/openssl.git
git checkout -b openssl-3.0 origin/openssl-3.0
./config
make update
make
make install
rm -rf /usr/bin/openssl
rm -rf /usr/include/openssl
rm -rf /usr/lib64/libssl.so
rm -rf /usr/lib64/libcrypto.so
rm -rf /usr/lib/libssl.so
rm -rf /usr/lib/libcrypto.so
ln -s /usr/local/bin/openssl /usr/bin/openssl
ln -s /usr/local/include/openssl /usr/include/openssl
ln -s /usr/local/lib64/libssl.so /usr/lib64/libssl.so
ln -s /usr/local/lib64/libcrypto.so /usr/lib64/libcrypto.so
ln -s /usr/local/lib64/libssl.so /usr/lib/libssl.so
ln -s /usr/local/lib64/libcrypto.so /usr/lib/libcrypto.so
直接贴代码了,抄作业了各位
/* Encrypt plaintext data using AES–128 in CTR mode. */
UInt32 aes_ctr_128b_encrypt(UInt8 *plaintext,
UInt8 plaintext_len,
UInt8 *skey,
UInt8 *aad,
UInt8 aad_len,
UInt8 **iv, // out (must free)
UInt8 *iv_len, // out
UInt8 **tag, // out (must free)
UInt8 *tag_len, // out
UInt8 **ciphertext, // out (must free)
UInt8 *ciphertext_len) // out
{
Int32 len