add helper methods to detect if RSA and ECC have been compiled in

pull/23/head
Chris Conlon 2019-03-04 09:34:38 -08:00
parent 2bcf367507
commit 7859729c36
3 changed files with 53 additions and 1 deletions

View File

@ -159,6 +159,26 @@ JNIEXPORT jboolean JNICALL Java_com_wolfssl_WolfSSL_TLSv1Enabled
#endif #endif
} }
JNIEXPORT jboolean JNICALL Java_com_wolfssl_WolfSSL_EccEnabled
(JNIEnv* jenv, jclass jcl)
{
#ifdef HAVE_ECC
return JNI_TRUE;
#else
return JNI_FALSE;
#endif
}
JNIEXPORT jboolean JNICALL Java_com_wolfssl_WolfSSL_RsaEnabled
(JNIEnv* jenv, jclass jcl)
{
#ifndef NO_RSA
return JNI_TRUE;
#else
return JNI_FALSE;
#endif
}
JNIEXPORT jlong JNICALL Java_com_wolfssl_WolfSSL_SSLv3_1ServerMethod JNIEXPORT jlong JNICALL Java_com_wolfssl_WolfSSL_SSLv3_1ServerMethod
(JNIEnv* jenv, jclass jcl) (JNIEnv* jenv, jclass jcl)
{ {

View File

@ -295,6 +295,22 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_getBulkCipherAlgorithmEnumRABBIT
JNIEXPORT jboolean JNICALL Java_com_wolfssl_WolfSSL_TLSv1Enabled JNIEXPORT jboolean JNICALL Java_com_wolfssl_WolfSSL_TLSv1Enabled
(JNIEnv *, jclass); (JNIEnv *, jclass);
/*
* Class: com_wolfssl_WolfSSL
* Method: EccEnabled
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_wolfssl_WolfSSL_EccEnabled
(JNIEnv *, jclass);
/*
* Class: com_wolfssl_WolfSSL
* Method: RsaEnabled
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_wolfssl_WolfSSL_RsaEnabled
(JNIEnv *, jclass);
/* /*
* Class: com_wolfssl_WolfSSL * Class: com_wolfssl_WolfSSL
* Method: SSLv3_ServerMethod * Method: SSLv3_ServerMethod

View File

@ -310,7 +310,7 @@ public class WolfSSL {
System.load(libPath); System.load(libPath);
} }
/* ---------------- native SSL/TLS version functions ---------------- */ /* --------------- native feature detection functions --------------- */
/** /**
* Tests if TLS 1.0 has been compiled into the native wolfSSL library. * Tests if TLS 1.0 has been compiled into the native wolfSSL library.
@ -321,6 +321,22 @@ public class WolfSSL {
*/ */
public static native boolean TLSv1Enabled(); public static native boolean TLSv1Enabled();
/**
* Tests if ECC support has been compiled into the native wolfSSL library.
*
* @return 1 if enabled, otherwise 0 if not compiled in.
*/
public static native boolean EccEnabled();
/**
* Tests if RSA support has been compiled into the native wolfSSL library.
*
* @return 1 if enabled, otherwise 0 if not compiled in.
*/
public static native boolean RsaEnabled();
/* ---------------- native SSL/TLS version functions ---------------- */
/** /**
* Indicates that the application is a server and will only support the * Indicates that the application is a server and will only support the
* SSL 3.0 protocol. * SSL 3.0 protocol.