Correct use of whitespace
This commit is contained in:
parent
28d255daca
commit
8b56662685
@ -1357,28 +1357,31 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
|
||||
JNIEXPORT jobjectArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256k1_1frost_1shares_1gen(JNIEnv *penv, jclass clazz, jlong jctx, jbyteArray jseed32, jint jthreshold, jint jn_participants, jobjectArray jids33)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context *)jctx;
|
||||
// This is what gets returned
|
||||
secp256k1_frost_share shares[jn_participants];
|
||||
secp256k1_pubkey vss_commitment[jthreshold];
|
||||
|
||||
secp256k1_frost_share *shares;
|
||||
secp256k1_pubkey* vss_commitment;
|
||||
unsigned char pok64[64];
|
||||
|
||||
size_t size;
|
||||
|
||||
// This is what gets passed
|
||||
jbyte *pubkeyBytes;
|
||||
|
||||
unsigned char seed32[32];
|
||||
const jbyte *ids33[jn_participants];
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
|
||||
if (jseed32 != NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
||||
if (jids33 != NULL)
|
||||
return NULL;
|
||||
|
||||
size = (*penv)->GetArrayLength(penv, jseed32);
|
||||
CHECKRESULT(size != 32, "invalid seed32 size");
|
||||
copy_bytes_from_java(penv, jseed32, size, seed32);
|
||||
}
|
||||
|
||||
const jbyte *ids33[jn_participants];
|
||||
// Copy over data from jids33
|
||||
if (jids33 != NULL)
|
||||
{
|
||||
size = (*penv)->GetArrayLength(penv, jids33);
|
||||
CHECKRESULT(size != jn_participants, "invalid ids33 size");
|
||||
for (i = 0; i < jn_participants; i++)
|
||||
@ -1387,7 +1390,6 @@ JNIEXPORT jobjectArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp2
|
||||
// TODO: Check id33 size is 33...
|
||||
ids33[i] = (*penv)->GetByteArrayElements(penv, id33, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int result = 0;
|
||||
|
||||
@ -1456,6 +1458,9 @@ JNIEXPORT jobjectArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp2
|
||||
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
|
||||
count = (*penv)->GetArrayLength(penv, jnonces);
|
||||
CHECKRESULT(count != jtotalShareCount, "jshares count should be total share count.");
|
||||
shares = calloc(count, sizeof(secp256k1_frost_share*));
|
||||
@ -1541,6 +1546,11 @@ JNIEXPORT jint JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256k1_1fr
|
||||
secp256k1_xonly_pubkey *vss_commitment;
|
||||
jbyte *jpub;
|
||||
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
|
||||
share = calloc(1, sizeof(secp256k1_frost_share));
|
||||
size = (*penv)->GetArrayLength(penv, jshare);
|
||||
// TODO: CHECKRESULT1(size != fr_acinq_secp256k1_Secp256k1CFunctions_SECP256K1_MUSIG_PUBLIC_NONCE_SIZE, "invalid public nonce size", free_nonces(pubnonces, count));
|
||||
@ -1589,8 +1599,12 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
|
||||
jbyteArray jvss_commitment;
|
||||
jbyte *jpubkey;
|
||||
|
||||
id33 = (*penv)->GetByteArrayElements(penv, jid33, 0);
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
|
||||
id33 = (*penv)->GetByteArrayElements(penv, jid33, 0);
|
||||
|
||||
count = (*penv)->GetArrayLength(penv, jvss_commitments);
|
||||
vss_commitments = calloc(count, sizeof(secp256k1_pubkey *));
|
||||
@ -1639,6 +1653,11 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
|
||||
secp256k1_xonly_pubkey public_key;
|
||||
jbyte *pub;
|
||||
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
|
||||
pub = (*penv)->GetByteArrayElements(penv, jpublicKey, 0);
|
||||
result = secp256k1_xonly_pubkey_parse(ctx, &public_key, (unsigned char *)pub);
|
||||
(*penv)->ReleaseByteArrayElements(penv, jpublicKey, pub, 0);
|
||||
@ -1675,16 +1694,19 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
|
||||
secp256k1_frost_tweak_cache tweak_cache;
|
||||
jbyte *tweak32 = (*penv)->GetByteArrayElements(penv, jtweak32, 0);;
|
||||
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
if (jtweak_cache == NULL)
|
||||
return NULL;
|
||||
if (jtweak32 == NULL)
|
||||
return NULL;
|
||||
|
||||
size = (*penv)->GetArrayLength(penv, jtweak_cache);
|
||||
CHECKRESULT(size != sizeof(secp256k1_frost_tweak_cache), "invalid tweak_cache size");
|
||||
copy_bytes_from_java(penv, jtweak_cache, size, tweak_cache.data);
|
||||
if (jtweak32 == NULL)
|
||||
return NULL;
|
||||
|
||||
CHECKRESULT((*penv)->GetArrayLength(penv, jtweak32) != 32, "tweak must be 32 bytes");
|
||||
tweak32 = (*penv)->GetByteArrayElements(penv, jtweak32, 0);
|
||||
|
||||
@ -1728,6 +1750,8 @@ JNIEXPORT jobjectArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp2
|
||||
secp256k1_frost_tweak_cache tweak_cache;
|
||||
jbyte *tweak32 = (*penv)->GetByteArrayElements(penv, jtweak32, 0);;
|
||||
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
if (jtweak_cache == NULL)
|
||||
@ -1776,7 +1800,6 @@ JNIEXPORT jobjectArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp2
|
||||
|
||||
int result = 0;
|
||||
|
||||
size_t size;
|
||||
secp256k1_frost_secnonce secnonce;
|
||||
secp256k1_frost_pubnonce pubnonce;
|
||||
unsigned char session_id32[32];
|
||||
@ -1790,6 +1813,8 @@ JNIEXPORT jobjectArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp2
|
||||
secp256k1_musig_keyagg_cache keyaggcache;
|
||||
unsigned char extra_input32[32];
|
||||
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
|
||||
@ -1810,8 +1835,6 @@ JNIEXPORT jobjectArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp2
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (jmsg32 != NULL)
|
||||
{
|
||||
size = (*penv)->GetArrayLength(penv, jmsg32);
|
||||
@ -1886,6 +1909,11 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
|
||||
secp256k1_frost_tweak_cache tweak_cache;
|
||||
secp256k1_pubkey adaptor;
|
||||
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
|
||||
count = (*penv)->GetArrayLength(penv, jpubnonces);
|
||||
CHECKRESULT(count <= 0, "public nonces count cannot be 0");
|
||||
|
||||
@ -1987,6 +2015,11 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
|
||||
jbyteArray jpsig;
|
||||
jbyte *ptr;
|
||||
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
|
||||
copy_bytes_from_java(penv, jsecnonce, fr_acinq_secp256k1_Secp256k1CFunctions_SECP256K1_MUSIG_SECRET_NONCE_SIZE, secnonce.data);
|
||||
|
||||
if (jagg_share != NULL) {
|
||||
@ -2045,6 +2078,11 @@ JNIEXPORT jint JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256k1_1fr
|
||||
|
||||
jbyte *ptr, *pubkeyBytes;
|
||||
|
||||
size_t size, count;
|
||||
|
||||
if (jctx == 0)
|
||||
return NULL;
|
||||
|
||||
ptr = (*penv)->GetByteArrayElements(penv, jpartial_sig, 0);
|
||||
result = secp256k1_frost_partial_sig_parse(ctx, &partial_sig, ptr);
|
||||
(*penv)->ReleaseByteArrayElements(penv, jpartial_sig, ptr, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user