]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/crypto/isa-l/isa-l_crypto/aes/xts_128_enc_ossl_perf.c
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / crypto / isa-l / isa-l_crypto / aes / xts_128_enc_ossl_perf.c
index 7c6a445e3942838d86a5e6ad420d42590e5d29f3..69ae2e60edc72a0570463c3e3444962dac4b9cbb 100644 (file)
@@ -2,7 +2,7 @@
   Copyright(c) 2011-2016 Intel Corporation All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions 
+  modification, are permitted provided that the following conditions
   are met:
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
@@ -90,8 +90,8 @@ int main(void)
        unsigned char keyssl[32];       /* SSL takes both keys together */
 
        /* Initialise our cipher context, which can use same input vectors */
-       EVP_CIPHER_CTX ctx;
-       EVP_CIPHER_CTX_init(&ctx);
+       EVP_CIPHER_CTX *ctx;
+       ctx = EVP_CIPHER_CTX_new();
 
        printf("aes_xts_128_enc_perf:\n");
 
@@ -114,7 +114,7 @@ int main(void)
 
        /* Encrypt and compare output */
        XTS_AES_128_enc(key2, key1, tinit, TEST_LEN, pt, ct);
-       openssl_aes_128_xts_enc(&ctx, keyssl, tinit, TEST_LEN, pt, refct);
+       openssl_aes_128_xts_enc(ctx, keyssl, tinit, TEST_LEN, pt, refct);
        if (memcmp(ct, refct, TEST_LEN)) {
                printf("ISA-L and OpenSSL results don't match\n");
                return -1;
@@ -132,11 +132,13 @@ int main(void)
        /* Time OpenSSL encryption */
        perf_start(&start);
        for (i = 0; i < TEST_LOOPS; i++)
-               openssl_aes_128_xts_enc(&ctx, keyssl, tinit, TEST_LEN, pt, refct);
+               openssl_aes_128_xts_enc(ctx, keyssl, tinit, TEST_LEN, pt, refct);
        perf_stop(&stop);
 
        printf("aes_xts_128_openssl_enc" TEST_TYPE_STR ": ");
        perf_print(stop, start, (long long)TEST_LEN * i);
 
+       EVP_CIPHER_CTX_free(ctx);
+
        return 0;
 }