lib/crypto: verify 0 updates in aes_gcm_128 tests
authorStefan Metzmacher <metze@samba.org>
Thu, 27 Aug 2015 11:44:56 +0000 (13:44 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 27 Aug 2015 18:23:20 +0000 (20:23 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11451

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/crypto/aes_gcm_128_test.c

index f70d851..4b53487 100644 (file)
@@ -178,11 +178,17 @@ bool torture_local_crypto_aes_gcm_128(struct torture_context *torture)
 
                aes_gcm_128_init(&ctx, testarray[i].K.data, testarray[i].IV.data);
                for (j=0; j < testarray[i].A.length; j++) {
+                       aes_gcm_128_updateA(&ctx, NULL, 0);
                        aes_gcm_128_updateA(&ctx, &testarray[i].A.data[j], 1);
+                       aes_gcm_128_updateA(&ctx, NULL, 0);
                }
                for (j=0; j < C.length; j++) {
+                       aes_gcm_128_crypt(&ctx, NULL, 0);
+                       aes_gcm_128_updateC(&ctx, NULL, 0);
                        aes_gcm_128_crypt(&ctx, &C.data[j], 1);
                        aes_gcm_128_updateC(&ctx, &C.data[j], 1);
+                       aes_gcm_128_crypt(&ctx, NULL, 0);
+                       aes_gcm_128_updateC(&ctx, NULL, 0);
                }
                aes_gcm_128_digest(&ctx, T);
 
@@ -244,11 +250,17 @@ bool torture_local_crypto_aes_gcm_128(struct torture_context *torture)
 
                aes_gcm_128_init(&ctx, testarray[i].K.data, testarray[i].IV.data);
                for (j=0; j < testarray[i].A.length; j++) {
+                       aes_gcm_128_updateA(&ctx, NULL, 0);
                        aes_gcm_128_updateA(&ctx, &testarray[i].A.data[j], 1);
+                       aes_gcm_128_updateA(&ctx, NULL, 0);
                }
                for (j=0; j < P.length; j++) {
+                       aes_gcm_128_updateC(&ctx, NULL, 0);
+                       aes_gcm_128_crypt(&ctx, NULL, 0);
                        aes_gcm_128_updateC(&ctx, &P.data[j], 1);
                        aes_gcm_128_crypt(&ctx, &P.data[j], 1);
+                       aes_gcm_128_updateC(&ctx, NULL, 0);
+                       aes_gcm_128_crypt(&ctx, NULL, 0);
                }
                aes_gcm_128_digest(&ctx, T);