Skip to content

Commit 61ab4bd

Browse files
committed
Do not use in param in NBitcoin.Secp256k1 (Fix #1289)
1 parent a1aca86 commit 61ab4bd

File tree

4 files changed

+5
-21
lines changed

4 files changed

+5
-21
lines changed

NBitcoin.Secp256k1/NBitcoin.Secp256k1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313
<PropertyGroup>
1414
<TargetFrameworks>net6.0;netstandard2.1</TargetFrameworks>
15-
<Version Condition=" '$(Version)' == '' ">3.1.6</Version>
15+
<Version Condition=" '$(Version)' == '' ">3.2.0</Version>
1616
</PropertyGroup>
1717
<PropertyGroup>
1818
<DefineConstants>$(DefineConstants);SECP256K1_LIB;HAS_SPAN</DefineConstants>

NBitcoin/Secp256k1/ECPubKey.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -401,25 +401,9 @@ public ECPubKey GetSharedPubkey(ECPrivKey key)
401401
Secp256k1.GE pt = this.Q;
402402
ref readonly Secp256k1.Scalar s = ref key.sec;
403403
key.AssertNotDisposed();
404-
// Can't happen, NBitcoin enforces invariants.
405-
//secp256k1_scalar_set_b32(&s, scalar, &overflow);
406-
//if (overflow || secp256k1_scalar_is_zero(&s))
407-
//{
408-
// ret = 0;
409-
//}
410-
Span<byte> x = stackalloc byte[32];
411-
Span<byte> y = stackalloc byte[32];
412-
413404
res = pt.MultConst(s, 256);
414405
pt = res.ToGroupElement();
415-
416406
return new ECPubKey(new GE(pt.x.Normalize(), pt.y.Normalize()), ctx);
417-
/* Compute a hash of the point */
418-
//ret = hashfp(output, x, y, data);
419-
420-
// We have a ref over an undisposed secret here
421-
//secp256k1_scalar_clear(&s);
422-
//return ret;
423407
}
424408

425409
internal static int secp256k1_memcmp_var(ReadOnlySpan<byte> s1, ReadOnlySpan<byte> s2, int n)

NBitcoin/Secp256k1/GE.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,13 @@ public readonly GE MultiplyLambda()
181181
return new GE(x * beta, y, infinity);
182182
}
183183

184-
public GE(in FE x, in FE y, bool infinity)
184+
public GE(FE x, FE y, bool infinity)
185185
{
186186
this.x = x;
187187
this.y = y;
188188
this.infinity = infinity;
189189
}
190-
public GE(in FE x, in FE y)
190+
public GE(FE x, FE y)
191191
{
192192
this.x = x;
193193
this.y = y;

NBitcoin/Secp256k1/GEJ.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public static GEJ CONST(uint a, uint b, uint c, uint d, uint e, uint f, uint g,
4141
);
4242
}
4343

44-
public GEJ(in FE x, in FE y, in FE z, bool infinity)
44+
public GEJ(FE x, FE y, FE z, bool infinity)
4545
{
4646
this.x = x;
4747
this.y = y;
4848
this.z = z;
4949
this.infinity = infinity;
5050
}
51-
public GEJ(in FE x, in FE y, in FE z)
51+
public GEJ(FE x, FE y, FE z)
5252
{
5353
this.x = x;
5454
this.y = y;

0 commit comments

Comments
 (0)