adds wolfCrypt_SetStatus_fips wrapper.
parent
53f364cb2f
commit
31a63ff905
|
@ -327,6 +327,14 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_wolfcrypt_Fips_Sha512Final_1fips
|
|||
JNIEXPORT jint JNICALL Java_com_wolfssl_wolfcrypt_Fips_wolfCrypt_1GetStatus_1fips
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: com_wolfssl_wolfcrypt_Fips
|
||||
* Method: wolfCrypt_SetStatus_fips
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_wolfssl_wolfcrypt_Fips_wolfCrypt_1SetStatus_1fips
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: com_wolfssl_wolfcrypt_Fips
|
||||
* Method: RsaPublicEncrypt_fips
|
||||
|
|
|
@ -1094,6 +1094,16 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_wolfcrypt_Fips_wolfCrypt_1GetStatus_1fip
|
|||
return (jint) wolfCrypt_GetStatus_fips();
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_wolfssl_wolfcrypt_Fips_wolfCrypt_1SetStatus_1fips(
|
||||
JNIEnv* env, jclass class, jint status)
|
||||
{
|
||||
#ifdef HAVE_FORCE_FIPS_FAILURE
|
||||
return (jint) wolfCrypt_SetStatus_fips(status);
|
||||
#else
|
||||
return NOT_COMPILED_IN;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* ### FIPS Allowed Security Methods ###########################################
|
||||
*/
|
||||
|
|
|
@ -656,6 +656,16 @@ public class Fips extends WolfObject {
|
|||
*/
|
||||
public static native int wolfCrypt_GetStatus_fips();
|
||||
|
||||
/**
|
||||
* Sets the fips module status. Only available if HAVE_FORCE_FIPS_FAILURE is
|
||||
* defined on the native library.
|
||||
*
|
||||
* @param status
|
||||
* the new status.
|
||||
* @return 0 on success, {@literal <} 0 on error.
|
||||
*/
|
||||
public static native int wolfCrypt_SetStatus_fips(int status);
|
||||
|
||||
/*
|
||||
* ### FIPS Allowed Security Methods #######################################
|
||||
*/
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.junit.Test;
|
|||
|
||||
import com.wolfssl.wolfcrypt.Aes;
|
||||
import com.wolfssl.wolfcrypt.WolfCrypt;
|
||||
import com.wolfssl.wolfcrypt.WolfCryptError;
|
||||
import com.wolfssl.wolfcrypt.Fips;
|
||||
import com.wolfssl.wolfcrypt.Fips.ErrorCallback;
|
||||
|
||||
|
@ -17,6 +18,13 @@ public class FipsTest {
|
|||
assertEquals(WolfCrypt.SUCCESS, Fips.wolfCrypt_GetStatus_fips());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void wolfCrypt_SetStatus_fipsShouldReturnZero() {
|
||||
assertEquals(WolfCryptError.NOT_COMPILED_IN.getCode(),
|
||||
Fips.wolfCrypt_SetStatus_fips(WolfCryptError.DRBG_CONT_FIPS_E
|
||||
.getCode()));
|
||||
}
|
||||
|
||||
public class MyCallback implements ErrorCallback {
|
||||
@Override
|
||||
public void errorCallback(int ok, int err, String hash) {
|
||||
|
|
Loading…
Reference in New Issue