OPENSSL:“ EVP_aria_256_ccm”通过使用lcrypto进行身份验证的加密

时间:2019-01-03 21:50:49

标签: openssl ccm

我需要使用 EVP_aria_256_ccd 加密邮件。然后,我以类似于openssl wiki的AES的示例编写了此代码。

const EVP_CIPHER *CIPHER_TYPE = EVP_aria_256_ccm();
EVP_CIPHER_CTX *ctx_encrypt = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX_init(ctx_encrypt);
if(EVP_EncryptInit_ex(ctx_encrypt, CIPHER_TYPE, NULL, NULL, NULL) != 1)
        return -1;
EVP_CIPHER_CTX_ctrl(ctx_encrypt, EVP_CTRL_CCM_SET_TAG, 16, NULL);
if(EVP_EncryptInit_ex(ctx_encrypt, NULL, NULL, key, iv) != 1)
         return -1;
if(EVP_EncryptUpdate(ctx_encrypt, NULL, &bytes, NULL, inlen) != 1)
         return -1;
if(EVP_EncryptUpdate(ctx_encrypt, NULL, &bytes, aad, aadl) != 1)
         return -1;
if(EVP_EncryptUpdate(ctx_encrypt, encryptedbuf, &bytes, in, inlen) != 1)
         return -1;
encryptlength = bytes;
if(EVP_EncryptFinal_ex(ctx_encrypt, encryptedbuf + bytes, &fin) != 1)
         return -1;
encryptlength+=fin;
if(EVP_CIPHER_CTX_ctrl(ctx_encrypt, EVP_CTRL_CCM_GET_TAG, 16, tag) !=1)
         return -1;

通过编译,我得到了:*

  

警告:函数“ EVP_aria_256_ccm”的隐式声明;你是否   是“ EVP_aes_256_ccm”的意思? [-Wimplicit函数声明] const   EVP_CIPHER * CIPHER_TYPE_ARIA = EVP_aria_256_ccm();                                         ^ ~~~~~~~~~~~~~~~                                         EVP_aes_256_ccm test.c:33:38:警告:初始化使指针从整数开始而没有强制转换   [-葡萄酒转化]   /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:   /tmp/ccQ0coOE.o:在函数main': test.c:(.text+0x1a): undefined reference to EVP_aria_256_ccm'

* 在我的实验室计算机上,运行 OpenSSL 1.1.0i-fips 2018年8月14日。是否可以使用EVP_aria?

0 个答案:

没有答案