Adds null comparison for operator ==
MODIFY
WalletWasabi/Crypto/BlindingRsaKey.cs
WalletWasabi/Crypto/BlindingRsaKey.cs
@@ -104,7 +104,12 @@ namespace WalletWasabi.Crypto
public static bool operator ==(BlindingRsaKey x, BlindingRsaKey y)
{
- // ToDo: add null comparisons for PrivateModulus, PrivateExponent, PublicModulus and PublicExponent, too, because == MUST never throw from nulls
+ if (ReferenceEquals(x, y)) return true;
+ if ((object)x == null ^ (object)y == null) return false;
+ if (x.PrivateExponent == null ^ y.PrivateExponent == null) return false;
+ if (x.PublicModulus == null ^ y.PublicModulus == null) return false;
+ if (x.PublicExponent == null ^ y.PublicExponent == null) return false;
+
return
x.PrivateModulus.Equals(y.PrivateModulus)
&& x.PrivateExponent.Equals(y.PrivateExponent)

MODIFY
WalletWasabi/Crypto/BlindingRsaPubKey.cs
WalletWasabi/Crypto/BlindingRsaPubKey.cs
@@ -102,7 +102,8 @@ namespace WalletWasabi.Crypto
public static bool operator ==(BlindingRsaPubKey x, BlindingRsaPubKey y)
{
- // ToDo: add null comparisons for Exponent and Modulus, too, because == MUST never throw from nulls
+ if (ReferenceEquals(x, y)) return true;
+ if ((object)x == null ^ (object)y == null) return false;
return
x.Modulus.Equals(y.Modulus)

Adds null comparison for operator ==