Skip to content

Commit 0efae8f

Browse files
committed
Make secp2561k1 submodule source point to https://github.com/bitcoin-core/secp256k1.git
1 parent 31ac769 commit 0efae8f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/nativeMain/kotlin/fr/acinq/secp256k1/Secp256k1Native.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package fr.acinq.secp256k1
33
import kotlinx.cinterop.*
44
import platform.posix.memcpy
55
import platform.posix.size_tVar
6-
import platform.posix.uint64_t
76
import secp256k1.*
87

98
@OptIn(ExperimentalUnsignedTypes::class, ExperimentalForeignApi::class)
@@ -308,11 +307,14 @@ public object Secp256k1Native : Secp256k1 {
308307
memcpy(n.ptr, toNat(it), Secp256k1.MUSIG2_PUBLIC_KEYAGG_CACHE_SIZE.toULong())
309308
n
310309
}
310+
// we make a native copy of sessionRandom32, which will be zeroed by secp256k1_musig_nonce_gen
311+
val sessionRand32 = allocArray<UByteVar>(32)
312+
memcpy(sessionRand32.pointed.ptr, toNat(sessionRandom32), 32u)
311313
secp256k1_musig_nonce_gen(
312314
ctx,
313315
secnonce.ptr,
314316
pubnonce.ptr,
315-
toNat(sessionRandom32),
317+
sessionRand32,
316318
privkey?.let { toNat(it) },
317319
nPubkey.ptr,
318320
msg32?.let { toNat(it) },

0 commit comments

Comments
 (0)