Don't usePinned where not necessary
This commit is contained in:
parent
8cacf80491
commit
9541124a4a
@ -559,12 +559,10 @@ public object Secp256k1Native : Secp256k1 {
|
||||
vssCommitments.forEachIndexed { index, commitments ->
|
||||
val pubkeyArray = allocArray<secp256k1_pubkey>(commitments.size)
|
||||
commitments.forEachIndexed { commitmentIndex, pubkeyData ->
|
||||
pubkeyData.usePinned { pinned ->
|
||||
if (secp256k1_ec_pubkey_parse(ctx, pubkeyArray[commitmentIndex].ptr, toNat(pinned.get()), pubkeyData.size.convert()) == 0) {
|
||||
if (secp256k1_ec_pubkey_parse(ctx, pubkeyArray[commitmentIndex].ptr, toNat(pubkeyData), pubkeyData.size.convert()) == 0) {
|
||||
error("Failed to parse public key")
|
||||
}
|
||||
}
|
||||
}
|
||||
nVssCommitments[index] = pubkeyArray
|
||||
}
|
||||
|
||||
@ -605,20 +603,24 @@ public object Secp256k1Native : Secp256k1 {
|
||||
|
||||
memScoped {
|
||||
val nFrostShare = allocFrostShare(share)
|
||||
// val nVssCommitment = vssCommitment.map { allocPublicKey(it).ptr }.toCValues()
|
||||
// val nVssCommitment = vssCommitment.map { allocPublicKey(it).ptr }
|
||||
|
||||
val nVssCommitment = allocArray<CPointerVar<secp256k1_pubkey>>(vssCommitment.size)
|
||||
vssCommitment.forEachIndexed { index, pubkeyData ->
|
||||
pubkeyData.usePinned { pinned ->
|
||||
if (secp256k1_ec_pubkey_parse(ctx, nVssCommitment[index], toNat(pinned.get()), pubkeyData.size.convert()) == 0) {
|
||||
error("Failed to parse public key")
|
||||
}
|
||||
}
|
||||
vssCommitment.forEachIndexed { index, bytes ->
|
||||
memcpy(nVssCommitment[index], bytes.refTo(0).getPointer(memScope), bytes.size.convert())
|
||||
}
|
||||
// val nVssCommitment = allocArray<CPointerVar<secp256k1_pubkey>>(vssCommitment.size)
|
||||
// vssCommitment.forEachIndexed { index, pubkeyData ->
|
||||
// pubkeyData.usePinned { pinned ->
|
||||
// if (secp256k1_ec_pubkey_parse(ctx, nVssCommitment[index], toNat(pinned.get()), pubkeyData.size.convert()) == 0) {
|
||||
// error("Failed to parse public key")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return secp256k1_frost_share_verify(
|
||||
ctx = ctx,
|
||||
threshold = vssCommitment.size.convert(),
|
||||
threshold = threshold.convert(),
|
||||
id33 = toNat(id33),
|
||||
share = nFrostShare.ptr,
|
||||
vss_commitment = nVssCommitment
|
||||
@ -652,12 +654,10 @@ public object Secp256k1Native : Secp256k1 {
|
||||
vssCommitments.forEachIndexed { index, commitments ->
|
||||
val pubkeyArray = allocArray<secp256k1_pubkey>(commitments.size)
|
||||
commitments.forEachIndexed { commitmentIndex, pubkeyData ->
|
||||
pubkeyData.usePinned { pinned ->
|
||||
if (secp256k1_ec_pubkey_parse(ctx, pubkeyArray[commitmentIndex].ptr, toNat(pinned.get()), pubkeyData.size.convert()) == 0) {
|
||||
if (secp256k1_ec_pubkey_parse(ctx, pubkeyArray[commitmentIndex].ptr, toNat(pubkeyData), pubkeyData.size.convert()) == 0) {
|
||||
error("Failed to parse public key")
|
||||
}
|
||||
}
|
||||
}
|
||||
nVssCommitments[index] = pubkeyArray
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user