Closed qhbqyj closed 1 year ago
diff --git a/af_alg/af_alg_test.c b/af_alg/af_alg_test.c
index afd18a7..62049ec 100644
--- a/af_alg/af_alg_test.c
+++ b/af_alg/af_alg_test.c
@@ -46,16 +46,18 @@ static int openssl_aes(const unsigned char *buff, size_t off, size_t len, const
{
int out_len = sizeof(openssl_result);
- EVP_CIPHER_CTX en;
+ EVP_CIPHER_CTX *en;
+ en = EVP_CIPHER_CTX_new();
- EVP_CIPHER_CTX_init(&en);
+ EVP_CIPHER_CTX_init(en);
- EVP_EncryptInit_ex(&en, EVP_aes_128_cbc(), NULL, key, iv);
+ EVP_EncryptInit_ex(en, EVP_aes_128_cbc(), NULL, key, iv);
- EVP_CIPHER_CTX_set_padding(&en, 0);
+ EVP_CIPHER_CTX_set_padding(en, 0);
- EVP_EncryptUpdate(&en, openssl_result, &out_len, buff, len);
- EVP_CIPHER_CTX_cleanup(&en);
+ EVP_EncryptUpdate(en, openssl_result, &out_len, buff, len);
+ EVP_CIPHER_CTX_cleanup(en);
+ EVP_CIPHER_CTX_free(en);
return 0;
}
I am sorry, I didnt see that someone created an issue, I believed nobody was using my code. So just 3 years after it is fixed.
I tried to use it to understand which hash (crc32c
or xxhash
) might be faster for use with btrfs
. Unfortunately, af_alg_test
gave inconclusive results with e.g. crc32c
sometimes being faster than digest_null
, which is hard to believe.
Unfortunately, the kernel module no longer compiles (include file names seem to have changed) and I didn't have enough time to dig into this.
I think it's a useful project and it would be great if it worked on current machines.
I have the fix for the kernel modules, give me a few time for adding CI tests for it and I will publish the fixes
@sur5r benching BTRFS usage from AF_ALG is not the right way since BTRFS will uses algos inside kernel (AF_ALG is from user space). I think you should simply create a BTRFS partition and try some iozone/bonnie++/etc... bench on it.
[root@localhost cryptotest-master]# make Making all in af_alg make[1]: Entering directory
/root/Downloads/tpm/cryptotest-master/af_alg' gcc -DPACKAGE_NAME=\"cryptotest\" -DPACKAGE_TARNAME=\"cryptotest\" -DPACKAGE_VERSION=\"0.1\" -DPACKAGE_STRING=\"cryptotest\ 0.1\" -DPACKAGE_BUGREPORT=\"clabbe.montjoie@gmail.com\" -DPACKAGE_URL=\"\" -DPACKAGE=\"cryptotest\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_SOCKET=1 -DHAVE_STRERROR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOUL=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LINUX_IF_ALG_H=1 -I. -g -O2 -MT af_alg_test.o -MD -MP -MF .deps/af_alg_test.Tpo -c -o af_alg_test.o af_alg_test.c af_alg_test.c: In function ‘openssl_aes’: af_alg_test.c:49:17: error: storage size of ‘en’ isn’t known EVP_CIPHER_CTX en; ^ make[1]: *** [af_alg_test.o] Error 1 make[1]: Leaving directory
/root/Downloads/tpm/cryptotest-master/af_alg' make: *** [all-recursive] Error 1