From c11e0f9da00fd53f14fba442b1dfb11123775e9a Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 4 Sep 2020 15:31:54 +0700 Subject: Remove unnecessary locking - see https://github.com/bcgit/bc-java/issues/778 --- crypto/src/math/ec/ECCurve.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crypto/src') diff --git a/crypto/src/math/ec/ECCurve.cs b/crypto/src/math/ec/ECCurve.cs index 7d60e5f99..f011b1baf 100644 --- a/crypto/src/math/ec/ECCurve.cs +++ b/crypto/src/math/ec/ECCurve.cs @@ -433,18 +433,17 @@ namespace Org.BouncyCastle.Math.EC } /** - * Sets the default ECMultiplier, unless already set. + * Sets the default ECMultiplier, unless already set. + * + * We avoid locking for performance reasons, so there is no uniqueness guarantee. */ public virtual ECMultiplier GetMultiplier() { - lock (this) + if (this.m_multiplier == null) { - if (this.m_multiplier == null) - { - this.m_multiplier = CreateDefaultMultiplier(); - } - return this.m_multiplier; + this.m_multiplier = CreateDefaultMultiplier(); } + return this.m_multiplier; } /** -- cgit 1.4.1