Cleaning up comments
This commit is contained in:
parent
769f21783a
commit
7d5a29a9fd
|
|
@ -212,7 +212,7 @@ namespace Microsoft.AspNet.Security.DataProtection.Cng
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// Buffer contains sensitive key material; nuke.
|
// Buffer contains sensitive key material; delete.
|
||||||
UnsafeBufferUtil.SecureZeroMemory(pbTempSubkeys, cbTempSubkeys);
|
UnsafeBufferUtil.SecureZeroMemory(pbTempSubkeys, cbTempSubkeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -397,7 +397,7 @@ namespace Microsoft.AspNet.Security.DataProtection.Cng
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// Buffer contains sensitive material; nuke it.
|
// Buffer contains sensitive material; delete it.
|
||||||
UnsafeBufferUtil.SecureZeroMemory(pbTempSubkeys, cbTempSubkeys);
|
UnsafeBufferUtil.SecureZeroMemory(pbTempSubkeys, cbTempSubkeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ namespace Microsoft.AspNet.Security.DataProtection.Cng
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// The buffer contains key material, so nuke it.
|
// The buffer contains key material, so delete it.
|
||||||
UnsafeBufferUtil.SecureZeroMemory(pbSymmetricDecryptionSubkey, _symmetricAlgorithmSubkeyLengthInBytes);
|
UnsafeBufferUtil.SecureZeroMemory(pbSymmetricDecryptionSubkey, _symmetricAlgorithmSubkeyLengthInBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +280,7 @@ namespace Microsoft.AspNet.Security.DataProtection.Cng
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// The buffer contains key material, so nuke it.
|
// The buffer contains key material, so delete it.
|
||||||
UnsafeBufferUtil.SecureZeroMemory(pbSymmetricEncryptionSubkey, _symmetricAlgorithmSubkeyLengthInBytes);
|
UnsafeBufferUtil.SecureZeroMemory(pbSymmetricEncryptionSubkey, _symmetricAlgorithmSubkeyLengthInBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,7 @@ namespace Microsoft.AspNet.Security.DataProtection.Managed
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// nuke since these contain secret material
|
// delete since these contain secret material
|
||||||
Array.Clear(decryptedKdk, 0, decryptedKdk.Length);
|
Array.Clear(decryptedKdk, 0, decryptedKdk.Length);
|
||||||
Array.Clear(decryptionSubkey, 0, decryptionSubkey.Length);
|
Array.Clear(decryptionSubkey, 0, decryptionSubkey.Length);
|
||||||
Array.Clear(validationSubkey, 0, validationSubkey.Length);
|
Array.Clear(validationSubkey, 0, validationSubkey.Length);
|
||||||
|
|
@ -382,7 +382,7 @@ namespace Microsoft.AspNet.Security.DataProtection.Managed
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// nuke since these contain secret material
|
// delete since these contain secret material
|
||||||
Array.Clear(decryptedKdk, 0, decryptedKdk.Length);
|
Array.Clear(decryptedKdk, 0, decryptedKdk.Length);
|
||||||
Array.Clear(encryptionSubkey, 0, encryptionSubkey.Length);
|
Array.Clear(encryptionSubkey, 0, encryptionSubkey.Length);
|
||||||
Array.Clear(validationSubkey, 0, validationSubkey.Length);
|
Array.Clear(validationSubkey, 0, validationSubkey.Length);
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNet.Security.DataProtection.SP800_108
|
||||||
CryptoUtil.Assert(prfOutputSizeInBytes == prfOutput.Length, "prfOutputSizeInBytes == prfOutput.Length");
|
CryptoUtil.Assert(prfOutputSizeInBytes == prfOutput.Length, "prfOutputSizeInBytes == prfOutput.Length");
|
||||||
int numBytesToCopyThisIteration = Math.Min(prfOutputSizeInBytes, outputCount);
|
int numBytesToCopyThisIteration = Math.Min(prfOutputSizeInBytes, outputCount);
|
||||||
Buffer.BlockCopy(prfOutput, 0, output.Array, outputOffset, numBytesToCopyThisIteration);
|
Buffer.BlockCopy(prfOutput, 0, output.Array, outputOffset, numBytesToCopyThisIteration);
|
||||||
Array.Clear(prfOutput, 0, prfOutput.Length); // contains key material, so nuke it
|
Array.Clear(prfOutput, 0, prfOutput.Length); // contains key material, so delete it
|
||||||
|
|
||||||
// adjust offsets
|
// adjust offsets
|
||||||
outputOffset += numBytesToCopyThisIteration;
|
outputOffset += numBytesToCopyThisIteration;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ namespace Microsoft.AspNet.Security.DataProtection.SP800_108
|
||||||
BitHelpers.WriteTo(pbTempInputCounter, i);
|
BitHelpers.WriteTo(pbTempInputCounter, i);
|
||||||
|
|
||||||
// Step 4b: Hash. Win7 doesn't allow reusing hash algorithm objects after the final hash
|
// Step 4b: Hash. Win7 doesn't allow reusing hash algorithm objects after the final hash
|
||||||
// has been computed, so we'll just keep calling DuplicateHash on the original virgin
|
// has been computed, so we'll just keep calling DuplicateHash on the original
|
||||||
// hash handle. This offers a slight performance increase over allocating a new hash
|
// hash handle. This offers a slight performance increase over allocating a new hash
|
||||||
// handle for each iteration. We don't need to mess with any of this on Win8 since on
|
// handle for each iteration. We don't need to mess with any of this on Win8 since on
|
||||||
// that platform we use BCryptKeyDerivation directly, which offers superior performance.
|
// that platform we use BCryptKeyDerivation directly, which offers superior performance.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue