@@ -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);
650652end ;
651653
652654function TGCM.EncodeT128 (Value : T128): T128;
0 commit comments