]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
accelerated: fix use of SSSE3 vpaes_encrypt
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 6 Feb 2018 03:39:39 +0000 (04:39 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 6 Feb 2018 05:15:56 +0000 (06:15 +0100)
Previously we assumed that the nettle GCM internal functions
will use the provided ECB function for single block encryption.
Newer versions no longer operate that way. Ensure that we
are compatible with them.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
lib/accelerated/x86/aes-gcm-x86-ssse3.c

index 512a8cffd7b4af976c094adafb2e8fab6c5ce0cf..52759f9b63ea4bc6c6be22928bc61dd5104ef672 100644 (file)
@@ -47,8 +47,14 @@ static void x86_aes_encrypt(const void *_ctx,
                                const uint8_t * src)
 {
        AES_KEY *ctx = (void*)_ctx;
+       unsigned i;
+       unsigned blocks = (length+15) / 16;
 
-       vpaes_encrypt(src, dst, ctx);
+       for (i=0;i<blocks;i++) {
+               vpaes_encrypt(src, dst, ctx);
+               dst += 16;
+               src += 16;
+       }
 }
 
 static void x86_aes_128_set_encrypt_key(void *_ctx,