github.com/ethereumproject/go-ethereum@v5.5.2+incompatible/crypto/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.c (about) 1 #include "org_bitcoin_NativeSecp256k1.h" 2 #include "include/secp256k1.h" 3 4 JNIEXPORT jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1verify 5 (JNIEnv* env, jclass classObject, jobject byteBufferObject) 6 { 7 unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); 8 int sigLen = *((int*)(data + 32)); 9 int pubLen = *((int*)(data + 32 + 4)); 10 11 return secp256k1_ecdsa_verify(data, 32, data+32+8, sigLen, data+32+8+sigLen, pubLen); 12 } 13 14 static void __javasecp256k1_attach(void) __attribute__((constructor)); 15 static void __javasecp256k1_detach(void) __attribute__((destructor)); 16 17 static void __javasecp256k1_attach(void) { 18 secp256k1_start(SECP256K1_START_VERIFY); 19 } 20 21 static void __javasecp256k1_detach(void) { 22 secp256k1_stop(); 23 }