@@ -5487,7 +5487,7 @@ def test_aes_cbc(self):
54875487 self .assertEqual (len (dec ), msglen * multiplier )
54885488 self .assertEqual (dec , msg * multiplier )
54895489
5490- @support .requires_linux_version (4 , 3 ) # see test_aes_cbc
5490+ @support .requires_linux_version (4 , 9 ) # see issue29324
54915491 def test_aead_aes_gcm (self ):
54925492 key = bytes .fromhex ('c939cc13397c1d37de6ae0e1cb7c423c' )
54935493 iv = bytes .fromhex ('b3d8cc017cbb89b39e0f67e2' )
@@ -5510,16 +5510,15 @@ def test_aead_aes_gcm(self):
55105510 op .sendmsg_afalg (op = socket .ALG_OP_ENCRYPT , iv = iv ,
55115511 assoclen = assoclen , flags = socket .MSG_MORE )
55125512 op .sendall (assoc , socket .MSG_MORE )
5513- op .sendall (plain , socket .MSG_MORE )
5514- op .sendall (b'\x00 ' * taglen )
5513+ op .sendall (plain )
55155514 res = op .recv (assoclen + len (plain ) + taglen )
55165515 self .assertEqual (expected_ct , res [assoclen :- taglen ])
55175516 self .assertEqual (expected_tag , res [- taglen :])
55185517
55195518 # now with msg
55205519 op , _ = algo .accept ()
55215520 with op :
5522- msg = assoc + plain + b' \x00 ' * taglen
5521+ msg = assoc + plain
55235522 op .sendmsg_afalg ([msg ], op = socket .ALG_OP_ENCRYPT , iv = iv ,
55245523 assoclen = assoclen )
55255524 res = op .recv (assoclen + len (plain ) + taglen )
@@ -5530,15 +5529,15 @@ def test_aead_aes_gcm(self):
55305529 pack_uint32 = struct .Struct ('I' ).pack
55315530 op , _ = algo .accept ()
55325531 with op :
5533- msg = assoc + plain + b' \x00 ' * taglen
5532+ msg = assoc + plain
55345533 op .sendmsg (
55355534 [msg ],
55365535 ([socket .SOL_ALG , socket .ALG_SET_OP , pack_uint32 (socket .ALG_OP_ENCRYPT )],
55375536 [socket .SOL_ALG , socket .ALG_SET_IV , pack_uint32 (len (iv )) + iv ],
55385537 [socket .SOL_ALG , socket .ALG_SET_AEAD_ASSOCLEN , pack_uint32 (assoclen )],
55395538 )
55405539 )
5541- res = op .recv (len (msg ))
5540+ res = op .recv (len (msg ) + taglen )
55425541 self .assertEqual (expected_ct , res [assoclen :- taglen ])
55435542 self .assertEqual (expected_tag , res [- taglen :])
55445543
@@ -5548,8 +5547,8 @@ def test_aead_aes_gcm(self):
55485547 msg = assoc + expected_ct + expected_tag
55495548 op .sendmsg_afalg ([msg ], op = socket .ALG_OP_DECRYPT , iv = iv ,
55505549 assoclen = assoclen )
5551- res = op .recv (len (msg ))
5552- self .assertEqual (plain , res [assoclen :- taglen ])
5550+ res = op .recv (len (msg ) - taglen )
5551+ self .assertEqual (plain , res [assoclen :])
55535552
55545553 @support .requires_linux_version (4 , 3 ) # see test_aes_cbc
55555554 def test_drbg_pr_sha256 (self ):
0 commit comments