2018-02-17 12:35 GMT+03:00 Niels Möller <[email protected]>:
> Dmitry Eremin-Solenikov <[email protected]> writes:
>
>> For benchmarking purposes provide wrappers around OpenSSL AES GCM
>> implementation. Note, digest callback will work only for encryption due
>> to OpenSSL internals.
>
> This patch and the next now merged to master-updates.

Thank you!

>
>> @@ -80,7 +80,7 @@ openssl_evp_set_encrypt_key(void *p, const uint8_t *key,
>>  {
>>    struct openssl_cipher_ctx *ctx = p;
>>    ctx->evp = EVP_CIPHER_CTX_new();
>> -  assert(EVP_EncryptInit_ex(ctx->evp, cipher, NULL, key, NULL) == 1);
>> +  assert(EVP_CipherInit_ex(ctx->evp, cipher, NULL, key, NULL, 1) == 1);
>>    EVP_CIPHER_CTX_set_padding(ctx->evp, 0);
>>  }
>
> It's not right to use assert on expressions with side-effects. Since will
> break builds with ./configure CFLAGS='-DNDEBUG'.
>
> One would need to either assign return value to a variable and assert on
> that, or define some alternative assert-like makro which always
> evaluates its argument.

I've sent a followup patch with an additional variable. It is easier
to maintain.


Regarding the numbers, here is what I see on my laptop (i3-4005U):

libnettle: fat library initialization.
libnettle: cpu features: vendor:intel,aesni
libnettle: using aes instructions.
libnettle: not using sha_ni instructions.
libnettle: intel SSE2 will be used for memxor.
sha1_compress: 463.20 cycles
salsa20_core: 403.70 cycles
sha3_permute: 1838.10 cycles (76.59 / round)

benchmark call overhead: 0.003764 us   6.02 cycles

         Algorithm         mode Mbyte/s cycles/byte cycles/block
      poly1305-aes       update  951.68        1.60      1641.84

            aes128  ECB encrypt 2328.39        0.66        10.49
            aes128  ECB decrypt 1850.82        0.82        13.19
            aes128  CBC encrypt  267.16        5.71        91.38
            aes128  CBC decrypt 2015.34        0.76        12.11
            aes128   (in-place) 1598.20        0.95        15.28
            aes128          CTR 1683.51        0.91        14.50
            aes128   (in-place) 1343.33        1.14        18.17

            aes192  ECB encrypt 1695.07        0.90        14.40
            aes192  ECB decrypt 1737.14        0.88        14.05
            aes192  CBC encrypt  231.50        6.59       105.46
            aes192  CBC decrypt 1548.88        0.99        15.76
            aes192   (in-place) 1290.06        1.18        18.92
            aes192          CTR 1349.77        1.13        18.09
            aes192   (in-place) 1135.87        1.34        21.49

            aes256  ECB encrypt 1462.52        1.04        16.69
            aes256  ECB decrypt 1371.13        1.11        17.81
            aes256  CBC encrypt  204.46        7.46       119.41
            aes256  CBC decrypt 1296.66        1.18        18.83
            aes256   (in-place) 1056.29        1.44        23.11
            aes256          CTR 1123.06        1.36        21.74
            aes256   (in-place)  981.12        1.56        24.88

    openssl aes128  ECB encrypt 2308.04        0.66        10.58
    openssl aes128  ECB decrypt 2294.12        0.67        10.64

    openssl aes192  ECB encrypt 1929.11        0.79        12.66
    openssl aes192  ECB decrypt 1926.87        0.79        12.67

    openssl aes256  ECB encrypt 1653.41        0.92        14.77
    openssl aes256  ECB decrypt 1666.08        0.92        14.65

        gcm_aes128      encrypt  200.26        7.62       121.91
        gcm_aes128      decrypt  200.26        7.62       121.91
        gcm_aes128       update  240.93        6.33       101.33

        gcm_aes192      encrypt  193.38        7.89       126.25
        gcm_aes192      decrypt  194.50        7.85       125.52
        gcm_aes192       update  241.02        6.33       101.29

        gcm_aes256      encrypt  189.66        8.05       128.73
        gcm_aes256      decrypt  189.74        8.04       128.67
        gcm_aes256       update  240.14        6.35       101.67

openssl gcm_aes128      encrypt 1492.12        1.02        16.36
openssl gcm_aes128      decrypt 1496.77        1.02        16.31
openssl gcm_aes128       update 3683.07        0.41         6.63

openssl gcm_aes192      encrypt 1308.33        1.17        18.66
openssl gcm_aes192      decrypt 1315.36        1.16        18.56
openssl gcm_aes192       update 3662.13        0.42         6.67

openssl gcm_aes256      encrypt 1170.64        1.30        20.86
openssl gcm_aes256      decrypt 1173.83        1.30        20.80
openssl gcm_aes256       update 3489.30        0.44         7.00


-- 
With best wishes
Dmitry
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to