Improve pointer handling logic

This commit is contained in:
kngako
2024-08-14 09:14:34 +02:00
parent 41ddd40691
commit 32ee077995
4 changed files with 28 additions and 24 deletions

View File

@@ -134,7 +134,7 @@ public class Secp256k1CFunctions {
* [1] vss_commitment: pointer to the VSS commitment
* [2] pok64: pointer to the proof of knowledge
*/
public static native byte[][][] secp256k1_frost_shares_gen(long ctx, byte[] seed32, int threshold, int total_signers, byte[][] ids33);
public static native byte[][][] secp256k1_frost_shares_gen(long ctx, byte[] pok64, byte[] seed32, int threshold, int total_signers, byte[][] ids33);
/**
* Aggregates shares

View File

@@ -135,8 +135,11 @@ public object NativeSecp256k1 : Secp256k1 {
totalSigners: Int,
ids33: Array<ByteArray>
): Triple<Array<ByteArray>, Array<ByteArray>, ByteArray> {
val pok64 = ByteArray(64)
val result = Secp256k1CFunctions.secp256k1_frost_shares_gen(
Secp256k1Context.getContext(),
pok64,
seed32,
threshold,
totalSigners,
@@ -146,7 +149,7 @@ public object NativeSecp256k1 : Secp256k1 {
return Triple(
result[0],
result[1],
result[2].first() // This is bad code...
pok64
)
}