summaryrefslogtreecommitdiffstats
path: root/openssl/src/main
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2010-05-07 16:58:16 -0700
committerBrian Carlstrom <bdc@google.com>2010-05-07 20:54:17 -0700
commitec2f5930802944b7e418bb97849071f538b2523c (patch)
treebcc9e6794d55cc8c44fa4b9e405f7900c8dc6753 /openssl/src/main
parent0356c447b30e092bdc12a4b7288c08f5ef87534c (diff)
downloadlibcore-ec2f5930802944b7e418bb97849071f538b2523c.zip
libcore-ec2f5930802944b7e418bb97849071f538b2523c.tar.gz
libcore-ec2f5930802944b7e418bb97849071f538b2523c.tar.bz2
Moving most libcore .c files to .cpp
This change moves most of the libcore .c files to .cpp enough for them to compile. This was largely motivated by the desire to avoid using things like __attribute__ ((unused)) in .c files to supress warnings in a recent change. Change-Id: Ib967d9e16764ff805764e81362f945332080a06c
Diffstat (limited to 'openssl/src/main')
-rw-r--r--openssl/src/main/native/BNInterface.cpp (renamed from openssl/src/main/native/BNInterface.c)129
-rw-r--r--openssl/src/main/native/sub.mk2
2 files changed, 63 insertions, 68 deletions
diff --git a/openssl/src/main/native/BNInterface.c b/openssl/src/main/native/BNInterface.cpp
index c267f86..61fa529 100644
--- a/openssl/src/main/native/BNInterface.c
+++ b/openssl/src/main/native/BNInterface.cpp
@@ -25,7 +25,6 @@
#include <openssl/bn.h>
#include <stdio.h>
-#define mcSignednessBull void *
#ifndef FALSE
#define FALSE 0
#define TRUE 1
@@ -66,27 +65,23 @@ static int fourValidHandles (JNIEnv* env, void* a, void *b, void* c, void* d)
/**
* public static native int ERR_get_error();
*/
-static unsigned long NativeBN_ERR_get_error(JNIEnv* env __attribute__ ((unused)), jclass cls __attribute__ ((unused))) {
- unsigned long e = ERR_get_error();
- return e;
+static unsigned long NativeBN_ERR_get_error(JNIEnv*, jclass) {
+ return ERR_get_error();
}
/**
* public static native String ERR_error_string(int);
*/
-static jstring NativeBN_ERR_error_string(JNIEnv* env, jclass cls __attribute__ ((unused)), unsigned long e) {
- jstring returnJString = 0;
- char* errStr;
- errStr = ERR_error_string(e, NULL);
- returnJString = ((*env)->NewStringUTF(env, (mcSignednessBull)errStr));
- return returnJString;
+static jstring NativeBN_ERR_error_string(JNIEnv* env, jclass, unsigned long e) {
+ char* errStr = ERR_error_string(e, NULL);
+ return env->NewStringUTF(errStr);
}
/**
* public static native int BN_CTX_new()
*/
-static BN_CTX* NativeBN_BN_CTX_new(JNIEnv* env __attribute__ ((unused)), jclass cls __attribute__ ((unused))) {
+static BN_CTX* NativeBN_BN_CTX_new(JNIEnv*, jclass) {
return BN_CTX_new();
}
@@ -94,14 +89,14 @@ static BN_CTX* NativeBN_BN_CTX_new(JNIEnv* env __attribute__ ((unused)), jclass
/**
* public static native int BN_new()
*/
-static BIGNUM* NativeBN_BN_new(JNIEnv* env __attribute__ ((unused)), jclass cls __attribute__ ((unused))) {
+static BIGNUM* NativeBN_BN_new(JNIEnv*, jclass) {
return BN_new();
}
/**
* public static native int BN_free()
*/
-static void NativeBN_BN_free(JNIEnv* env __attribute__ ((unused)), jclass cls __attribute__ ((unused)), BIGNUM* a) {
+static void NativeBN_BN_free(JNIEnv* env, jclass, BIGNUM* a) {
if (!oneValidHandle(env, a)) return;
BN_free(a);
}
@@ -110,7 +105,7 @@ static void NativeBN_BN_free(JNIEnv* env __attribute__ ((unused)), jclass cls __
/**
* public static native int BN_cmp(int, int)
*/
-static int NativeBN_BN_cmp(JNIEnv* env __attribute__ ((unused)), jclass cls __attribute__ ((unused)), BIGNUM* a, BIGNUM* b) {
+static int NativeBN_BN_cmp(JNIEnv* env, jclass, BIGNUM* a, BIGNUM* b) {
if (!twoValidHandles(env, a, b)) return 1;
return BN_cmp(a, b);
}
@@ -118,7 +113,7 @@ static int NativeBN_BN_cmp(JNIEnv* env __attribute__ ((unused)), jclass cls __at
/**
* public static native int BN_copy(int, int)
*/
-static jboolean NativeBN_BN_copy(JNIEnv* env __attribute__ ((unused)), jclass cls __attribute__ ((unused)), BIGNUM* to, BIGNUM* from) {
+static jboolean NativeBN_BN_copy(JNIEnv* env, jclass, BIGNUM* to, BIGNUM* from) {
if (!twoValidHandles(env, to, from)) return FALSE;
return (BN_copy(to, from) != NULL);
}
@@ -127,7 +122,7 @@ static jboolean NativeBN_BN_copy(JNIEnv* env __attribute__ ((unused)), jclass cl
/**
* public static native int putULongInt(int, long, int)
*/
-static jboolean NativeBN_putULongInt(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a, unsigned long long dw, jboolean neg) {
+static jboolean NativeBN_putULongInt(JNIEnv* env, jclass, BIGNUM* a, unsigned long long dw, jboolean neg) {
if (!oneValidHandle(env, a)) return FALSE;
unsigned int hi = dw >> 32; // This shifts without sign extension.
int lo = (int)dw; // This truncates implicitely.
@@ -156,12 +151,12 @@ static jboolean NativeBN_putLongInt(JNIEnv* env, jclass cls, BIGNUM* a, long lon
/**
* public static native int BN_dec2bn(int, java.lang.String)
*/
-static int NativeBN_BN_dec2bn(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a, jstring str) {
+static int NativeBN_BN_dec2bn(JNIEnv* env, jclass, BIGNUM* a, jstring str) {
if (!oneValidHandle(env, a)) return -1;
- char* tmpStr = (char*)(*env)->GetStringUTFChars(env, str, NULL);
+ char* tmpStr = (char*)env->GetStringUTFChars(str, NULL);
if (tmpStr != NULL) {
int len = BN_dec2bn(&a, tmpStr);
- (*env)->ReleaseStringUTFChars(env, str, tmpStr);
+ env->ReleaseStringUTFChars(str, tmpStr);
return len; // len == 0: Error
}
else return -1; // Error outside BN.
@@ -170,12 +165,12 @@ static int NativeBN_BN_dec2bn(JNIEnv* env, jclass cls __attribute__ ((unused)),
/**
* public static native int BN_hex2bn(int, java.lang.String)
*/
-static int NativeBN_BN_hex2bn(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a, jstring str) {
+static int NativeBN_BN_hex2bn(JNIEnv* env, jclass, BIGNUM* a, jstring str) {
if (!oneValidHandle(env, a)) return -1;
- char* tmpStr = (char*)(*env)->GetStringUTFChars(env, str, NULL);
+ char* tmpStr = (char*)env->GetStringUTFChars(str, NULL);
if (tmpStr != NULL) {
int len = BN_hex2bn(&a, tmpStr);
- (*env)->ReleaseStringUTFChars(env, str, tmpStr);
+ env->ReleaseStringUTFChars(str, tmpStr);
return len; // len == 0: Error
}
else return -1; // Error outside BN.
@@ -184,17 +179,17 @@ static int NativeBN_BN_hex2bn(JNIEnv* env, jclass cls __attribute__ ((unused)),
/**
* public static native boolean BN_bin2bn(byte[], int, int, int)
*/
-static jboolean NativeBN_BN_bin2bn(JNIEnv* env, jclass cls __attribute__ ((unused)), jbyteArray arr, int len, jboolean neg, BIGNUM* ret) {
+static jboolean NativeBN_BN_bin2bn(JNIEnv* env, jclass, jbyteArray arr, int len, jboolean neg, BIGNUM* ret) {
if (!oneValidHandle(env, ret)) return FALSE;
jboolean success;
unsigned char * tmpBytes;
- tmpBytes = (unsigned char *)((*env)->GetPrimitiveArrayCritical(env, arr, 0));
+ tmpBytes = (unsigned char *)env->GetPrimitiveArrayCritical(arr, 0);
if (tmpBytes != NULL) {
success = (BN_bin2bn(tmpBytes, len, ret) != NULL);
if (neg) {
BN_set_negative(ret, 1);
}
- (*env)->ReleasePrimitiveArrayCritical(env, arr, tmpBytes, JNI_ABORT);
+ env->ReleasePrimitiveArrayCritical(arr, tmpBytes, JNI_ABORT);
return success;
}
else return -1; // Error outside BN. mc FIXME: what to do in this case? Does JNI throw exception itself?
@@ -208,15 +203,15 @@ static jboolean NativeBN_BN_bin2bn(JNIEnv* env, jclass cls __attribute__ ((unuse
* Also note that the same representation is used in the Cordoba Java Implementation of BigIntegers,
* whereof certain functionality is still being used.
*/
-static jboolean NativeBN_litEndInts2bn(JNIEnv* env, jclass cls __attribute__ ((unused)), jintArray arr, int len, jboolean neg, BIGNUM* ret) {
+static jboolean NativeBN_litEndInts2bn(JNIEnv* env, jclass, jintArray arr, int len, jboolean neg, BIGNUM* ret) {
if (!oneValidHandle(env, ret)) return FALSE;
bn_check_top(ret);
if (len > 0) {
BN_ULONG* tmpInts; // BN_ULONG is 4 Bytes on this system for sure, i.e. same as jint!
- tmpInts = (BN_ULONG*)((*env)->GetPrimitiveArrayCritical(env, arr, 0));
+ tmpInts = (BN_ULONG*)env->GetPrimitiveArrayCritical(arr, 0);
if ((tmpInts != NULL) && (bn_wexpand(ret, len) != NULL)) {
int i = len; do { i--; ret->d[i] = tmpInts[i]; } while (i > 0);
- (*env)->ReleasePrimitiveArrayCritical(env, arr, tmpInts, JNI_ABORT);
+ env->ReleasePrimitiveArrayCritical(arr, tmpInts, JNI_ABORT);
ret->top = len;
ret->neg = neg;
// need to call this due to clear byte at top if avoiding
@@ -227,7 +222,7 @@ static jboolean NativeBN_litEndInts2bn(JNIEnv* env, jclass cls __attribute__ ((u
}
else {
if (tmpInts != NULL)
- (*env)->ReleasePrimitiveArrayCritical(env, arr, tmpInts, JNI_ABORT);
+ env->ReleasePrimitiveArrayCritical(arr, tmpInts, JNI_ABORT);
return FALSE;
}
}
@@ -244,7 +239,7 @@ static jboolean NativeBN_litEndInts2bn(JNIEnv* env, jclass cls __attribute__ ((u
| (bytes[k + 1] & 0xFF) << 16 \
| (bytes[k + 0] & 0xFF) << 24 )
-static jboolean negBigEndianBytes2bn(JNIEnv* env __attribute__ ((unused)), jclass cls __attribute__ ((unused)), unsigned char* bytes, int bytesLen, BIGNUM* ret) {
+static jboolean negBigEndianBytes2bn(JNIEnv*, jclass, unsigned char* bytes, int bytesLen, BIGNUM* ret) {
// We rely on: (BN_BITS2 == 32), i.e. BN_ULONG is unsigned int and has 4 bytes:
//
bn_check_top(ret);
@@ -304,7 +299,7 @@ static jboolean NativeBN_twosComp2bn(JNIEnv* env, jclass cls, jbyteArray arr, in
if (!oneValidHandle(env, ret)) return FALSE;
jboolean success;
unsigned char* tmpBytes;
- tmpBytes = (unsigned char*)((*env)->GetPrimitiveArrayCritical(env, arr, 0));
+ tmpBytes = (unsigned char*)env->GetPrimitiveArrayCritical(arr, 0);
if (tmpBytes != NULL) {
if ((tmpBytes[0] & 0X80) == 0) { // Positive value!
//
@@ -320,7 +315,7 @@ static jboolean NativeBN_twosComp2bn(JNIEnv* env, jclass cls, jbyteArray arr, in
success = negBigEndianBytes2bn(env, cls, tmpBytes, bytesLen, ret);
BN_set_negative(ret, TRUE);
}
- (*env)->ReleasePrimitiveArrayCritical(env, arr, tmpBytes, JNI_ABORT);
+ env->ReleasePrimitiveArrayCritical(arr, tmpBytes, JNI_ABORT);
return success;
}
else return -1; // Error outside BN. mc FIXME: what to do in this case? Does JNI throw exception itself?
@@ -330,7 +325,7 @@ static jboolean NativeBN_twosComp2bn(JNIEnv* env, jclass cls, jbyteArray arr, in
/**
* public static native long longInt(int)
*/
-static long long NativeBN_longInt(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a) {
+static long long NativeBN_longInt(JNIEnv* env, jclass, BIGNUM* a) {
if (!oneValidHandle(env, a)) return -1;
bn_check_top(a);
int intLen = a->top;
@@ -364,14 +359,14 @@ static char* leadingZerosTrimmed(char* s) {
/**
* public static native java.lang.String BN_bn2dec(int)
*/
-static jstring NativeBN_BN_bn2dec(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a) {
+static jstring NativeBN_BN_bn2dec(JNIEnv* env, jclass, BIGNUM* a) {
if (!oneValidHandle(env, a)) return NULL;
char* tmpStr;
char* retStr;
tmpStr = BN_bn2dec(a);
if (tmpStr != NULL) {
retStr = leadingZerosTrimmed(tmpStr);
- jstring returnJString = ((*env)->NewStringUTF(env, (mcSignednessBull)retStr));
+ jstring returnJString = env->NewStringUTF(retStr);
OPENSSL_free(tmpStr);
return returnJString;
}
@@ -381,14 +376,14 @@ static jstring NativeBN_BN_bn2dec(JNIEnv* env, jclass cls __attribute__ ((unused
/**
* public static native java.lang.String BN_bn2hex(int)
*/
-static jstring NativeBN_BN_bn2hex(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a) {
+static jstring NativeBN_BN_bn2hex(JNIEnv* env, jclass, BIGNUM* a) {
if (!oneValidHandle(env, a)) return NULL;
char* tmpStr;
char* retStr;
tmpStr = BN_bn2hex(a);
if (tmpStr != NULL) {
retStr = leadingZerosTrimmed(tmpStr);
- jstring returnJString = ((*env)->NewStringUTF(env, (mcSignednessBull)retStr));
+ jstring returnJString = env->NewStringUTF(retStr);
OPENSSL_free(tmpStr);
return returnJString;
}
@@ -398,19 +393,19 @@ static jstring NativeBN_BN_bn2hex(JNIEnv* env, jclass cls __attribute__ ((unused
/**
* public static native byte[] BN_bn2bin(int, byte[])
*/
-static jbyteArray NativeBN_BN_bn2bin(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a, jbyteArray to) {
+static jbyteArray NativeBN_BN_bn2bin(JNIEnv* env, jclass, BIGNUM* a, jbyteArray to) {
if (!oneValidHandle(env, a)) return NULL;
jbyteArray returnJBytes = to;
unsigned char * tmpBytes;
int len, byteCnt;
byteCnt = BN_num_bytes(a);
// FIXME: Currently ignoring array passed in to:
- returnJBytes = (*env)->NewByteArray(env, byteCnt);
+ returnJBytes = env->NewByteArray(byteCnt);
// FIXME: is it neccessary to check for returnJBytes != NULL?
- tmpBytes = (unsigned char *)((*env)->GetPrimitiveArrayCritical(env, returnJBytes, NULL));
+ tmpBytes = (unsigned char *)env->GetPrimitiveArrayCritical(returnJBytes, NULL);
if (tmpBytes != NULL) {
len = BN_bn2bin(a, tmpBytes);
- (*env)->ReleasePrimitiveArrayCritical(env, returnJBytes, tmpBytes, 0);
+ env->ReleasePrimitiveArrayCritical(returnJBytes, tmpBytes, 0);
return returnJBytes;
}
else return NULL;
@@ -420,19 +415,19 @@ static jbyteArray NativeBN_BN_bn2bin(JNIEnv* env, jclass cls __attribute__ ((unu
* public static native int[] bn2litEndInts(int, int[])
* cf. litEndInts2bn
*/
-static jintArray NativeBN_bn2litEndInts(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a, jintArray to) {
+static jintArray NativeBN_bn2litEndInts(JNIEnv* env, jclass, BIGNUM* a, jintArray to) {
if (!oneValidHandle(env, a)) return NULL;
jintArray returnJInts = to;
bn_check_top(a);
int len = a->top;
if (len > 0) {
// FIXME: Currently ignoring array passed in to:
- returnJInts = (*env)->NewIntArray(env, len);
+ returnJInts = env->NewIntArray(len);
// FIXME: is it neccessary to check for returnJBytes != NULL?
- BN_ULONG* tmpInts = (BN_ULONG*)((*env)->GetPrimitiveArrayCritical(env, returnJInts, NULL));
+ BN_ULONG* tmpInts = (BN_ULONG*)env->GetPrimitiveArrayCritical(returnJInts, NULL);
if (tmpInts != NULL) {
int i = len; do { i--; tmpInts[i] = a->d[i]; } while (i > 0);
- (*env)->ReleasePrimitiveArrayCritical(env, returnJInts, tmpInts, 0);
+ env->ReleasePrimitiveArrayCritical(returnJInts, tmpInts, 0);
return returnJInts;
}
else return NULL;
@@ -446,7 +441,7 @@ static jintArray NativeBN_bn2litEndInts(JNIEnv* env, jclass cls __attribute__ ((
/**
* public static native int sign(int)
*/
-static int NativeBN_sign(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a) {
+static int NativeBN_sign(JNIEnv* env, jclass, BIGNUM* a) {
if (!oneValidHandle(env, a)) return -2;
if (BN_is_zero(a)) return 0;
else if (BN_is_negative(a)) return -1;
@@ -456,7 +451,7 @@ static int NativeBN_sign(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNU
/**
* public static native void BN_set_negative(int, int)
*/
-static void NativeBN_BN_set_negative(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* b, int n) {
+static void NativeBN_BN_set_negative(JNIEnv* env, jclass, BIGNUM* b, int n) {
if (!oneValidHandle(env, b)) return;
BN_set_negative(b, n);
}
@@ -464,7 +459,7 @@ static void NativeBN_BN_set_negative(JNIEnv* env, jclass cls __attribute__ ((unu
/**
* public static native int bitLength(int)
*/
-static int NativeBN_bitLength(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a) {
+static int NativeBN_bitLength(JNIEnv* env, jclass, BIGNUM* a) {
// We rely on: (BN_BITS2 == 32), i.e. BN_ULONG is unsigned int and has 4 bytes:
//
if (!oneValidHandle(env, a)) return FALSE;
@@ -487,7 +482,7 @@ static int NativeBN_bitLength(JNIEnv* env, jclass cls __attribute__ ((unused)),
/**
* public static native boolean BN_is_bit_set(int, int)
*/
-static jboolean NativeBN_BN_is_bit_set(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a, int n) {
+static jboolean NativeBN_BN_is_bit_set(JNIEnv* env, jclass, BIGNUM* a, int n) {
if (!oneValidHandle(env, a)) return FALSE;
return (jboolean)BN_is_bit_set(a, n);
}
@@ -495,7 +490,7 @@ static jboolean NativeBN_BN_is_bit_set(JNIEnv* env, jclass cls __attribute__ ((u
/**
* public static native void modifyBit(int, int, int)
*/
-static jboolean NativeBN_modifyBit(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* a, int n, int op) {
+static jboolean NativeBN_modifyBit(JNIEnv* env, jclass, BIGNUM* a, int n, int op) {
// LOGD("NativeBN_BN_modifyBit");
if (!oneValidHandle(env, a)) return FALSE;
switch (op) {
@@ -511,7 +506,7 @@ static jboolean NativeBN_modifyBit(JNIEnv* env, jclass cls __attribute__ ((unuse
/**
* public static native int BN_shift(int, int, int)
*/
-static jboolean NativeBN_BN_shift(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* r, BIGNUM* a, int n) {
+static jboolean NativeBN_BN_shift(JNIEnv* env, jclass, BIGNUM* r, BIGNUM* a, int n) {
if (!twoValidHandles(env, r, a)) return FALSE;
return (n >= 0) ? BN_lshift(r, a, n) : BN_rshift(r, a, -n);
}
@@ -519,7 +514,7 @@ static jboolean NativeBN_BN_shift(JNIEnv* env, jclass cls __attribute__ ((unused
/**
* public static native boolean BN_add_word(int, int)
*/
-static jboolean NativeBN_BN_add_word(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM *a, BN_ULONG w) {
+static jboolean NativeBN_BN_add_word(JNIEnv* env, jclass, BIGNUM *a, BN_ULONG w) {
if (!oneValidHandle(env, a)) return FALSE;
return BN_add_word(a, w);
}
@@ -527,7 +522,7 @@ static jboolean NativeBN_BN_add_word(JNIEnv* env, jclass cls __attribute__ ((unu
/**
* public static native boolean BN_sub_word(int, int)
*/
-static jboolean NativeBN_BN_sub_word(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM *a, BN_ULONG w) {
+static jboolean NativeBN_BN_sub_word(JNIEnv* env, jclass, BIGNUM *a, BN_ULONG w) {
if (!oneValidHandle(env, a)) return FALSE;
return BN_sub_word(a, w);
}
@@ -535,7 +530,7 @@ static jboolean NativeBN_BN_sub_word(JNIEnv* env, jclass cls __attribute__ ((unu
/**
* public static native boolean BN_mul_word(int, int)
*/
-static jboolean NativeBN_BN_mul_word(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM *a, BN_ULONG w) {
+static jboolean NativeBN_BN_mul_word(JNIEnv* env, jclass, BIGNUM *a, BN_ULONG w) {
if (!oneValidHandle(env, a)) return FALSE;
return BN_mul_word(a, w);
}
@@ -543,7 +538,7 @@ static jboolean NativeBN_BN_mul_word(JNIEnv* env, jclass cls __attribute__ ((unu
/**
* public static native boolean BN_div_word(int, int)
*/
-static BN_ULONG NativeBN_BN_div_word(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM *a, BN_ULONG w) {
+static BN_ULONG NativeBN_BN_div_word(JNIEnv* env, jclass, BIGNUM *a, BN_ULONG w) {
if (!oneValidHandle(env, a)) return FALSE;
return BN_div_word(a, w);
}
@@ -551,7 +546,7 @@ static BN_ULONG NativeBN_BN_div_word(JNIEnv* env, jclass cls __attribute__ ((unu
/**
* public static native boolean BN_mod_word(int, int)
*/
-static BN_ULONG NativeBN_BN_mod_word(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM *a, BN_ULONG w) {
+static BN_ULONG NativeBN_BN_mod_word(JNIEnv* env, jclass, BIGNUM *a, BN_ULONG w) {
if (!oneValidHandle(env, a)) return FALSE;
return BN_mod_word(a, w);
}
@@ -561,7 +556,7 @@ static BN_ULONG NativeBN_BN_mod_word(JNIEnv* env, jclass cls __attribute__ ((unu
/**
* public static native int BN_add(int, int, int)
*/
-static jboolean NativeBN_BN_add(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* r, BIGNUM* a, BIGNUM* b) {
+static jboolean NativeBN_BN_add(JNIEnv* env, jclass, BIGNUM* r, BIGNUM* a, BIGNUM* b) {
if (!threeValidHandles(env, r, a, b)) return FALSE;
return BN_add(r, a, b);
}
@@ -569,7 +564,7 @@ static jboolean NativeBN_BN_add(JNIEnv* env, jclass cls __attribute__ ((unused))
/**
* public static native int BN_sub(int, int, int)
*/
-static jboolean NativeBN_BN_sub(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* r, BIGNUM* a, BIGNUM* b) {
+static jboolean NativeBN_BN_sub(JNIEnv* env, jclass, BIGNUM* r, BIGNUM* a, BIGNUM* b) {
if (!threeValidHandles(env, r, a, b)) return FALSE;
return BN_sub(r, a, b);
}
@@ -578,7 +573,7 @@ static jboolean NativeBN_BN_sub(JNIEnv* env, jclass cls __attribute__ ((unused))
/**
* public static native int BN_gcd(int, int, int, int)
*/
-static jboolean NativeBN_BN_gcd(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* r, BIGNUM* a, BIGNUM* b, BN_CTX* ctx) {
+static jboolean NativeBN_BN_gcd(JNIEnv* env, jclass, BIGNUM* r, BIGNUM* a, BIGNUM* b, BN_CTX* ctx) {
if (!threeValidHandles(env, r, a, b)) return FALSE;
return BN_gcd(r, a, b, ctx);
}
@@ -586,7 +581,7 @@ static jboolean NativeBN_BN_gcd(JNIEnv* env, jclass cls __attribute__ ((unused))
/**
* public static native int BN_mul(int, int, int, int)
*/
-static jboolean NativeBN_BN_mul(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* r, BIGNUM* a, BIGNUM* b, BN_CTX* ctx) {
+static jboolean NativeBN_BN_mul(JNIEnv* env, jclass, BIGNUM* r, BIGNUM* a, BIGNUM* b, BN_CTX* ctx) {
if (!threeValidHandles(env, r, a, b)) return FALSE;
return BN_mul(r, a, b, ctx);
}
@@ -594,7 +589,7 @@ static jboolean NativeBN_BN_mul(JNIEnv* env, jclass cls __attribute__ ((unused))
/**
* public static native int BN_exp(int, int, int, int)
*/
-static jboolean NativeBN_BN_exp(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* r, BIGNUM* a, BIGNUM* p, BN_CTX* ctx) {
+static jboolean NativeBN_BN_exp(JNIEnv* env, jclass, BIGNUM* r, BIGNUM* a, BIGNUM* p, BN_CTX* ctx) {
if (!threeValidHandles(env, r, a, p)) return FALSE;
return BN_exp(r, a, p, ctx);
}
@@ -602,7 +597,7 @@ static jboolean NativeBN_BN_exp(JNIEnv* env, jclass cls __attribute__ ((unused))
/**
* public static native boolean BN_div(int, int, int, int, int)
*/
-static jboolean NativeBN_BN_div(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* dv, BIGNUM* rem, BIGNUM* m, BIGNUM* d, BN_CTX* ctx) {
+static jboolean NativeBN_BN_div(JNIEnv* env, jclass, BIGNUM* dv, BIGNUM* rem, BIGNUM* m, BIGNUM* d, BN_CTX* ctx) {
if (!fourValidHandles(env, (rem ? rem : dv), (dv ? dv : rem), m, d)) return FALSE;
return BN_div(dv, rem, m, d, ctx);
}
@@ -610,7 +605,7 @@ static jboolean NativeBN_BN_div(JNIEnv* env, jclass cls __attribute__ ((unused))
/**
* public static native int BN_nnmod(int, int, int, int)
*/
-static jboolean NativeBN_BN_nnmod(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* r, BIGNUM* a, BIGNUM* m, BN_CTX* ctx) {
+static jboolean NativeBN_BN_nnmod(JNIEnv* env, jclass, BIGNUM* r, BIGNUM* a, BIGNUM* m, BN_CTX* ctx) {
if (!threeValidHandles(env, r, a, m)) return FALSE;
return BN_nnmod(r, a, m, ctx);
}
@@ -618,7 +613,7 @@ static jboolean NativeBN_BN_nnmod(JNIEnv* env, jclass cls __attribute__ ((unused
/**
* public static native int BN_mod_exp(int, int, int, int, int)
*/
-static jboolean NativeBN_BN_mod_exp(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* r, BIGNUM* a, BIGNUM* p, BIGNUM* m, BN_CTX* ctx) {
+static jboolean NativeBN_BN_mod_exp(JNIEnv* env, jclass, BIGNUM* r, BIGNUM* a, BIGNUM* p, BIGNUM* m, BN_CTX* ctx) {
if (!fourValidHandles(env, r, a, p, m)) return FALSE;
return BN_mod_exp(r, a, p, m, ctx);
}
@@ -627,7 +622,7 @@ static jboolean NativeBN_BN_mod_exp(JNIEnv* env, jclass cls __attribute__ ((unus
/**
* public static native int BN_mod_inverse(int, int, int, int)
*/
-static jboolean NativeBN_BN_mod_inverse(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* ret, BIGNUM* a, BIGNUM* n, BN_CTX* ctx) {
+static jboolean NativeBN_BN_mod_inverse(JNIEnv* env, jclass, BIGNUM* ret, BIGNUM* a, BIGNUM* n, BN_CTX* ctx) {
if (!threeValidHandles(env, ret, a, n)) return FALSE;
return (BN_mod_inverse(ret, a, n, ctx) != NULL);
}
@@ -636,7 +631,7 @@ static jboolean NativeBN_BN_mod_inverse(JNIEnv* env, jclass cls __attribute__ ((
/**
* public static native int BN_generate_prime_ex(int, int, boolean, int, int, int)
*/
-static jboolean NativeBN_BN_generate_prime_ex(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* ret, int bits, jboolean safe,
+static jboolean NativeBN_BN_generate_prime_ex(JNIEnv* env, jclass, BIGNUM* ret, int bits, jboolean safe,
BIGNUM* add, BIGNUM* rem, jint cb) {
if (!oneValidHandle(env, ret)) return FALSE;
return BN_generate_prime_ex(ret, bits, safe, add, rem, (BN_GENCB*) cb);
@@ -645,7 +640,7 @@ static jboolean NativeBN_BN_generate_prime_ex(JNIEnv* env, jclass cls __attribut
/**
* public static native int BN_mod_inverse(int, int, int, int)
*/
-static jboolean NativeBN_BN_is_prime_ex(JNIEnv* env, jclass cls __attribute__ ((unused)), BIGNUM* p, int nchecks, BN_CTX* ctx, jint cb) {
+static jboolean NativeBN_BN_is_prime_ex(JNIEnv* env, jclass, BIGNUM* p, int nchecks, BN_CTX* ctx, jint cb) {
if (!oneValidHandle(env, p)) return FALSE;
return BN_is_prime_ex(p, nchecks, ctx, (BN_GENCB*) cb);
}
diff --git a/openssl/src/main/native/sub.mk b/openssl/src/main/native/sub.mk
index fccf735..36d779a 100644
--- a/openssl/src/main/native/sub.mk
+++ b/openssl/src/main/native/sub.mk
@@ -3,7 +3,7 @@
# or BUILD_*_LIBRARY.
LOCAL_SRC_FILES := \
- BNInterface.c
+ BNInterface.cpp
LOCAL_C_INCLUDES += \
external/openssl/include