Skip to content

Commit be2ed3f

Browse files
committed
Merge remote-tracking branch 'origin/master' into development
2 parents 69002d4 + 0cc39b8 commit be2ed3f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Source/DECCipherModesGCM.pas

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,8 @@ procedure TGCM.DecodeGCM(Source, Dest: TBytes; Size: Integer);
608608
a_tag := XOR_T128(CalcGaloisHash(DataToAuthenticate, Source, Size), FE_K_Y0);
609609

610610
Setlength(FCalcAuthenticationTag, FCalcAuthenticationTagLength);
611-
Move(a_tag[0], FCalcAuthenticationTag[0], FCalcAuthenticationTagLength);
611+
if (FCalcAuthenticationTagLength > 0) then
612+
Move(a_tag[0], FCalcAuthenticationTag[0], FCalcAuthenticationTagLength);
612613

613614
// Check for correct authentication result is in Done of DECCipherModes
614615
// if not IsEqual(FExpectedAuthenticationTag, FCalcAuthenticationTag) then
@@ -646,7 +647,8 @@ procedure TGCM.EncodeGCM(Source, Dest: TBytes; Size: Integer);
646647

647648
AuthTag := XOR_T128(CalcGaloisHash(DataToAuthenticate, Dest, Size), FE_K_Y0);
648649
Setlength(FCalcAuthenticationTag, FCalcAuthenticationTagLength);
649-
Move(AuthTag[0], FCalcAuthenticationTag[0], FCalcAuthenticationTagLength);
650+
if (FCalcAuthenticationTagLength > 0) then
651+
Move(AuthTag[0], FCalcAuthenticationTag[0], FCalcAuthenticationTagLength);
650652
end;
651653

652654
function TGCM.EncodeT128(Value: T128): T128;

0 commit comments

Comments
 (0)