Skip to content

Commit 79f2880

Browse files
committed
Change the FIPS issue fixing code with the feedback
1 parent 0485080 commit 79f2880

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

src/Storage/ChangeLog.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21-
21+
* Fix the issue that upload Blob and upload File cmdlets fail on FIPS policy enabled machines
22+
- Set-AzureStorageBlobContent
23+
- Set-AzureStorageFileContent
24+
2225
## Version 4.2.0
2326
* Support Soft-Delete feature
2427
- Enable-AzureStorageDeleteRetentionPolicy

src/Storage/Commands.Storage/Blob/Cmdlet/SetAzureStorageBlobContent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ public override void ExecuteCmdlet()
501501
}
502502

503503
// if FIPS policy is enabled, must use native MD5
504-
if (FIPSEnabled)
504+
if (fipsEnabled)
505505
{
506506
CloudStorageAccount.UseV1MD5 = false;
507507
}

src/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -626,28 +626,19 @@ protected override void StopProcessing()
626626
/// <summary>
627627
/// true if FIPS policy is enabled on the current machine
628628
/// </summary>
629-
protected static bool FIPSEnabled
629+
public static bool fipsEnabled { get; } = IsFIPSEnabled();
630+
631+
internal static bool IsFIPSEnabled()
630632
{
631-
get
633+
try
632634
{
633-
if (fIPSEnabled.HasValue)
634-
{
635-
return fIPSEnabled.Value;
636-
}
637-
638-
try
639-
{
640-
System.Security.Cryptography.MD5.Create();
641-
}
642-
catch (System.Reflection.TargetInvocationException)
643-
{
644-
fIPSEnabled = true;
645-
return true;
646-
}
647-
fIPSEnabled = false;
635+
System.Security.Cryptography.MD5.Create();
648636
return false;
649637
}
638+
catch (System.Reflection.TargetInvocationException)
639+
{
640+
return true;
641+
}
650642
}
651-
private static bool? fIPSEnabled = null;
652643
}
653644
}

src/Storage/Commands.Storage/File/Cmdlet/SetAzureStorageFileContent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public override void ExecuteCmdlet()
8181
}
8282

8383
// if FIPS policy is enabled, must use native MD5
84-
if (FIPSEnabled)
84+
if (fipsEnabled)
8585
{
8686
CloudStorageAccount.UseV1MD5 = false;
8787
}

0 commit comments

Comments
 (0)