Handle inputs/outputs and nulls correctly.
This commit is contained in:
@@ -270,10 +270,10 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
|
||||
/*
|
||||
* Class: fr_acinq_secp256k1_Secp256k1CFunctions
|
||||
* Method: secp256k1_frost_shares_gen
|
||||
* Signature: (J[B[BII[[B)[[[B
|
||||
* Signature: (J[BII[[B)[[[B
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256k1_1frost_1shares_1gen
|
||||
(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jint, jint, jobjectArray);
|
||||
(JNIEnv *, jclass, jlong, jbyteArray, jint, jint, jobjectArray);
|
||||
|
||||
/*
|
||||
* Class: fr_acinq_secp256k1_Secp256k1CFunctions
|
||||
|
||||
@@ -1340,11 +1340,47 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
|
||||
|
||||
/*
|
||||
* Class: fr_acinq_secp256k1_Secp256k1CFunctions
|
||||
* Method: secp256k1_frost_share_verify
|
||||
* Signature: (J[B[B[[B)I
|
||||
* Method: secp256k1_frost_shares_gen
|
||||
* Signature: (J[B[BII[[B)[[[B
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256k1_1frost_1share_1verify
|
||||
(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jobjectArray)
|
||||
JNIEXPORT jobjectArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256k1_1frost_1shares_1gen(JNIEnv *penv, jclass clazz, jlong jctx, jbyteArray jseed32, jint jthreshold, jint n_participants, jobjectArray jids33)
|
||||
{
|
||||
return 0;
|
||||
secp256k1_context *ctx = (secp256k1_context *)jctx;
|
||||
// This is what gets returned
|
||||
secp256k1_frost_share shares[n_participants];
|
||||
secp256k1_pubkey vss_commitment[n_participants];
|
||||
unsigned char pok64[64];
|
||||
|
||||
// This is what gets passed
|
||||
unsigned char seed32[32];
|
||||
|
||||
const unsigned char *ids[n_participants];
|
||||
|
||||
int result = 0;
|
||||
|
||||
result = secp256k1_frost_shares_gen(
|
||||
ctx,
|
||||
shares,
|
||||
vss_commitment,
|
||||
jpok64,
|
||||
jseed32,
|
||||
jthreshold,
|
||||
n_participants,
|
||||
jids33
|
||||
);
|
||||
|
||||
CHECKRESULT(!result, "secp256k1_frost_shares_gen failed");
|
||||
|
||||
jobjectArray output = (*penv)->NewObjectArray(penv, 3, jbyteArray, NULL);
|
||||
|
||||
jnonce = (*penv)->NewByteArray(penv, sizeof(shares));
|
||||
nonce_ptr = (*penv)->GetByteArrayElements(penv, jnonce, 0);
|
||||
memcpy(nonce_ptr, nonce, sizeof(nonce));
|
||||
(*penv)->ReleaseByteArrayElements(penv, jnonce, nonce_ptr, 0);
|
||||
|
||||
output[0];
|
||||
output[1];
|
||||
output[2];
|
||||
|
||||
return output;
|
||||
}
|
||||
Reference in New Issue
Block a user