diff --git a/CryptoLib/src/Crypto/Bip327/ClpBip327MuSig2.pas b/CryptoLib/src/Crypto/Bip327/ClpBip327MuSig2.pas index 507ed777..977a083b 100644 --- a/CryptoLib/src/Crypto/Bip327/ClpBip327MuSig2.pas +++ b/CryptoLib/src/Crypto/Bip327/ClpBip327MuSig2.pas @@ -410,7 +410,7 @@ class function TBip327MuSig2.Sign(const ADomain: IECDomainParameters; LK2Orig := TBigInteger.Create(1, System.Copy(ASecNonce, 32, 32)); LK1 := LK1Orig; LK2 := LK2Orig; - TArrayUtilities.Fill(ASecNonce, 0, 64, Byte(0)); + TArrayUtilities.Fill(ASecNonce, 0, 64, Byte(0)); if (LK1.SignValue <= 0) or (LK1.CompareTo(LN) >= 0) then Exit; if (LK2.SignValue <= 0) or (LK2.CompareTo(LN) >= 0) then diff --git a/CryptoLib/src/Crypto/Bip327/ClpBip327MuSig2KeyAggregation.pas b/CryptoLib/src/Crypto/Bip327/ClpBip327MuSig2KeyAggregation.pas index 0340a5f0..5b5c8a90 100644 --- a/CryptoLib/src/Crypto/Bip327/ClpBip327MuSig2KeyAggregation.pas +++ b/CryptoLib/src/Crypto/Bip327/ClpBip327MuSig2KeyAggregation.pas @@ -317,7 +317,7 @@ class function TBip327MuSig2KeyAggregation.GetSecondKey(const APubKeys: TCryptoL Exit; end; System.SetLength(Result, TBip327MuSig2Utilities.BIP327_PLAIN_PUBKEY_SIZE); - TArrayUtilities.Fill(Result, 0, System.Length(Result), Byte(0)); + TArrayUtilities.Fill(Result, 0, System.Length(Result), Byte(0)); end; class function TBip327MuSig2KeyAggregation.KeyAggCoeffInternal(const APubKeys: TCryptoLibGenericArray; diff --git a/CryptoLib/src/Crypto/Bip340/ClpBip340SchnorrBatchVerifier.pas b/CryptoLib/src/Crypto/Bip340/ClpBip340SchnorrBatchVerifier.pas index 636b083d..a8b01f14 100644 --- a/CryptoLib/src/Crypto/Bip340/ClpBip340SchnorrBatchVerifier.pas +++ b/CryptoLib/src/Crypto/Bip340/ClpBip340SchnorrBatchVerifier.pas @@ -194,13 +194,13 @@ class function TBip340SchnorrBatchVerifier.BatchVerify(const AItems if (LU > 1) then begin System.SetLength(LZeroIV, 12); - TArrayUtilities.Fill(LZeroIV, 0, 12, Byte(0)); + TArrayUtilities.Fill(LZeroIV, 0, 12, Byte(0)); LKeyParam := TKeyParameter.Create(LSeed); LParams := TParametersWithIV.Create(LKeyParam, LZeroIV); LCipher := TCipherUtilities.GetCipher('CHACHA7539'); LCipher.Init(True, LParams); System.SetLength(LZeros, 32); - TArrayUtilities.Fill(LZeros, 0, 32, Byte(0)); + TArrayUtilities.Fill(LZeros, 0, 32, Byte(0)); System.SetLength(LBlock, 32); LJ := 0; while LJ < (LU - 1) do diff --git a/CryptoLib/src/Crypto/ClpBufferedAsymmetricBlockCipher.pas b/CryptoLib/src/Crypto/ClpBufferedAsymmetricBlockCipher.pas index 984474f1..9a7044e1 100644 --- a/CryptoLib/src/Crypto/ClpBufferedAsymmetricBlockCipher.pas +++ b/CryptoLib/src/Crypto/ClpBufferedAsymmetricBlockCipher.pas @@ -232,7 +232,7 @@ procedure TBufferedAsymmetricBlockCipher.Reset; begin if FBuffer <> nil then begin - TArrayUtilities.Fill(FBuffer, 0, System.Length(FBuffer), Byte(0)); + TArrayUtilities.Fill(FBuffer, 0, System.Length(FBuffer), Byte(0)); FBufOff := 0; end; end; diff --git a/CryptoLib/src/Crypto/ClpBufferedBlockCipher.pas b/CryptoLib/src/Crypto/ClpBufferedBlockCipher.pas index 20f4117e..949b1ed5 100644 --- a/CryptoLib/src/Crypto/ClpBufferedBlockCipher.pas +++ b/CryptoLib/src/Crypto/ClpBufferedBlockCipher.pas @@ -587,7 +587,7 @@ function TBufferedBlockCipher.ProcessBytes(const AInput: TCryptoLibByteArray; procedure TBufferedBlockCipher.Reset; begin - TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); + TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); FBufOff := 0; FCipherMode.Reset(); diff --git a/CryptoLib/src/Crypto/ClpLib25519.pas b/CryptoLib/src/Crypto/ClpLib25519.pas index 3a873a45..531ac712 100644 --- a/CryptoLib/src/Crypto/ClpLib25519.pas +++ b/CryptoLib/src/Crypto/ClpLib25519.pas @@ -229,7 +229,7 @@ class function TLib25519.SignOpen(const AM: TCryptoLibByteArray; AMOff: Int32; o if not FEd25519.Verify(ASignedMsg, ASignedMsgOff, APk, APkOff, ASignedMsg, ASignedMsgOff + SignBytes, LMlen) then begin - TArrayUtilities.Fill(AM, AMOff, AMOff + ASignedMsgLen, 0); + TArrayUtilities.Fill(AM, AMOff, AMOff + ASignedMsgLen, 0); AMlen := -1; Exit(False); end; diff --git a/CryptoLib/src/Crypto/ClpPbeUtilities.pas b/CryptoLib/src/Crypto/ClpPbeUtilities.pas index 4a76046b..c90a1356 100644 --- a/CryptoLib/src/Crypto/ClpPbeUtilities.pas +++ b/CryptoLib/src/Crypto/ClpPbeUtilities.pas @@ -722,7 +722,7 @@ class function TPbeUtilities.GenerateCipherParameters(const AAlgorithm: String; LParameters := LGenerator.GenerateDerivedMacParameters(LBitLen); end; - TArrayUtilities.Fill(LKeyBytes, 0, System.Length(LKeyBytes), Byte(0)); + TArrayUtilities.Fill(LKeyBytes, 0, System.Length(LKeyBytes), Byte(0)); Result := LParameters; end; diff --git a/CryptoLib/src/Crypto/Encodings/ClpOaepEncoding.pas b/CryptoLib/src/Crypto/Encodings/ClpOaepEncoding.pas index a1bd35db..492e3d5c 100644 --- a/CryptoLib/src/Crypto/Encodings/ClpOaepEncoding.pas +++ b/CryptoLib/src/Crypto/Encodings/ClpOaepEncoding.pas @@ -242,7 +242,7 @@ function TOaepEncoding.DecodeBlock(const AInBytes: TCryptoLibByteArray; LCopyLen := System.Length(LBlock); System.Move(LData[0], LBlock[System.Length(LBlock) - LCopyLen], LCopyLen); - TArrayUtilities.Fill(LData, 0, System.Length(LData), Byte(0)); + TArrayUtilities.Fill(LData, 0, System.Length(LData), Byte(0)); FMgf1Hash.Reset(); @@ -271,7 +271,7 @@ function TOaepEncoding.DecodeBlock(const AInBytes: TCryptoLibByteArray; if LWrongMask <> 0 then begin - TArrayUtilities.Fill(LBlock, 0, System.Length(LBlock), Byte(0)); + TArrayUtilities.Fill(LBlock, 0, System.Length(LBlock), Byte(0)); raise EInvalidCipherTextCryptoLibException.CreateRes(@SDataWrong); end; @@ -279,7 +279,7 @@ function TOaepEncoding.DecodeBlock(const AInBytes: TCryptoLibByteArray; SetLength(Result, System.Length(LBlock) - LStart); System.Move(LBlock[LStart], Result[0], System.Length(Result)); - TArrayUtilities.Fill(LBlock, 0, System.Length(LBlock), Byte(0)); + TArrayUtilities.Fill(LBlock, 0, System.Length(LBlock), Byte(0)); end; procedure TOaepEncoding.MaskGeneratorFunction( diff --git a/CryptoLib/src/Crypto/Encodings/ClpPkcs1Encoding.pas b/CryptoLib/src/Crypto/Encodings/ClpPkcs1Encoding.pas index 3a04272b..43a4ba36 100644 --- a/CryptoLib/src/Crypto/Encodings/ClpPkcs1Encoding.pas +++ b/CryptoLib/src/Crypto/Encodings/ClpPkcs1Encoding.pas @@ -387,7 +387,7 @@ function TPkcs1Encoding.DecodeBlockOrRandom(const AInput: TCryptoLibByteArray; end; // Clear sensitive data - TArrayUtilities.Fill(LBlock, 0, System.Length(LBlock), Byte(0)); + TArrayUtilities.Fill(LBlock, 0, System.Length(LBlock), Byte(0)); end; function TPkcs1Encoding.DecodeBlock(const AInput: TCryptoLibByteArray; @@ -435,8 +435,8 @@ function TPkcs1Encoding.DecodeBlock(const AInput: TCryptoLibByteArray; System.Move(LData[System.Length(LData) - LPlaintextLength], Result[0], LPlaintextLength); finally // Clear sensitive data - TArrayUtilities.Fill(LBlock, 0, System.Length(LBlock), Byte(0)); - TArrayUtilities.Fill(FBlockBuffer, 0, Math.Max(0, System.Length(FBlockBuffer) - System.Length(LBlock)), Byte(0)); + TArrayUtilities.Fill(LBlock, 0, System.Length(LBlock), Byte(0)); + TArrayUtilities.Fill(FBlockBuffer, 0, Math.Max(0, System.Length(FBlockBuffer) - System.Length(LBlock)), Byte(0)); end; end; diff --git a/CryptoLib/src/Crypto/Engines/ClpAesEngine.pas b/CryptoLib/src/Crypto/Engines/ClpAesEngine.pas index d360de4d..58ddfa40 100644 --- a/CryptoLib/src/Crypto/Engines/ClpAesEngine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpAesEngine.pas @@ -508,7 +508,7 @@ function TAesEngine.GenerateWorkingKey(AForEncryption: Boolean; LKeyLen := System.Length(AKey); if ((LKeyLen < 16) or (LKeyLen > 32) or ((LKeyLen and 7) <> 0)) then begin - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); raise EArgumentCryptoLibException.CreateRes(@SInvalidKeyLength); end; @@ -684,7 +684,7 @@ function TAesEngine.GenerateWorkingKey(AForEncryption: Boolean; end else begin - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); raise EInvalidOperationCryptoLibException.CreateRes(@SInvalidOperation); end; end; @@ -703,7 +703,7 @@ function TAesEngine.GenerateWorkingKey(AForEncryption: Boolean; Result := LBigW; - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); end; function TAesEngine.GetAlgorithmName: String; diff --git a/CryptoLib/src/Crypto/Engines/ClpAesEngineX86.pas b/CryptoLib/src/Crypto/Engines/ClpAesEngineX86.pas index fd749c46..f8575d1e 100644 --- a/CryptoLib/src/Crypto/Engines/ClpAesEngineX86.pas +++ b/CryptoLib/src/Crypto/Engines/ClpAesEngineX86.pas @@ -865,7 +865,7 @@ procedure TAesEngineX86.CreateRoundKeys(AForEncryption: Boolean; LKeyLen := System.Length(AKey); if ((LKeyLen < 16) or (LKeyLen > 32) or ((LKeyLen and 7) <> 0)) then begin - TArrayUtilities.Fill(AKey, 0, LKeyLen, Byte(0)); + TArrayUtilities.Fill(AKey, 0, LKeyLen, Byte(0)); raise EArgumentCryptoLibException.CreateRes(@SInvalidKeyLength); end; @@ -888,7 +888,7 @@ procedure TAesEngineX86.CreateRoundKeys(AForEncryption: Boolean; AesNiExpandRoundKeys256(@AKey[0], LK); end; else - TArrayUtilities.Fill(AKey, 0, LKeyLen, Byte(0)); + TArrayUtilities.Fill(AKey, 0, LKeyLen, Byte(0)); raise EArgumentCryptoLibException.CreateRes(@SInvalidKeyLength); end; @@ -1014,7 +1014,7 @@ procedure TAesEngineX86.Init(AForEncryption: Boolean; CreateRoundKeys(AForEncryption, LKeyCopy); BindCipherPointers; finally - TArrayUtilities.Fill(LKeyCopy, 0, System.Length(LKeyCopy), Byte(0)); + TArrayUtilities.Fill(LKeyCopy, 0, System.Length(LKeyCopy), Byte(0)); end; end; diff --git a/CryptoLib/src/Crypto/Engines/ClpAesLightEngine.pas b/CryptoLib/src/Crypto/Engines/ClpAesLightEngine.pas index 87249bad..ce84ffdc 100644 --- a/CryptoLib/src/Crypto/Engines/ClpAesLightEngine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpAesLightEngine.pas @@ -421,7 +421,7 @@ function TAesLightEngine.GenerateWorkingKey(AForEncryption: Boolean; LKeyLen := System.Length(AKey); if ((LKeyLen < 16) or (LKeyLen > 32) or ((LKeyLen and 7) <> 0)) then begin - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); raise EArgumentCryptoLibException.CreateRes(@SInvalidKeyLength); end; @@ -597,7 +597,7 @@ function TAesLightEngine.GenerateWorkingKey(AForEncryption: Boolean; end else begin - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); raise EInvalidOperationCryptoLibException.CreateRes(@SInvalidOperation); end; end; @@ -616,7 +616,7 @@ function TAesLightEngine.GenerateWorkingKey(AForEncryption: Boolean; Result := LBigW; - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); end; function TAesLightEngine.GetAlgorithmName: String; diff --git a/CryptoLib/src/Crypto/Engines/ClpBlowfishEngine.pas b/CryptoLib/src/Crypto/Engines/ClpBlowfishEngine.pas index b682c152..907db3cb 100644 --- a/CryptoLib/src/Crypto/Engines/ClpBlowfishEngine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpBlowfishEngine.pas @@ -322,7 +322,7 @@ procedure TBlowfishEngine.SetKey(const AKey: TCryptoLibByteArray); if ((LKeyLength < 4) or (LKeyLength > 56) or (((LKeyLength * 8) and 7) <> 0)) then begin - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); raise EArgumentCryptoLibException.CreateRes(@SInvalidKeyLength); end; @@ -408,7 +408,7 @@ procedure TBlowfishEngine.SetKey(const AKey: TCryptoLibByteArray); ProcessTable(FS1[SBOX_SK - 2], FS1[SBOX_SK - 1], FS2); ProcessTable(FS2[SBOX_SK - 2], FS2[SBOX_SK - 1], FS3); - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); end; procedure TBlowfishEngine.EncryptBlock(const ASrc: TCryptoLibByteArray; diff --git a/CryptoLib/src/Crypto/Engines/ClpIesEngine.pas b/CryptoLib/src/Crypto/Engines/ClpIesEngine.pas index 33579eba..dfc81c98 100644 --- a/CryptoLib/src/Crypto/Engines/ClpIesEngine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpIesEngine.pas @@ -597,7 +597,7 @@ function TIesEngine.ProcessBlock(const AIn: TCryptoLibByteArray; if (System.Length(FV) <> 0) then begin VZ := TArrayUtilities.Concatenate([FV, BigZ]); - TArrayUtilities.Fill(BigZ, 0, System.Length(BigZ), Byte(0)); + TArrayUtilities.Fill(BigZ, 0, System.Length(BigZ), Byte(0)); BigZ := VZ; end; @@ -618,7 +618,7 @@ function TIesEngine.ProcessBlock(const AIn: TCryptoLibByteArray; end; finally - TArrayUtilities.Fill(BigZ, 0, System.Length(BigZ), Byte(0)); + TArrayUtilities.Fill(BigZ, 0, System.Length(BigZ), Byte(0)); end; end; diff --git a/CryptoLib/src/Crypto/Engines/ClpPascalCoinIesEngine.pas b/CryptoLib/src/Crypto/Engines/ClpPascalCoinIesEngine.pas index 900304d4..ab3cd7df 100644 --- a/CryptoLib/src/Crypto/Engines/ClpPascalCoinIesEngine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpPascalCoinIesEngine.pas @@ -311,7 +311,7 @@ function TPascalCoinIesEngine.ProcessBlock(const AIn: TCryptoLibByteArray; end; finally - TArrayUtilities.Fill(LBigZ, 0, System.Length(LBigZ), Byte(0)); + TArrayUtilities.Fill(LBigZ, 0, System.Length(LBigZ), Byte(0)); end; end; diff --git a/CryptoLib/src/Crypto/Engines/ClpRfc3211WrapEngine.pas b/CryptoLib/src/Crypto/Engines/ClpRfc3211WrapEngine.pas index 3094013c..48086363 100644 --- a/CryptoLib/src/Crypto/Engines/ClpRfc3211WrapEngine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpRfc3211WrapEngine.pas @@ -224,7 +224,7 @@ function TRfc3211WrapEngine.Unwrap(const AInBytes: TCryptoLibByteArray; LNonEqual := LNonEqual or (LCheck xor LCekBlock[4 + LI]); end; - TArrayUtilities.Fill(LCekBlock, 0, System.Length(LCekBlock), Byte(0)); + TArrayUtilities.Fill(LCekBlock, 0, System.Length(LCekBlock), Byte(0)); if (LNonEqual <> 0) or LInvalidLength then raise EInvalidCipherTextCryptoLibException.CreateRes(@SWrappedKeyCorrupted); diff --git a/CryptoLib/src/Crypto/Engines/ClpRijndaelEngine.pas b/CryptoLib/src/Crypto/Engines/ClpRijndaelEngine.pas index 790ebd58..26042676 100644 --- a/CryptoLib/src/Crypto/Engines/ClpRijndaelEngine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpRijndaelEngine.pas @@ -543,7 +543,7 @@ function TRijndaelEngine.GenerateWorkingKey(const AKey: TCryptoLibByteArray) LKc := 8 else begin - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); raise EArgumentCryptoLibException.CreateRes(@SInvalidKeyLength); end; end; @@ -653,7 +653,7 @@ function TRijndaelEngine.GenerateWorkingKey(const AKey: TCryptoLibByteArray) end; Result := LW; - TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); + TArrayUtilities.Fill(AKey, 0, System.Length(AKey), Byte(0)); end; procedure TRijndaelEngine.PackBlock(const ABytes: TCryptoLibByteArray; diff --git a/CryptoLib/src/Crypto/Engines/ClpSpeckEngine.pas b/CryptoLib/src/Crypto/Engines/ClpSpeckEngine.pas index 0478d565..5e5de62c 100644 --- a/CryptoLib/src/Crypto/Engines/ClpSpeckEngine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpSpeckEngine.pas @@ -791,7 +791,7 @@ procedure TSpeckUInt32Engine.SetKey(const AKeyBytes: TCryptoLibByteArray); end; - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); end; { TSpeckUInt64Engine } @@ -954,7 +954,7 @@ procedure TSpeckUInt64Engine.SetKey(const AKeyBytes: TCryptoLibByteArray); end; - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); end; { TSpeck32Engine } @@ -976,7 +976,7 @@ procedure TSpeck32Engine.CheckKeySize(const AKeyBytes: TCryptoLibByteArray); LKeyBytesSize := System.Length(AKeyBytes); if (LKeyBytesSize <> 8) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt(@SSpeckInvalidKeySize, ['32', '64 bits', LKeyBytesSize * 8]); end; @@ -1001,7 +1001,7 @@ procedure TSpeck48Engine.CheckKeySize(const AKeyBytes: TCryptoLibByteArray); LKeyBytesSize := System.Length(AKeyBytes); if not(LKeyBytesSize in [9, 12]) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt(@SSpeckInvalidKeySize, ['48', '72 or 96 bits', LKeyBytesSize * 8]); end; @@ -1026,7 +1026,7 @@ procedure TSpeck64Engine.CheckKeySize(const AKeyBytes: TCryptoLibByteArray); LKeyBytesSize := System.Length(AKeyBytes); if not(LKeyBytesSize in [12, 16]) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt(@SSpeckInvalidKeySize, ['64', '96 or 128 bits', LKeyBytesSize * 8]); end; @@ -1051,7 +1051,7 @@ procedure TSpeck96Engine.CheckKeySize(const AKeyBytes: TCryptoLibByteArray); LKeyBytesSize := System.Length(AKeyBytes); if not(LKeyBytesSize in [12, 18]) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt(@SSpeckInvalidKeySize, ['96', '96 or 144 bits', LKeyBytesSize * 8]); end; @@ -1076,7 +1076,7 @@ procedure TSpeck128Engine.CheckKeySize(const AKeyBytes: TCryptoLibByteArray); LKeyBytesSize := System.Length(AKeyBytes); if not(LKeyBytesSize in [16, 24, 32]) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt(@SSpeckInvalidKeySize, ['128', '128, 192 or 256 bits', LKeyBytesSize * 8]); end; diff --git a/CryptoLib/src/Crypto/Engines/ClpSpeckLegacyEngine.pas b/CryptoLib/src/Crypto/Engines/ClpSpeckLegacyEngine.pas index b067c9e6..b524de3d 100644 --- a/CryptoLib/src/Crypto/Engines/ClpSpeckLegacyEngine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpSpeckLegacyEngine.pas @@ -791,7 +791,7 @@ procedure TSpeckUInt32LegacyEngine.SetKey(const AKeyBytes: TCryptoLibByteArray); end; - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); end; { TSpeckUInt64LegacyEngine } @@ -958,7 +958,7 @@ procedure TSpeckUInt64LegacyEngine.SetKey(const AKeyBytes: TCryptoLibByteArray); end; - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); end; { TSpeck32LegacyEngine } @@ -981,7 +981,7 @@ procedure TSpeck32LegacyEngine.CheckKeySize(const AKeyBytes LKeyBytesSize := System.Length(AKeyBytes); if (LKeyBytesSize <> 8) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt (@SSpeckLegacyInvalidKeySize, ['32', '64 bits', LKeyBytesSize * 8]); end; @@ -1007,7 +1007,7 @@ procedure TSpeck48LegacyEngine.CheckKeySize(const AKeyBytes LKeyBytesSize := System.Length(AKeyBytes); if not(LKeyBytesSize in [9, 12]) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt (@SSpeckLegacyInvalidKeySize, ['48', '72 or 96 bits', LKeyBytesSize * 8]); end; @@ -1033,7 +1033,7 @@ procedure TSpeck64LegacyEngine.CheckKeySize(const AKeyBytes LKeyBytesSize := System.Length(AKeyBytes); if not(LKeyBytesSize in [12, 16]) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt (@SSpeckLegacyInvalidKeySize, ['64', '96 or 128 bits', LKeyBytesSize * 8]); end; @@ -1059,7 +1059,7 @@ procedure TSpeck96LegacyEngine.CheckKeySize(const AKeyBytes LKeyBytesSize := System.Length(AKeyBytes); if not(LKeyBytesSize in [12, 18]) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt (@SSpeckLegacyInvalidKeySize, ['96', '96 or 144 bits', LKeyBytesSize * 8]); end; @@ -1085,7 +1085,7 @@ procedure TSpeck128LegacyEngine.CheckKeySize(const AKeyBytes LKeyBytesSize := System.Length(AKeyBytes); if not(LKeyBytesSize in [16, 24, 32]) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt (@SSpeckLegacyInvalidKeySize, ['128', '128, 192 or 256 bits', LKeyBytesSize * 8]); diff --git a/CryptoLib/src/Crypto/Engines/ClpXChaCha20Engine.pas b/CryptoLib/src/Crypto/Engines/ClpXChaCha20Engine.pas index a03bfc9a..6b809a74 100644 --- a/CryptoLib/src/Crypto/Engines/ClpXChaCha20Engine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpXChaCha20Engine.pas @@ -99,18 +99,18 @@ procedure TXChaCha20Engine.SetKey(const AKeyBytes, AIvBytes: TCryptoLibByteArray try TChaChaEngine.HChaCha20(AKeyBytes, LNoncePrefix, LSubKey, 0); finally - TArrayUtilities.Fill(LNoncePrefix, 0, System.Length(LNoncePrefix), Byte(0)); + TArrayUtilities.Fill(LNoncePrefix, 0, System.Length(LNoncePrefix), Byte(0)); end; System.SetLength(LInnerIv, 12); - TArrayUtilities.Fill(LInnerIv, 0, 4, Byte(0)); + TArrayUtilities.Fill(LInnerIv, 0, 4, Byte(0)); System.Move(AIvBytes[16], LInnerIv[4], 8); try inherited SetKey(LSubKey, LInnerIv); finally - TArrayUtilities.Fill(LSubKey, 0, 32, Byte(0)); - TArrayUtilities.Fill(LInnerIv, 0, 12, Byte(0)); + TArrayUtilities.Fill(LSubKey, 0, 32, Byte(0)); + TArrayUtilities.Fill(LInnerIv, 0, 12, Byte(0)); end; end; diff --git a/CryptoLib/src/Crypto/Engines/ClpXSalsa20Engine.pas b/CryptoLib/src/Crypto/Engines/ClpXSalsa20Engine.pas index d107262f..364f2d8a 100644 --- a/CryptoLib/src/Crypto/Engines/ClpXSalsa20Engine.pas +++ b/CryptoLib/src/Crypto/Engines/ClpXSalsa20Engine.pas @@ -79,8 +79,8 @@ procedure TXSalsa20Engine.SetKey(const AKeyBytes, AIvBytes: TCryptoLibByteArray) if (System.Length(AKeyBytes) <> 32) then begin - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); - TArrayUtilities.Fill(AIvBytes, 0, System.Length(AIvBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AIvBytes, 0, System.Length(AIvBytes), Byte(0)); raise EArgumentCryptoLibException.CreateResFmt(@SInvalidKeySize, [AlgorithmName]); end; @@ -109,8 +109,8 @@ procedure TXSalsa20Engine.SetKey(const AKeyBytes, AIvBytes: TCryptoLibByteArray) // Last 64 bits of input IV TPack.LE_To_UInt32(AIvBytes, 16, FEngineState, 6, 2); - TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); - TArrayUtilities.Fill(AIvBytes, 0, System.Length(AIvBytes), Byte(0)); + TArrayUtilities.Fill(AKeyBytes, 0, System.Length(AKeyBytes), Byte(0)); + TArrayUtilities.Fill(AIvBytes, 0, System.Length(AIvBytes), Byte(0)); end; end. diff --git a/CryptoLib/src/Crypto/Generators/ClpPbeParametersGenerator.pas b/CryptoLib/src/Crypto/Generators/ClpPbeParametersGenerator.pas index 63a53b4a..baf2aaa8 100644 --- a/CryptoLib/src/Crypto/Generators/ClpPbeParametersGenerator.pas +++ b/CryptoLib/src/Crypto/Generators/ClpPbeParametersGenerator.pas @@ -184,12 +184,12 @@ procedure TPbeParametersGenerator.Clear; begin if FPassword <> nil then begin - TArrayUtilities.Fill(FPassword, 0, System.Length(FPassword), Byte(0)); + TArrayUtilities.Fill(FPassword, 0, System.Length(FPassword), Byte(0)); FPassword := nil; end; if FSalt <> nil then begin - TArrayUtilities.Fill(FSalt, 0, System.Length(FSalt), Byte(0)); + TArrayUtilities.Fill(FSalt, 0, System.Length(FSalt), Byte(0)); FSalt := nil; end; FIterationCount := 0; @@ -238,7 +238,7 @@ class function TPbeParametersGenerator.Pkcs12PasswordToBytes( if AWrongPkcs12Zero then begin System.SetLength(Result, 2); - TArrayUtilities.Fill(Result, 0, System.Length(Result), Byte(0)); + TArrayUtilities.Fill(Result, 0, System.Length(Result), Byte(0)); end else Result := nil; diff --git a/CryptoLib/src/Crypto/Generators/ClpPkcs12ParametersGenerator.pas b/CryptoLib/src/Crypto/Generators/ClpPkcs12ParametersGenerator.pas index cd016050..eff63e42 100644 --- a/CryptoLib/src/Crypto/Generators/ClpPkcs12ParametersGenerator.pas +++ b/CryptoLib/src/Crypto/Generators/ClpPkcs12ParametersGenerator.pas @@ -119,7 +119,7 @@ procedure TPkcs12ParametersGenerator.GenerateDerivedKey(AIdByte: Byte; LSaltEmpty, LPasswordEmpty: Boolean; begin System.SetLength(LD, FV); - TArrayUtilities.Fill(LD, 0, System.Length(LD), Byte(AIdByte)); + TArrayUtilities.Fill(LD, 0, System.Length(LD), Byte(AIdByte)); LSaltEmpty := (FSalt = nil) or (System.Length(FSalt) = 0); LS := nil; diff --git a/CryptoLib/src/Crypto/IO/ClpCipherStream.pas b/CryptoLib/src/Crypto/IO/ClpCipherStream.pas index c381b4e1..cd8c9304 100644 --- a/CryptoLib/src/Crypto/IO/ClpCipherStream.pas +++ b/CryptoLib/src/Crypto/IO/ClpCipherStream.pas @@ -202,7 +202,7 @@ function TCipherStream.Write(const ABuffer; ACount: LongInt): LongInt; try FStream.Write(LOutput[0], LLength); finally - TArrayUtilities.Fill(LOutput, 0, System.Length(LOutput), Byte(0)); + TArrayUtilities.Fill(LOutput, 0, System.Length(LOutput), Byte(0)); end; end; end; @@ -226,7 +226,7 @@ procedure TCipherStream.WriteByte(AValue: Byte); try FStream.Write(LOutput[0], System.Length(LOutput)); finally - TArrayUtilities.Fill(LOutput, 0, System.Length(LOutput), Byte(0)); + TArrayUtilities.Fill(LOutput, 0, System.Length(LOutput), Byte(0)); end; end; end; @@ -258,7 +258,7 @@ destructor TCipherStream.Destroy; LLen := FWriteCipher.DoFinal(LOutput, 0); if LLen > 0 then FStream.Write(LOutput[0], LLen); - TArrayUtilities.Fill(LOutput, 0, System.Length(LOutput), Byte(0)); + TArrayUtilities.Fill(LOutput, 0, System.Length(LOutput), Byte(0)); end; if not FLeaveOpen then FStream.Free; diff --git a/CryptoLib/src/Crypto/Macs/ClpCMac.pas b/CryptoLib/src/Crypto/Macs/ClpCMac.pas index b49737c6..5ceb0d6a 100644 --- a/CryptoLib/src/Crypto/Macs/ClpCMac.pas +++ b/CryptoLib/src/Crypto/Macs/ClpCMac.pas @@ -257,7 +257,7 @@ function TCMac.DoFinal(const AOutput: TCryptoLibByteArray; procedure TCMac.Reset(); begin - TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); + TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); FBufOff := 0; FCipherMode.Reset(); end; diff --git a/CryptoLib/src/Crypto/Macs/ClpCbcBlockCipherMac.pas b/CryptoLib/src/Crypto/Macs/ClpCbcBlockCipherMac.pas index 0c70a7a9..94374193 100644 --- a/CryptoLib/src/Crypto/Macs/ClpCbcBlockCipherMac.pas +++ b/CryptoLib/src/Crypto/Macs/ClpCbcBlockCipherMac.pas @@ -197,7 +197,7 @@ function TCbcBlockCipherMac.DoFinal(const AOutput: TCryptoLibByteArray; procedure TCbcBlockCipherMac.Reset(); begin - TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); + TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); FBufOff := 0; FCipherMode.Reset(); end; diff --git a/CryptoLib/src/Crypto/Macs/ClpCfbBlockCipherMac.pas b/CryptoLib/src/Crypto/Macs/ClpCfbBlockCipherMac.pas index eeb3455d..2cbe14ab 100644 --- a/CryptoLib/src/Crypto/Macs/ClpCfbBlockCipherMac.pas +++ b/CryptoLib/src/Crypto/Macs/ClpCfbBlockCipherMac.pas @@ -166,7 +166,7 @@ procedure TMacCfbBlockCipher.Init(AForEncryption: Boolean; if LIvLen < System.Length(FIV) then begin LOffset := System.Length(FIV) - LIvLen; - TArrayUtilities.Fill(FIV, 0, LOffset, Byte(0)); + TArrayUtilities.Fill(FIV, 0, LOffset, Byte(0)); System.Move(LIv[0], FIV[LOffset], LIvLen * System.SizeOf(Byte)); end else @@ -352,7 +352,7 @@ function TCfbBlockCipherMac.DoFinal(const AOutput: TCryptoLibByteArray; procedure TCfbBlockCipherMac.Reset; begin - TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); + TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); FBufOff := 0; FCipher.Reset(); end; diff --git a/CryptoLib/src/Crypto/Macs/ClpPoly1305.pas b/CryptoLib/src/Crypto/Macs/ClpPoly1305.pas index 240a97d2..a9f5e6e7 100644 --- a/CryptoLib/src/Crypto/Macs/ClpPoly1305.pas +++ b/CryptoLib/src/Crypto/Macs/ClpPoly1305.pas @@ -432,7 +432,7 @@ function TPoly1305.DoFinal(const AOutput: TCryptoLibByteArray; procedure TPoly1305.Reset(); begin FCurrentBlockOffset := 0; - TArrayUtilities.Fill(FCurrentBlock, 0, System.Length(FCurrentBlock), Byte(0)); + TArrayUtilities.Fill(FCurrentBlock, 0, System.Length(FCurrentBlock), Byte(0)); Poly1305StateReset(FState); end; diff --git a/CryptoLib/src/Crypto/Modes/ClpCbcBlockCipher.pas b/CryptoLib/src/Crypto/Modes/ClpCbcBlockCipher.pas index 805b84cf..172a3703 100644 --- a/CryptoLib/src/Crypto/Modes/ClpCbcBlockCipher.pas +++ b/CryptoLib/src/Crypto/Modes/ClpCbcBlockCipher.pas @@ -289,7 +289,7 @@ procedure TCbcBlockCipher.CbcDecryptBulk(const AInBuf: TCryptoLibByteArray; procedure TCbcBlockCipher.Reset; begin System.Move(FIV[0], FCbcV[0], System.Length(FIV)); - TArrayUtilities.Fill(FCbcNextV, 0, System.Length(FCbcNextV), Byte(0)); + TArrayUtilities.Fill(FCbcNextV, 0, System.Length(FCbcNextV), Byte(0)); end; function TCbcBlockCipher.GetAlgorithmName: String; diff --git a/CryptoLib/src/Crypto/Modes/ClpCcmBlockCipher.pas b/CryptoLib/src/Crypto/Modes/ClpCcmBlockCipher.pas index facb24ba..6ee3767f 100644 --- a/CryptoLib/src/Crypto/Modes/ClpCcmBlockCipher.pas +++ b/CryptoLib/src/Crypto/Modes/ClpCcmBlockCipher.pas @@ -652,7 +652,7 @@ procedure TCcmBlockCipher.ComputePostHeaderMacState(AInLen: Int32; end; end; - System.FillChar(AMacState[0], BlockSize, 0); + TArrayUtilities.Fill(AMacState, 0, BlockSize, Byte(0)); System.SetLength(LBlock, BlockSize); LOffset := 0; while LOffset < LHeaderLen do @@ -789,7 +789,7 @@ function TCcmBlockCipher.DecryptBodyFused(const ACtx: TCcmDecryptCtx): Boolean; PByte(@ACtx.Dest[ACtx.DestOff + LBulkBlocks * BlockSize])); // Zero-pad plaintext tail and fold one last CBC step. - System.FillChar(LTailBlock[0], BlockSize, 0); + TArrayUtilities.Fill(LTailBlock, 0, BlockSize, Byte(0)); for LI := 0 to LTailLen - 1 do LTailBlock[LI] := ACtx.Dest[ACtx.DestOff + LBulkBlocks * BlockSize + LI]; TByteUtilities.XorTo(BlockSize, PByte(@LTailBlock[0]), PByte(@LMacState[0])); diff --git a/CryptoLib/src/Crypto/Modes/ClpCfbBlockCipher.pas b/CryptoLib/src/Crypto/Modes/ClpCfbBlockCipher.pas index ac596a71..0e730da6 100644 --- a/CryptoLib/src/Crypto/Modes/ClpCfbBlockCipher.pas +++ b/CryptoLib/src/Crypto/Modes/ClpCfbBlockCipher.pas @@ -232,7 +232,7 @@ procedure TCfbBlockCipher.Init(AForEncryption: Boolean; LIv := LIvParam.GetIV(); LDiff := System.Length(FIV) - System.Length(LIv); System.Move(LIv[0], FIV[LDiff], System.Length(LIv) * System.SizeOf(Byte)); - TArrayUtilities.Fill(FIV, 0, LDiff, Byte(0)); + TArrayUtilities.Fill(FIV, 0, LDiff, Byte(0)); LParameters := LIvParam.Parameters; end; diff --git a/CryptoLib/src/Crypto/Modes/ClpChaCha20Poly1305.pas b/CryptoLib/src/Crypto/Modes/ClpChaCha20Poly1305.pas index 72a81349..d875d4c5 100644 --- a/CryptoLib/src/Crypto/Modes/ClpChaCha20Poly1305.pas +++ b/CryptoLib/src/Crypto/Modes/ClpChaCha20Poly1305.pas @@ -545,7 +545,7 @@ function TChaCha20Poly1305.DoFinal(const AOutput: TCryptoLibByteArray; CheckData(); - TArrayUtilities.Fill(FMac, 0, MacSize, Byte(0)); + TArrayUtilities.Fill(FMac, 0, MacSize, Byte(0)); case FState of TState.DecData: @@ -676,7 +676,7 @@ procedure TChaCha20Poly1305.InitMac; FChaCha20.ProcessBytes(LFirstBlock, 0, 64, LFirstBlock, 0); FPoly1305.Init(TKeyParameter.Create(LFirstBlock, 0, 32) as IKeyParameter); finally - TArrayUtilities.Fill(LFirstBlock, 0, 64, Byte(0)); + TArrayUtilities.Fill(LFirstBlock, 0, 64, Byte(0)); end; end; @@ -733,11 +733,11 @@ procedure TChaCha20Poly1305.ProcessData(const AInBytes: TCryptoLibByteArray; procedure TChaCha20Poly1305.Reset(AClearMac, AResetCipher: Boolean); begin - TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); + TArrayUtilities.Fill(FBuf, 0, System.Length(FBuf), Byte(0)); if AClearMac then begin - TArrayUtilities.Fill(FMac, 0, System.Length(FMac), Byte(0)); + TArrayUtilities.Fill(FMac, 0, System.Length(FMac), Byte(0)); end; FAadCount := UInt64(0); diff --git a/CryptoLib/src/Crypto/Modes/ClpCipherModeParameterUtilities.pas b/CryptoLib/src/Crypto/Modes/ClpCipherModeParameterUtilities.pas index 2b259125..93d3ef57 100644 --- a/CryptoLib/src/Crypto/Modes/ClpCipherModeParameterUtilities.pas +++ b/CryptoLib/src/Crypto/Modes/ClpCipherModeParameterUtilities.pas @@ -124,7 +124,7 @@ class function TCipherModeParameterUtilities.TryUnwrapIv( LPrefix := System.Length(AIvTarget) - System.Length(LIv); System.Move(LIv[0], AIvTarget[LPrefix], System.Length(LIv) * System.SizeOf(Byte)); - TArrayUtilities.Fill(AIvTarget, 0, LPrefix, Byte(0)); + TArrayUtilities.Fill(AIvTarget, 0, LPrefix, Byte(0)); end else begin diff --git a/CryptoLib/src/Crypto/Modes/ClpEaxBlockCipher.pas b/CryptoLib/src/Crypto/Modes/ClpEaxBlockCipher.pas index 38783a47..fb4971c4 100644 --- a/CryptoLib/src/Crypto/Modes/ClpEaxBlockCipher.pas +++ b/CryptoLib/src/Crypto/Modes/ClpEaxBlockCipher.pas @@ -557,11 +557,11 @@ procedure TEaxBlockCipher.Reset(AClearMac: Boolean); FMac.Reset(); FBufOff := 0; - TArrayUtilities.Fill(FBufBlock, 0, System.Length(FBufBlock), Byte(0)); + TArrayUtilities.Fill(FBufBlock, 0, System.Length(FBufBlock), Byte(0)); if AClearMac then begin - TArrayUtilities.Fill(FMacBlock, 0, System.Length(FMacBlock), Byte(0)); + TArrayUtilities.Fill(FMacBlock, 0, System.Length(FMacBlock), Byte(0)); end; System.SetLength(LTag, FBlockSize); @@ -573,8 +573,8 @@ procedure TEaxBlockCipher.Reset(AClearMac: Boolean); if FUseFusedBody then begin System.Move(FNonceMac[0], FCtrBlock[0], FBlockSize); - TArrayUtilities.Fill(FOmacState, 0, FBlockSize, Byte(0)); - TArrayUtilities.Fill(FOmacLookahead, 0, FBlockSize, Byte(0)); + TArrayUtilities.Fill(FOmacState, 0, FBlockSize, Byte(0)); + TArrayUtilities.Fill(FOmacLookahead, 0, FBlockSize, Byte(0)); FHasOmacLookahead := False; end; diff --git a/CryptoLib/src/Crypto/Modes/ClpGcmBlockCipher.pas b/CryptoLib/src/Crypto/Modes/ClpGcmBlockCipher.pas index 7cce28bc..0f48f6fa 100644 --- a/CryptoLib/src/Crypto/Modes/ClpGcmBlockCipher.pas +++ b/CryptoLib/src/Crypto/Modes/ClpGcmBlockCipher.pas @@ -463,9 +463,9 @@ procedure TGcmBlockCipher.InitCipherAndHashSubKey(const AKeyParam: IKeyParameter System.SetLength(FHPow, 128); TGcmUtilities.InitEightWayHPowFromH(FH, FHPow); System.SetLength(FWorkCtr, 128); - TArrayUtilities.Fill(FWorkCtr, 0, System.Length(FWorkCtr), Byte(0)); + TArrayUtilities.Fill(FWorkCtr, 0, System.Length(FWorkCtr), Byte(0)); System.SetLength(FWorkCtrAhead, 128); - TArrayUtilities.Fill(FWorkCtrAhead, 0, System.Length(FWorkCtrAhead), Byte(0)); + TArrayUtilities.Fill(FWorkCtrAhead, 0, System.Length(FWorkCtrAhead), Byte(0)); if TFusedKernelRegistry.TryAcquireGcm(FCipher, TFusedModeDirection.Encrypt, @FHPow[0], FGcmKernel) and (FGcmKernel <> nil) then @@ -1049,10 +1049,10 @@ procedure TGcmBlockCipher.Reset; procedure TGcmBlockCipher.DoReset(AClearMac: Boolean); begin - TArrayUtilities.Fill(FS, 0, System.Length(FS), Byte(0)); - TArrayUtilities.Fill(FS_at, 0, System.Length(FS_at), Byte(0)); - TArrayUtilities.Fill(FS_atPre, 0, System.Length(FS_atPre), Byte(0)); - TArrayUtilities.Fill(FAtBlock, 0, System.Length(FAtBlock), Byte(0)); + TArrayUtilities.Fill(FS, 0, System.Length(FS), Byte(0)); + TArrayUtilities.Fill(FS_at, 0, System.Length(FS_at), Byte(0)); + TArrayUtilities.Fill(FS_atPre, 0, System.Length(FS_atPre), Byte(0)); + TArrayUtilities.Fill(FAtBlock, 0, System.Length(FAtBlock), Byte(0)); FAtBlockPos := 0; FAtLength := 0; FAtLengthPre := 0; @@ -1063,7 +1063,7 @@ procedure TGcmBlockCipher.DoReset(AClearMac: Boolean); FTotalLength := 0; if FBufBlock <> nil then - TArrayUtilities.Fill(FBufBlock, 0, System.Length(FBufBlock), Byte(0)); + TArrayUtilities.Fill(FBufBlock, 0, System.Length(FBufBlock), Byte(0)); if AClearMac then FMacBlock := nil; diff --git a/CryptoLib/src/Crypto/Modes/ClpGcmSivBlockCipher.pas b/CryptoLib/src/Crypto/Modes/ClpGcmSivBlockCipher.pas index e75fe249..b9ac8978 100644 --- a/CryptoLib/src/Crypto/Modes/ClpGcmSivBlockCipher.pas +++ b/CryptoLib/src/Crypto/Modes/ClpGcmSivBlockCipher.pas @@ -291,7 +291,7 @@ procedure TGcmSivBlockCipher.TGcmSivHasher.CompleteHash; begin if FNumActive > 0 then begin - TArrayUtilities.Fill(FParent.FTheReverse, 0, System.Length(FParent.FTheReverse), Byte(0)); + TArrayUtilities.Fill(FParent.FTheReverse, 0, System.Length(FParent.FTheReverse), Byte(0)); TGcmSivBlockCipher.FillReverse(FBuffer, 0, FNumActive, FParent.FTheReverse); FParent.GHASH(FParent.FTheReverse); @@ -551,8 +551,7 @@ procedure TGcmSivBlockCipher.ResetStreams; begin // Wipe held/recovered plaintext (FTheEncData holds only ciphertext); reset // used lengths but keep the reused buffers' capacity. - if FThePlainLen > 0 then - System.FillChar(FThePlain[0], FThePlainLen, 0); + TArrayUtilities.Fill(FThePlain, 0, FThePlainLen, Byte(0)); FThePlainLen := 0; FTheEncDataLen := 0; @@ -560,7 +559,7 @@ procedure TGcmSivBlockCipher.ResetStreams; FTheDataHasher.Reset(); FTheFlags := FTheFlags and (not AEAD_COMPLETE); - TArrayUtilities.Fill(FTheGHash, 0, System.Length(FTheGHash), Byte(0)); + TArrayUtilities.Fill(FTheGHash, 0, System.Length(FTheGHash), Byte(0)); if FTheInitialAEAD <> nil then FTheAEADHasher.UpdateHash(FTheInitialAEAD, 0, System.Length(FTheInitialAEAD)); diff --git a/CryptoLib/src/Crypto/Modes/ClpOcbBlockCipher.pas b/CryptoLib/src/Crypto/Modes/ClpOcbBlockCipher.pas index 4627079b..2b92cf51 100644 --- a/CryptoLib/src/Crypto/Modes/ClpOcbBlockCipher.pas +++ b/CryptoLib/src/Crypto/Modes/ClpOcbBlockCipher.pas @@ -301,16 +301,16 @@ procedure TOcbBlockCipher.Init(AForEncryption: Boolean; FMacSize := 16; System.SetLength(FHashBlock, 16); - TArrayUtilities.Fill(FHashBlock, 0, 16, Byte(0)); + TArrayUtilities.Fill(FHashBlock, 0, 16, Byte(0)); if FForEncryption then begin System.SetLength(FMainBlock, BLOCK_SIZE); - TArrayUtilities.Fill(FMainBlock, 0, BLOCK_SIZE, Byte(0)); + TArrayUtilities.Fill(FMainBlock, 0, BLOCK_SIZE, Byte(0)); end else begin System.SetLength(FMainBlock, BLOCK_SIZE + FMacSize); - TArrayUtilities.Fill(FMainBlock, 0, BLOCK_SIZE + FMacSize, Byte(0)); + TArrayUtilities.Fill(FMainBlock, 0, BLOCK_SIZE + FMacSize, Byte(0)); end; if (System.Length(LN) > 15) then @@ -359,7 +359,7 @@ procedure TOcbBlockCipher.Init(AForEncryption: Boolean; end; System.SetLength(FL_Asterisk, 16); - TArrayUtilities.Fill(FL_Asterisk, 0, 16, Byte(0)); + TArrayUtilities.Fill(FL_Asterisk, 0, 16, Byte(0)); FHashCipher.ProcessBlock(FL_Asterisk, 0, FL_Asterisk, 0); FL_Dollar := OCB_double(FL_Asterisk); @@ -394,12 +394,12 @@ procedure TOcbBlockCipher.Init(AForEncryption: Boolean; FMainBlockCount := 0; System.SetLength(FOffsetHASH, 16); - TArrayUtilities.Fill(FOffsetHASH, 0, 16, Byte(0)); + TArrayUtilities.Fill(FOffsetHASH, 0, 16, Byte(0)); System.SetLength(FSum, 16); - TArrayUtilities.Fill(FSum, 0, 16, Byte(0)); + TArrayUtilities.Fill(FSum, 0, 16, Byte(0)); System.Move(FOffsetMAIN_0[0], FOffsetMAIN[0], 16); System.SetLength(FChecksum, 16); - TArrayUtilities.Fill(FChecksum, 0, 16, Byte(0)); + TArrayUtilities.Fill(FChecksum, 0, 16, Byte(0)); if (FInitialAssociatedText <> nil) then begin @@ -857,7 +857,7 @@ procedure TOcbBlockCipher.Clear(const ABs: TCryptoLibByteArray); begin if (ABs <> nil) then begin - TArrayUtilities.Fill(ABs, 0, System.Length(ABs), Byte(0)); + TArrayUtilities.Fill(ABs, 0, System.Length(ABs), Byte(0)); end; end; diff --git a/CryptoLib/src/Crypto/Modes/ClpSicBlockCipher.pas b/CryptoLib/src/Crypto/Modes/ClpSicBlockCipher.pas index bcedd528..394f3028 100644 --- a/CryptoLib/src/Crypto/Modes/ClpSicBlockCipher.pas +++ b/CryptoLib/src/Crypto/Modes/ClpSicBlockCipher.pas @@ -155,7 +155,7 @@ constructor TSicBlockCipher.Create(const ACipher: IBlockCipher); procedure TSicBlockCipher.Reset; begin - TArrayUtilities.Fill(FCounter, 0, System.Length(FCounter), Byte(0)); + TArrayUtilities.Fill(FCounter, 0, System.Length(FCounter), Byte(0)); System.Move(FIV[0], FCounter[0], System.Length(FIV) * System.SizeOf(Byte)); end; diff --git a/CryptoLib/src/Crypto/Parameters/ClpKeyParameter.pas b/CryptoLib/src/Crypto/Parameters/ClpKeyParameter.pas index 431a2529..0f224947 100644 --- a/CryptoLib/src/Crypto/Parameters/ClpKeyParameter.pas +++ b/CryptoLib/src/Crypto/Parameters/ClpKeyParameter.pas @@ -70,7 +70,7 @@ constructor TKeyParameter.Create(const AKey: TCryptoLibByteArray); procedure TKeyParameter.Clear; begin - TArrayUtilities.Fill(FKey, 0, System.Length(FKey), Byte(0)); + TArrayUtilities.Fill(FKey, 0, System.Length(FKey), Byte(0)); end; constructor TKeyParameter.Create(const AKey: TCryptoLibByteArray; diff --git a/CryptoLib/src/Crypto/Parameters/ClpParametersWithContext.pas b/CryptoLib/src/Crypto/Parameters/ClpParametersWithContext.pas index 6f814480..a1b9e320 100644 --- a/CryptoLib/src/Crypto/Parameters/ClpParametersWithContext.pas +++ b/CryptoLib/src/Crypto/Parameters/ClpParametersWithContext.pas @@ -88,7 +88,7 @@ constructor TParametersWithContext.Create(const AParameters: ICipherParameters; destructor TParametersWithContext.Destroy; begin - TArrayUtilities.Fill(FContext, 0, System.Length(FContext), Byte(0)); + TArrayUtilities.Fill(FContext, 0, System.Length(FContext), Byte(0)); inherited; end; diff --git a/CryptoLib/src/Crypto/Parameters/ClpParametersWithIV.pas b/CryptoLib/src/Crypto/Parameters/ClpParametersWithIV.pas index dd8b0e70..ea8602e3 100644 --- a/CryptoLib/src/Crypto/Parameters/ClpParametersWithIV.pas +++ b/CryptoLib/src/Crypto/Parameters/ClpParametersWithIV.pas @@ -79,7 +79,7 @@ constructor TParametersWithIV.Create(const AParameters: ICipherParameters; procedure TParametersWithIV.Clear; begin - TArrayUtilities.Fill(FIv, 0, System.Length(FIv), Byte(0)); + TArrayUtilities.Fill(FIv, 0, System.Length(FIv), Byte(0)); end; constructor TParametersWithIV.Create(const AParameters: ICipherParameters; diff --git a/CryptoLib/src/Crypto/Signers/ClpBip340SchnorrSigner.pas b/CryptoLib/src/Crypto/Signers/ClpBip340SchnorrSigner.pas index 03721a36..9a9ca457 100644 --- a/CryptoLib/src/Crypto/Signers/ClpBip340SchnorrSigner.pas +++ b/CryptoLib/src/Crypto/Signers/ClpBip340SchnorrSigner.pas @@ -201,7 +201,7 @@ function TBip340SchnorrSigner.TBuffer.GenerateSignature(const APrivateKey: IBip3 if (LProvidedRandom <> nil) then LProvidedRandom.NextBytes(LAuxRand) else - TArrayUtilities.Fill(LAuxRand, 0, System.Length(LAuxRand), Byte(0)); + TArrayUtilities.Fill(LAuxRand, 0, System.Length(LAuxRand), Byte(0)); LD := TBigInteger.Create(1, APrivateKey.GetEncoded()).&Mod(LN); if (LD.SignValue = 0) then diff --git a/CryptoLib/src/Crypto/Signers/ClpPssSigner.pas b/CryptoLib/src/Crypto/Signers/ClpPssSigner.pas index 2ba10aea..7d626358 100644 --- a/CryptoLib/src/Crypto/Signers/ClpPssSigner.pas +++ b/CryptoLib/src/Crypto/Signers/ClpPssSigner.pas @@ -291,7 +291,7 @@ procedure TPssSigner.Init(AForSigning: Boolean; procedure TPssSigner.ClearBlock(const ABlock: TCryptoLibByteArray); begin if ABlock <> nil then - TArrayUtilities.Fill(ABlock, 0, System.Length(ABlock), Byte(0)); + TArrayUtilities.Fill(ABlock, 0, System.Length(ABlock), Byte(0)); end; procedure TPssSigner.Update(AInput: Byte); @@ -320,7 +320,7 @@ function TPssSigner.GenerateSignature: TCryptoLibByteArray; ClearBlock(FBlock); // PSS requires first 8 bytes of mDash to be zeros (padding1) - TArrayUtilities.Fill(FMDash, 0, 8, Byte(0)); + TArrayUtilities.Fill(FMDash, 0, 8, Byte(0)); FContentDigest1.DoFinal(FMDash, System.Length(FMDash) - FHLen - FSLen); @@ -378,13 +378,13 @@ function TPssSigner.VerifySignature( end; // PSS requires first 8 bytes of mDash to be zeros (padding1) - TArrayUtilities.Fill(FMDash, 0, 8, Byte(0)); + TArrayUtilities.Fill(FMDash, 0, 8, Byte(0)); FContentDigest1.DoFinal(FMDash, System.Length(FMDash) - FHLen - FSLen); LB := FCipher.ProcessBlock(ASignature, 0, System.Length(ASignature)); - TArrayUtilities.Fill(FBlock, 0, System.Length(FBlock) - System.Length(LB), Byte(0)); + TArrayUtilities.Fill(FBlock, 0, System.Length(FBlock) - System.Length(LB), Byte(0)); System.Move(LB[0], FBlock[System.Length(FBlock) - System.Length(LB)], System.Length(LB)); diff --git a/CryptoLib/src/Crypto/Signers/ClpSlhDsaSigner.pas b/CryptoLib/src/Crypto/Signers/ClpSlhDsaSigner.pas index ca2bb3c5..73a3d7e7 100644 --- a/CryptoLib/src/Crypto/Signers/ClpSlhDsaSigner.pas +++ b/CryptoLib/src/Crypto/Signers/ClpSlhDsaSigner.pas @@ -32,6 +32,7 @@ interface ClpCryptoServicesRegistrar, ClpISecureRandom, ClpSecureRandom, + ClpArrayUtilities, ClpCryptoLibTypes; resourcestring @@ -114,8 +115,7 @@ procedure TSlhDsaSignerBuffer.Reset; procedure TSlhDsaSignerBuffer.TruncateAndClear(ANewLength: Int32); begin - if ANewLength < FCount then - FillChar(FBuffer[ANewLength], FCount - ANewLength, 0); + TArrayUtilities.Fill(FBuffer, ANewLength, FCount, Byte(0)); FCount := ANewLength; end; diff --git a/CryptoLib/src/Crypto/Signers/ClpX931Signer.pas b/CryptoLib/src/Crypto/Signers/ClpX931Signer.pas index 21291a56..156e6bcf 100644 --- a/CryptoLib/src/Crypto/Signers/ClpX931Signer.pas +++ b/CryptoLib/src/Crypto/Signers/ClpX931Signer.pas @@ -178,7 +178,7 @@ function TX931Signer.GenerateSignature: TCryptoLibByteArray; LT := TBigInteger.Create(1, FCipher.ProcessBlock(FBlock, 0, System.Length(FBlock))); - TArrayUtilities.Fill(FBlock, 0, System.Length(FBlock), Byte($00)); + TArrayUtilities.Fill(FBlock, 0, System.Length(FBlock), Byte($00)); LT := LT.Min(FKParam.Modulus.Subtract(LT)); @@ -226,8 +226,8 @@ function TX931Signer.VerifySignature(const ASignature: TCryptoLibByteArray): Boo LRv := TArrayUtilities.FixedTimeEquals(FBlock, LFBlock); - TArrayUtilities.Fill(FBlock, 0, System.Length(FBlock), Byte($00)); - TArrayUtilities.Fill(LFBlock, 0, System.Length(LFBlock), Byte($00)); + TArrayUtilities.Fill(FBlock, 0, System.Length(FBlock), Byte($00)); + TArrayUtilities.Fill(LFBlock, 0, System.Length(LFBlock), Byte($00)); Result := LRv; end; diff --git a/CryptoLib/src/Crypto/Signers/MlDsa/ClpMlDsaEngine.pas b/CryptoLib/src/Crypto/Signers/MlDsa/ClpMlDsaEngine.pas index da40de39..857e8638 100644 --- a/CryptoLib/src/Crypto/Signers/MlDsa/ClpMlDsaEngine.pas +++ b/CryptoLib/src/Crypto/Signers/MlDsa/ClpMlDsaEngine.pas @@ -32,6 +32,7 @@ interface ClpISecureRandom, ClpSecureRandom, ClpBitOperations, + ClpArrayUtilities, ClpCryptoLibTypes; resourcestring @@ -401,7 +402,7 @@ procedure TMlDsaEngine.MsgRepEndSign(const ADigest: IXof; var ASig: TCryptoLibBy if FRandom <> nil then LRnd := TSecureRandom.GetNextBytes(FRandom, RndBytes) else - FillChar(LRnd[0], RndBytes, 0); + TArrayUtilities.Fill(LRnd, 0, RndBytes, Byte(0)); MsgRepEndSignCore(ADigest, ASig, ASigLen, ARho, AK, AT0Enc, AS1Enc, AS2Enc, LRnd); end; diff --git a/CryptoLib/src/Crypto/Signers/SignerCalculators/ClpHMacDsaKCalculator.pas b/CryptoLib/src/Crypto/Signers/SignerCalculators/ClpHMacDsaKCalculator.pas index 690fdddb..a1700c46 100644 --- a/CryptoLib/src/Crypto/Signers/SignerCalculators/ClpHMacDsaKCalculator.pas +++ b/CryptoLib/src/Crypto/Signers/SignerCalculators/ClpHMacDsaKCalculator.pas @@ -120,8 +120,8 @@ procedure THMacDsaKCalculator.Init(const AN, AD: TBigInteger; LSize: Int32; begin FN := AN; - TArrayUtilities.Fill(FV, 0, System.Length(FV), Byte($01)); - TArrayUtilities.Fill(FK, 0, System.Length(FK), Byte(0)); + TArrayUtilities.Fill(FV, 0, System.Length(FV), Byte($01)); + TArrayUtilities.Fill(FK, 0, System.Length(FK), Byte(0)); LSize := TBigIntegerUtilities.GetUnsignedByteLength(AN); System.SetLength(LX, LSize); diff --git a/CryptoLib/src/Crypto/Signers/SignerEncodings/ClpPlainDsaEncoding.pas b/CryptoLib/src/Crypto/Signers/SignerEncodings/ClpPlainDsaEncoding.pas index 5662ab5a..a582863a 100644 --- a/CryptoLib/src/Crypto/Signers/SignerEncodings/ClpPlainDsaEncoding.pas +++ b/CryptoLib/src/Crypto/Signers/SignerEncodings/ClpPlainDsaEncoding.pas @@ -108,7 +108,7 @@ procedure TPlainDsaEncoding.EncodeValue(const AN, AX: TBigInteger; LBsOff := Max(0, System.Length(LBs) - ALength); LBsLen := System.Length(LBs) - LBsOff; LPos := ALength - LBsLen; - TArrayUtilities.Fill(ABuf, AOff, AOff + LPos, Byte(0)); + TArrayUtilities.Fill(ABuf, AOff, AOff + LPos, Byte(0)); System.Move(LBs[LBsOff], ABuf[AOff + LPos], LBsLen * System.SizeOf(Byte)); end; diff --git a/CryptoLib/src/Crypto/Signers/SlhDsa/ClpSlhDsaCore.pas b/CryptoLib/src/Crypto/Signers/SlhDsa/ClpSlhDsaCore.pas index 7adad1a7..111ab5f3 100644 --- a/CryptoLib/src/Crypto/Signers/SlhDsa/ClpSlhDsaCore.pas +++ b/CryptoLib/src/Crypto/Signers/SlhDsa/ClpSlhDsaCore.pas @@ -284,7 +284,7 @@ procedure TSlhDsaAdrs.SetType(AAdrsType: UInt32); procedure TSlhDsaAdrs.SetTypeAndClear(AAdrsType: UInt32); begin SetType(AAdrsType); - FillChar(FValue[SlhDsaAdrsOffsetType + 4], 32 - (SlhDsaAdrsOffsetType + 4), 0); + TArrayUtilities.Fill(FValue, SlhDsaAdrsOffsetType + 4, 32, Byte(0)); end; { TSlhDsaIndexGenerator } diff --git a/CryptoLib/src/GeneralUtilities/ClpArrayUtilities.pas b/CryptoLib/src/GeneralUtilities/ClpArrayUtilities.pas index 81be5767..abf75e2d 100644 --- a/CryptoLib/src/GeneralUtilities/ClpArrayUtilities.pas +++ b/CryptoLib/src/GeneralUtilities/ClpArrayUtilities.pas @@ -122,6 +122,8 @@ TArrayUtilities = class sealed(TObject) AFiller: UInt32); overload; static; inline; class procedure Fill(const ABuf: TCryptoLibUInt64Array; AFrom, ATo: Int32; AFiller: UInt64); overload; static; inline; + class procedure Fill(const ABuf: TCryptoLibInt32Array; AFrom, ATo: Int32; + AFiller: Int32); overload; static; inline; /// /// Grow ABuf's capacity to at least ANeeded by doubling; never shrinks. @@ -380,6 +382,18 @@ class procedure TArrayUtilities.Fill(const ABuf: TCryptoLibUInt64Array; {$ENDIF FPC} end; +class procedure TArrayUtilities.Fill(const ABuf: TCryptoLibInt32Array; + AFrom, ATo: Int32; AFiller: Int32); +begin + if (ABuf = nil) or (ATo <= AFrom) then + Exit; +{$IFDEF FPC} + System.FillDWord(ABuf[AFrom], ATo - AFrom, UInt32(AFiller)); +{$ELSE} + FillCore(ABuf, AFrom, ATo, AFiller); +{$ENDIF FPC} +end; + class procedure TArrayUtilities.EnsureCapacity(var ABuf: TCryptoLibByteArray; ANeeded: Int32); var diff --git a/CryptoLib/src/Math/BinPoly/ClpBinPolyMulBase.pas b/CryptoLib/src/Math/BinPoly/ClpBinPolyMulBase.pas index 8a3278f2..a28fb475 100644 --- a/CryptoLib/src/Math/BinPoly/ClpBinPolyMulBase.pas +++ b/CryptoLib/src/Math/BinPoly/ClpBinPolyMulBase.pas @@ -114,7 +114,7 @@ procedure TBinPolyMulBase.Square(const AX: TCryptoLibUInt64Array; AXOff: Int32; TInterleave.Expand64To128(AX, AXOff, FSize, Ltt, 0); FReduce.Reduce(Ltt, 0, AZ, AZOff); finally - TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); + TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); end; end; @@ -138,7 +138,7 @@ procedure TBinPolyMulBase.SquareN(const AX: TCryptoLibUInt64Array; AXOff: Int32; FReduce.Reduce(Ltt, 0, AZ, AZOff); end; finally - TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); + TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); end; end; diff --git a/CryptoLib/src/Math/BinPoly/ClpBinPolyScalarLarge.pas b/CryptoLib/src/Math/BinPoly/ClpBinPolyScalarLarge.pas index 7a8c8271..dbb5c66f 100644 --- a/CryptoLib/src/Math/BinPoly/ClpBinPolyScalarLarge.pas +++ b/CryptoLib/src/Math/BinPoly/ClpBinPolyScalarLarge.pas @@ -86,8 +86,8 @@ procedure TBinPolyScalarLarge.Multiply(const AX: TCryptoLibUInt64Array; AXOff: I ImplKaratsuba(FSize, AX, AXOff, AY, AYOff, Ltt, 0, LScratch, 0); FReduce.Reduce(Ltt, 0, AZ, AZOff); finally - TArrayUtilities.Fill(LScratch, 0, LScratchSize, 0); - TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); + TArrayUtilities.Fill(LScratch, 0, LScratchSize, 0); + TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); end; end; diff --git a/CryptoLib/src/Math/BinPoly/ClpBinPolyScalarMedium.pas b/CryptoLib/src/Math/BinPoly/ClpBinPolyScalarMedium.pas index c86614a5..26afc6fb 100644 --- a/CryptoLib/src/Math/BinPoly/ClpBinPolyScalarMedium.pas +++ b/CryptoLib/src/Math/BinPoly/ClpBinPolyScalarMedium.pas @@ -61,7 +61,7 @@ procedure TBinPolyScalarMedium.Multiply(const AX: TCryptoLibUInt64Array; AXOff: TBinPolyScalarKernels.ImplMul(FSize, AX, AXOff, AY, AYOff, Ltt, 0); FReduce.Reduce(Ltt, 0, AZ, AZOff); finally - TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); + TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); end; end; diff --git a/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Large.pas b/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Large.pas index f0cb0bc9..34d20631 100644 --- a/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Large.pas +++ b/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Large.pas @@ -74,8 +74,8 @@ procedure TBinPolyX86V128Large.Multiply(const AX: TCryptoLibUInt64Array; AXOff: ImplKaratsuba(FSize, AX, AXOff, AY, AYOff, Ltt, 0, LScratch, 0); FReduce.Reduce(Ltt, 0, AZ, AZOff); finally - TArrayUtilities.Fill(LScratch, 0, LScratchSize, 0); - TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); + TArrayUtilities.Fill(LScratch, 0, LScratchSize, 0); + TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); end; end; diff --git a/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Medium.pas b/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Medium.pas index 80296566..ea29c2b8 100644 --- a/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Medium.pas +++ b/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Medium.pas @@ -73,7 +73,7 @@ procedure TBinPolyX86V128MediumEven.Multiply(const AX: TCryptoLibUInt64Array; AX TBinPolyX86V128Kernels.ImplMulEven(FSize, AX, AXOff, AY, AYOff, Ltt, 0); FReduce.Reduce(Ltt, 0, AZ, AZOff); finally - TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); + TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); end; end; @@ -98,7 +98,7 @@ procedure TBinPolyX86V128MediumOdd.Multiply(const AX: TCryptoLibUInt64Array; AXO TBinPolyX86V128Kernels.ImplMulOdd(FSize, AX, AXOff, AY, AYOff, Ltt, 0); FReduce.Reduce(Ltt, 0, AZ, AZOff); finally - TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); + TArrayUtilities.Fill(Ltt, 0, FSizeExt, 0); end; end; diff --git a/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Sizes.pas b/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Sizes.pas index a185c001..e716f39d 100644 --- a/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Sizes.pas +++ b/CryptoLib/src/Math/BinPoly/ClpBinPolyX86V128Sizes.pas @@ -122,7 +122,7 @@ procedure MultiplySmallFixed(ASmallLen: Int32; const AReduce: IBinPolyReduce; AS TBinPolyX86V128Kernels.ImplMulSmall(ASmallLen, AX, AXOff, AY, AYOff, Ltt, 0); AReduce.Reduce(Ltt, 0, AZ, AZOff); finally - TArrayUtilities.Fill(Ltt, 0, ASizeExt, 0); + TArrayUtilities.Fill(Ltt, 0, ASizeExt, 0); end; end; diff --git a/CryptoLib/src/Math/BinPoly/ClpBinPolys.pas b/CryptoLib/src/Math/BinPoly/ClpBinPolys.pas index 3b97cf8f..33665342 100644 --- a/CryptoLib/src/Math/BinPoly/ClpBinPolys.pas +++ b/CryptoLib/src/Math/BinPoly/ClpBinPolys.pas @@ -210,19 +210,19 @@ class procedure TBinPolys.Copy(ASize: Int32; const AX: TCryptoLibUInt64Array; AX class procedure TBinPolys.Zero(ASize: Int32; const AZ: TCryptoLibUInt64Array; AZOff: Int32); begin - TArrayUtilities.Fill(AZ, AZOff, AZOff + ASize, 0); + TArrayUtilities.Fill(AZ, AZOff, AZOff + ASize, 0); end; class procedure TBinPolys.Clear(ASize: Int32; const AZ: TCryptoLibUInt64Array; AZOff: Int32); begin - TArrayUtilities.Fill(AZ, AZOff, AZOff + ASize, 0); + TArrayUtilities.Fill(AZ, AZOff, AZOff + ASize, 0); end; class procedure TBinPolys.One(ASize: Int32; const AZ: TCryptoLibUInt64Array; AZOff: Int32); begin AZ[AZOff] := 1; if ASize > 1 then - TArrayUtilities.Fill(AZ, AZOff + 1, AZOff + ASize, 0); + TArrayUtilities.Fill(AZ, AZOff + 1, AZOff + ASize, 0); end; class function TBinPolys.EqualTo(ASize: Int32; const AX: TCryptoLibUInt64Array; AXOff: Int32; diff --git a/CryptoLib/src/Math/ClpBigInteger.pas b/CryptoLib/src/Math/ClpBigInteger.pas index 559c895c..d90465da 100644 --- a/CryptoLib/src/Math/ClpBigInteger.pas +++ b/CryptoLib/src/Math/ClpBigInteger.pas @@ -831,7 +831,7 @@ class function TBigInteger.ShiftLeft(const AMag: TCryptoLibUInt32Array; const AN System.SetLength(LNewMag, LMagLen + LNInts); if LMagLen > 0 then Move(AMag[0], LNewMag[0], LMagLen * SizeOf(UInt32)); - TArrayUtilities.Fill(LNewMag, LMagLen, System.Length(LNewMag), UInt32(0)); + TArrayUtilities.Fill(LNewMag, LMagLen, System.Length(LNewMag), UInt32(0)); end else begin @@ -998,7 +998,7 @@ class procedure TBigInteger.ShiftRightInPlace(const AStart: Int32; var AMag: TCr begin AMag[LI] := AMag[LI - LDelta]; end; - TArrayUtilities.Fill(AMag, AStart, LNInts, UInt32(0)); + TArrayUtilities.Fill(AMag, AStart, LNInts, UInt32(0)); end; if LNBits <> 0 then begin @@ -1129,7 +1129,7 @@ class function TBigInteger.Divide(var AX: TCryptoLibUInt32Array; const AY: TCryp if LXYCmp = 0 then begin LCount := AddMagnitudes(LCount, FOne.FMagnitude); - TArrayUtilities.Fill(AX, LXStart, System.Length(AX), UInt32(0)); + TArrayUtilities.Fill(AX, LXStart, System.Length(AX), UInt32(0)); end; Result := LCount; end; @@ -1234,7 +1234,7 @@ class function TBigInteger.Remainder(var AX: TCryptoLibUInt32Array; const AY: TC end; if LXYCmp = 0 then begin - TArrayUtilities.Fill(AX, LXStart, System.Length(AX), UInt32(0)); + TArrayUtilities.Fill(AX, LXStart, System.Length(AX), UInt32(0)); end; Result := AX; end; @@ -1911,7 +1911,7 @@ function TBigInteger.Multiply(const AValue: TBigInteger): TBigInteger; end; LResLength := System.Length(FMagnitude) + System.Length(AValue.FMagnitude); System.SetLength(LRes, LResLength); - TArrayUtilities.Fill(LRes, 0, System.Length(LRes), UInt32(0)); + TArrayUtilities.Fill(LRes, 0, System.Length(LRes), UInt32(0)); Multiply(LRes, FMagnitude, AValue.FMagnitude); LResSign := FSign xor AValue.FSign xor 1; Result := TBigInteger.Create(LResSign, LRes, True); diff --git a/CryptoLib/src/Math/ClpBigIntegerUtilities.pas b/CryptoLib/src/Math/ClpBigIntegerUtilities.pas index 7ddd5a72..437e4b0c 100644 --- a/CryptoLib/src/Math/ClpBigIntegerUtilities.pas +++ b/CryptoLib/src/Math/ClpBigIntegerUtilities.pas @@ -274,7 +274,7 @@ class function TBigIntegerUtilities.AsUnsignedByteArray(const ALength: Int32; co LPadLen := ALength - LBytesLength; System.SetLength(Result, ALength); - TArrayUtilities.Fill(Result, 0, LPadLen, Byte(0)); + TArrayUtilities.Fill(Result, 0, LPadLen, Byte(0)); System.Move(LBytes[0], Result[LPadLen], LBytesLength * System.SizeOf(Byte)); end; @@ -291,7 +291,7 @@ class procedure TBigIntegerUtilities.AsUnsignedByteArray(const AN: TBigInteger; raise EArgumentCryptoLibException.CreateRes(@SStandardLengthExceeded); LPadLen := ALen - LBytesLength; - TArrayUtilities.Fill(ABuf, AOff, AOff + LPadLen, Byte(0)); + TArrayUtilities.Fill(ABuf, AOff, AOff + LPadLen, Byte(0)); System.Move(LBytes[0], ABuf[AOff + LPadLen], LBytesLength * System.SizeOf(Byte)); end; diff --git a/CryptoLib/src/Math/EC/Multiplier/ClpWNafUtilities.pas b/CryptoLib/src/Math/EC/Multiplier/ClpWNafUtilities.pas index 230fdc95..ebedd6df 100644 --- a/CryptoLib/src/Math/EC/Multiplier/ClpWNafUtilities.pas +++ b/CryptoLib/src/Math/EC/Multiplier/ClpWNafUtilities.pas @@ -529,7 +529,7 @@ class function TWNafUtilities.GenerateNaf(const AK: TBigInteger): TCryptoLibByte L3k := AK.ShiftLeft(1).Add(AK); LDigits := L3k.BitLength - 1; System.SetLength(Result, LDigits); - TArrayUtilities.Fill(Result, 0, LDigits, Byte(0)); + TArrayUtilities.Fill(Result, 0, LDigits, Byte(0)); LDiff := L3k.&Xor(AK); LI := 1; while LI < LDigits do @@ -570,7 +570,7 @@ class function TWNafUtilities.GenerateWindowNaf(AWidth: Int32; end; LResultLength := AK.BitLength + 1; System.SetLength(Result, LResultLength); - TArrayUtilities.Fill(Result, 0, LResultLength, Byte(0)); + TArrayUtilities.Fill(Result, 0, LResultLength, Byte(0)); LPow2 := 1 shl AWidth; LMask := LPow2 - 1; LSign := TBitOperations.Asr32(LPow2, 1); @@ -612,7 +612,7 @@ class function TWNafUtilities.GenerateJsf(const AG, AH: TBigInteger): TCryptoLib begin LDigits := Math.Max(AG.BitLength, AH.BitLength) + 1; System.SetLength(LJsf, LDigits); - TArrayUtilities.Fill(LJsf, 0, LDigits, Byte(0)); + TArrayUtilities.Fill(LJsf, 0, LDigits, Byte(0)); LK0 := AG; LK1 := AH; LJ := 0; @@ -700,7 +700,7 @@ class function TWNafUtilities.GenerateCompactNaf(const AK: TBigInteger): TCrypto LBits := L3k.BitLength; LResultLength := TBitOperations.Asr32(LBits, 1); System.SetLength(Result, LResultLength); - TArrayUtilities.Fill(Result, 0, LResultLength, Int32(0)); + TArrayUtilities.Fill(Result, 0, LResultLength, Int32(0)); LDiff := L3k.&Xor(AK); LHighBit := LBits - 1; LLength := 0; @@ -752,7 +752,7 @@ class function TWNafUtilities.GenerateCompactWindowNaf(AWidth: Int32; end; LResultLength := AK.BitLength div AWidth + 1; System.SetLength(Result, LResultLength); - TArrayUtilities.Fill(Result, 0, LResultLength, Int32(0)); + TArrayUtilities.Fill(Result, 0, LResultLength, Int32(0)); LPow2 := 1 shl AWidth; LMask := LPow2 - 1; LSign := TBitOperations.Asr32(LPow2, 1); diff --git a/CryptoLib/src/Math/EC/Rfc7748/ClpX25519Field.pas b/CryptoLib/src/Math/EC/Rfc7748/ClpX25519Field.pas index 6d0313c1..65813449 100644 --- a/CryptoLib/src/Math/EC/Rfc7748/ClpX25519Field.pas +++ b/CryptoLib/src/Math/EC/Rfc7748/ClpX25519Field.pas @@ -786,7 +786,7 @@ class procedure TX25519Field.Normalize(AZ: TCryptoLibInt32Array); class procedure TX25519Field.One(AZ: TCryptoLibInt32Array); begin AZ[0] := 1; - TArrayUtilities.Fill(AZ, 1, Size, 0); + TArrayUtilities.Fill(AZ, 1, Size, 0); end; class procedure TX25519Field.PowPm5d8(const AX: TCryptoLibInt32Array; const ARx2: TCryptoLibInt32Array; @@ -1004,7 +1004,7 @@ class procedure TX25519Field.SubOne(AZ: TCryptoLibInt32Array); class procedure TX25519Field.Zero(AZ: TCryptoLibInt32Array); begin - TArrayUtilities.Fill(AZ, 0, Size, 0); + TArrayUtilities.Fill(AZ, 0, Size, 0); end; end. diff --git a/CryptoLib/src/Math/EC/Rfc7748/ClpX448Field.pas b/CryptoLib/src/Math/EC/Rfc7748/ClpX448Field.pas index e30c8a8b..3dcaf45b 100644 --- a/CryptoLib/src/Math/EC/Rfc7748/ClpX448Field.pas +++ b/CryptoLib/src/Math/EC/Rfc7748/ClpX448Field.pas @@ -1127,7 +1127,7 @@ class procedure TX448Field.SubOne(AZ: TCryptoLibUInt32Array); class procedure TX448Field.Zero(AZ: TCryptoLibUInt32Array); begin - TArrayUtilities.Fill(AZ, 0, Size, 0); + TArrayUtilities.Fill(AZ, 0, Size, 0); end; end. diff --git a/CryptoLib/src/Math/EC/Rfc8032/ClpEd25519.pas b/CryptoLib/src/Math/EC/Rfc8032/ClpEd25519.pas index 96bbd8bd..e5ee7b13 100644 --- a/CryptoLib/src/Math/EC/Rfc8032/ClpEd25519.pas +++ b/CryptoLib/src/Math/EC/Rfc8032/ClpEd25519.pas @@ -1894,7 +1894,7 @@ procedure TEd25519.TExpandedKey.GeneratePrivateKey(const ARandom: ISecureRandom; FOwner.GeneratePrivateKey(ARandom, LSk); ExpandPrivateKey(LSk, 0, AXk, AXkOff); finally - TArrayUtilities.Fill(LSk, 0, System.Length(LSk), 0); + TArrayUtilities.Fill(LSk, 0, System.Length(LSk), 0); end; end; diff --git a/CryptoLib/src/Math/Raw/ClpNat.pas b/CryptoLib/src/Math/Raw/ClpNat.pas index c8fed3d3..dc4d2eba 100644 --- a/CryptoLib/src/Math/Raw/ClpNat.pas +++ b/CryptoLib/src/Math/Raw/ClpNat.pas @@ -3201,7 +3201,7 @@ class procedure TNat.Zero(ALen: Int32; AZ: TCryptoLibUInt32Array); end; if LI < ALen then begin - TArrayUtilities.Fill(AZ, LI, ALen, UInt32(0)); + TArrayUtilities.Fill(AZ, LI, ALen, UInt32(0)); end; end; @@ -3222,7 +3222,7 @@ class procedure TNat.Zero(ALen: Int32; AZ: TCryptoLibUInt32Array; AZOff: Int32); end; if LI < ALen then begin - TArrayUtilities.Fill(AZ, AZOff + LI, AZOff + ALen, UInt32(0)); + TArrayUtilities.Fill(AZ, AZOff + LI, AZOff + ALen, UInt32(0)); end; end; @@ -3243,7 +3243,7 @@ class procedure TNat.Zero64(ALen: Int32; AZ: TCryptoLibUInt64Array); end; if LI < ALen then begin - TArrayUtilities.Fill(AZ, LI, ALen, UInt64(0)); + TArrayUtilities.Fill(AZ, LI, ALen, UInt64(0)); end; end; @@ -3264,7 +3264,7 @@ class procedure TNat.Zero64(ALen: Int32; AZ: TCryptoLibUInt64Array; AZOff: Int32 end; if LI < ALen then begin - TArrayUtilities.Fill(AZ, AZOff + LI, AZOff + ALen, UInt64(0)); + TArrayUtilities.Fill(AZ, AZOff + LI, AZOff + ALen, UInt64(0)); end; end; diff --git a/CryptoLib/src/Math/Raw/ClpNat128.pas b/CryptoLib/src/Math/Raw/ClpNat128.pas index fb79f07c..fb14bb63 100644 --- a/CryptoLib/src/Math/Raw/ClpNat128.pas +++ b/CryptoLib/src/Math/Raw/ClpNat128.pas @@ -1106,7 +1106,7 @@ class function TNat128.ToBigInteger64(const AX: TCryptoLibUInt64Array): TBigInte class procedure TNat128.Zero(const AZ: TCryptoLibUInt32Array); begin - TArrayUtilities.Fill(AZ, 0, 4, UInt32(0)); + TArrayUtilities.Fill(AZ, 0, 4, UInt32(0)); end; end. diff --git a/CryptoLib/src/Math/Raw/ClpNat160.pas b/CryptoLib/src/Math/Raw/ClpNat160.pas index 44910b47..4b77a9b3 100644 --- a/CryptoLib/src/Math/Raw/ClpNat160.pas +++ b/CryptoLib/src/Math/Raw/ClpNat160.pas @@ -1134,7 +1134,7 @@ class function TNat160.ToBigInteger(const AX: TCryptoLibUInt32Array): TBigIntege class procedure TNat160.Zero(const AZ: TCryptoLibUInt32Array); begin - TArrayUtilities.Fill(AZ, 0, 5, UInt32(0)); + TArrayUtilities.Fill(AZ, 0, 5, UInt32(0)); end; end. diff --git a/CryptoLib/src/Math/Raw/ClpNat192.pas b/CryptoLib/src/Math/Raw/ClpNat192.pas index 890113ce..3bd2e8e1 100644 --- a/CryptoLib/src/Math/Raw/ClpNat192.pas +++ b/CryptoLib/src/Math/Raw/ClpNat192.pas @@ -1245,7 +1245,7 @@ class function TNat192.ToBigInteger64(const AX: TCryptoLibUInt64Array): TBigInte class procedure TNat192.Zero(AZ: TCryptoLibUInt32Array); begin - TArrayUtilities.Fill(AZ, 0, 6, UInt32(0)); + TArrayUtilities.Fill(AZ, 0, 6, UInt32(0)); end; end. diff --git a/CryptoLib/src/Math/Raw/ClpNat224.pas b/CryptoLib/src/Math/Raw/ClpNat224.pas index 9fe83a94..2f4c053f 100644 --- a/CryptoLib/src/Math/Raw/ClpNat224.pas +++ b/CryptoLib/src/Math/Raw/ClpNat224.pas @@ -1400,7 +1400,7 @@ class function TNat224.ToBigInteger(const AX: TCryptoLibUInt32Array): TBigIntege class procedure TNat224.Zero(AZ: TCryptoLibUInt32Array); begin - TArrayUtilities.Fill(AZ, 0, 7, UInt32(0)); + TArrayUtilities.Fill(AZ, 0, 7, UInt32(0)); end; end. diff --git a/CryptoLib/src/Math/Raw/ClpNat256.pas b/CryptoLib/src/Math/Raw/ClpNat256.pas index 8a00a195..e35ef204 100644 --- a/CryptoLib/src/Math/Raw/ClpNat256.pas +++ b/CryptoLib/src/Math/Raw/ClpNat256.pas @@ -1939,22 +1939,22 @@ class procedure TNat256.XorToEachOther64(AU: TCryptoLibUInt64Array; AUOff: Int32 class procedure TNat256.Zero(AZ: TCryptoLibUInt32Array); begin - TArrayUtilities.Fill(AZ, 0, 8, UInt32(0)); + TArrayUtilities.Fill(AZ, 0, 8, UInt32(0)); end; class procedure TNat256.Zero(AZ: TCryptoLibUInt32Array; AZOff: Int32); begin - TArrayUtilities.Fill(AZ, AZOff, AZOff + 8, UInt32(0)); + TArrayUtilities.Fill(AZ, AZOff, AZOff + 8, UInt32(0)); end; class procedure TNat256.Zero64(AZ: TCryptoLibUInt64Array); begin - TArrayUtilities.Fill(AZ, 0, 4, UInt64(0)); + TArrayUtilities.Fill(AZ, 0, 4, UInt64(0)); end; class procedure TNat256.Zero64(AZ: TCryptoLibUInt64Array; AZOff: Int32); begin - TArrayUtilities.Fill(AZ, AZOff, AZOff + 4, UInt64(0)); + TArrayUtilities.Fill(AZ, AZOff, AZOff + 4, UInt64(0)); end; end. diff --git a/CryptoLib/src/Math/Raw/ClpNat512.pas b/CryptoLib/src/Math/Raw/ClpNat512.pas index e26cc61a..67326546 100644 --- a/CryptoLib/src/Math/Raw/ClpNat512.pas +++ b/CryptoLib/src/Math/Raw/ClpNat512.pas @@ -403,22 +403,22 @@ class procedure TNat512.XorToEachOther64(AU: TCryptoLibUInt64Array; AUOff: Int32 class procedure TNat512.Zero(AZ: TCryptoLibUInt32Array); begin - TArrayUtilities.Fill(AZ, 0, 16, UInt32(0)); + TArrayUtilities.Fill(AZ, 0, 16, UInt32(0)); end; class procedure TNat512.Zero(AZ: TCryptoLibUInt32Array; AZOff: Int32); begin - TArrayUtilities.Fill(AZ, AZOff, AZOff + 16, UInt32(0)); + TArrayUtilities.Fill(AZ, AZOff, AZOff + 16, UInt32(0)); end; class procedure TNat512.Zero64(AZ: TCryptoLibUInt64Array); begin - TArrayUtilities.Fill(AZ, 0, 8, UInt64(0)); + TArrayUtilities.Fill(AZ, 0, 8, UInt64(0)); end; class procedure TNat512.Zero64(AZ: TCryptoLibUInt64Array; AZOff: Int32); begin - TArrayUtilities.Fill(AZ, AZOff, AZOff + 8, UInt64(0)); + TArrayUtilities.Fill(AZ, AZOff, AZOff + 8, UInt64(0)); end; end. diff --git a/CryptoLib/src/Rngs/Providers/ClpAesRandomProvider.pas b/CryptoLib/src/Rngs/Providers/ClpAesRandomProvider.pas index b7a01340..fd08d08b 100644 --- a/CryptoLib/src/Rngs/Providers/ClpAesRandomProvider.pas +++ b/CryptoLib/src/Rngs/Providers/ClpAesRandomProvider.pas @@ -195,8 +195,8 @@ procedure TAesRandomProvider.DoSeedLocked( FCipher.Init(True, TKeyParameter.Create(LNewKey) as IKeyParameter); FBytesSinceSeed := 0; finally - TArrayUtilities.Fill(LMix, 0, System.Length(LMix), Byte(0)); - TArrayUtilities.Fill(LNewKey, 0, System.Length(LNewKey), Byte(0)); + TArrayUtilities.Fill(LMix, 0, System.Length(LMix), Byte(0)); + TArrayUtilities.Fill(LNewKey, 0, System.Length(LNewKey), Byte(0)); end; end; @@ -223,7 +223,7 @@ constructor TAesRandomProvider.Create(const AAesRngSeed: TCryptoLibByteArray; FCipher.Init(True, TKeyParameter.Create(LAesRngSeed) as IKeyParameter); FBytesSinceSeed := 0; - TArrayUtilities.Fill(LAesRngSeed, 0, System.Length(LAesRngSeed), Byte(0)); + TArrayUtilities.Fill(LAesRngSeed, 0, System.Length(LAesRngSeed), Byte(0)); end; constructor TAesRandomProvider.Create(AAesRngSeedLength, @@ -236,7 +236,7 @@ constructor TAesRandomProvider.Create(AAesRngSeedLength, GetRawEntropy(LSeed); // pure entropy from OS Create(LSeed, AReseedAfterBytes); finally - TArrayUtilities.Fill(LSeed, 0, System.Length(LSeed), Byte(0)); + TArrayUtilities.Fill(LSeed, 0, System.Length(LSeed), Byte(0)); end; end; @@ -268,7 +268,7 @@ procedure TAesRandomProvider.GetBytes(const AData: TCryptoLibByteArray); GetRawEntropy(LSeed); DoSeedLocked(LSeed); finally - TArrayUtilities.Fill(LSeed, 0, System.Length(LSeed), Byte(0)); + TArrayUtilities.Fill(LSeed, 0, System.Length(LSeed), Byte(0)); end; end; @@ -294,10 +294,10 @@ procedure TAesRandomProvider.GetBytes(const AData: TCryptoLibByteArray); System.Inc(FBytesSinceSeed, LDataLength); // Zero the bytes we did NOT consume so they cannot be read from the // heap after LResult is released. - TArrayUtilities.Fill(LResult, LDataLength, + TArrayUtilities.Fill(LResult, LDataLength, System.Length(LResult) - LDataLength, Byte(0)); finally - TArrayUtilities.Fill(LResult, 0, + TArrayUtilities.Fill(LResult, 0, System.Length(LResult), Byte(0)); end; end;