diff options
author | Elliott Hughes <enh@google.com> | 2009-09-10 18:24:33 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2009-09-10 18:24:33 -0700 |
commit | 611ddbe080e9436de83a47624156dba70b46d940 (patch) | |
tree | f198f8e3a7a7b7d1a1ee4193695aa4aa1e34dc14 /openssl | |
parent | a6bd22ee1d45bb47c9957d3bc032db395873073a (diff) | |
download | libcore-611ddbe080e9436de83a47624156dba70b46d940.zip libcore-611ddbe080e9436de83a47624156dba70b46d940.tar.gz libcore-611ddbe080e9436de83a47624156dba70b46d940.tar.bz2 |
Remove NativeBN_bn2twosComp.
NativeBN_bn2twosComp doesn't do what it claims to: it's an exact copy of
NativeBN_BN_bn2bin (observe which OpenSSL BN_ function it calls!), and -- from
the OpenSSL documentation -- that function "converts the absolute value of [its
argument] into big-endian form".
OpenSSL doesn't actually sport any appropriate function to call here, but
luckily this code isn't called anywhere, and so can be removed.
(BigInteger.toByteArray -- the most likely caller of this code -- seems to
do the right thing, using Java code to make a big-endian two's-complement
byte[]. Likewise, the conversion from a big-endian two's-complement byte[]
for the corresponding BigInteger constructor looks right too, using native
code to twiddle the bits itself.)
Diffstat (limited to 'openssl')
-rw-r--r-- | openssl/src/main/java/org/openssl/NativeBN.java | 3 | ||||
-rw-r--r-- | openssl/src/main/native/BNInterface.c | 22 |
2 files changed, 0 insertions, 25 deletions
diff --git a/openssl/src/main/java/org/openssl/NativeBN.java b/openssl/src/main/java/org/openssl/NativeBN.java index 44464e0..3597e3c 100644 --- a/openssl/src/main/java/org/openssl/NativeBN.java +++ b/openssl/src/main/java/org/openssl/NativeBN.java @@ -79,9 +79,6 @@ public class NativeBN { public static native int[] bn2litEndInts(int a, int[] to); - public static native byte[] bn2twosComp(int a, byte[] to); - - public static native int sign(int a); // Returns -1, 0, 1 AND NOT boolean. // #define BN_is_negative(a) ((a)->neg != 0) diff --git a/openssl/src/main/native/BNInterface.c b/openssl/src/main/native/BNInterface.c index 4132e4f..755a93b 100644 --- a/openssl/src/main/native/BNInterface.c +++ b/openssl/src/main/native/BNInterface.c @@ -456,27 +456,6 @@ static jintArray NativeBN_bn2litEndInts(JNIEnv* env, jclass cls, BIGNUM* a, jint } } -/** - * public static native byte[] bn2twosComp(int, byte[]) - */ -static jbyteArray NativeBN_bn2twosComp(JNIEnv* env, jclass cls, 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); -// FIXME: is it neccessary to check for returnJBytes != NULL? - tmpBytes = (unsigned char *)((*env)->GetPrimitiveArrayCritical(env, returnJBytes, NULL)); - if (tmpBytes != NULL) { - len = BN_bn2bin(a, tmpBytes); - (*env)->ReleasePrimitiveArrayCritical(env, returnJBytes, tmpBytes, 0); - return returnJBytes; - } - else return NULL; -} - /** * public static native int sign(int) @@ -833,7 +812,6 @@ static JNINativeMethod METHODS[] = { { "BN_bn2hex", "(I)Ljava/lang/String;", (void*)NativeBN_BN_bn2hex }, { "BN_bn2bin", "(I[B)[B", (void*)NativeBN_BN_bn2bin }, { "bn2litEndInts", "(I[I)[I", (void*)NativeBN_bn2litEndInts }, - { "bn2twosComp", "(I[B)[B", (void*)NativeBN_bn2twosComp }, { "sign", "(I)I", (void*)NativeBN_sign }, { "BN_set_negative", "(II)V", (void*)NativeBN_BN_set_negative }, { "twosCompFitsIntoBytes", "(II)Z", (void*)NativeBN_twosCompFitsIntoBytes }, |