adds logging control at java level.

pull/2/merge
Moisés Guimarães 2016-03-04 15:49:03 -03:00
parent 32616adf5d
commit 73311405fd
8 changed files with 112 additions and 4 deletions

View File

@ -79,6 +79,7 @@
<class name="com.wolfssl.wolfcrypt.NativeStruct" />
<class name="com.wolfssl.wolfcrypt.Aes" />
<class name="com.wolfssl.wolfcrypt.Des3" />
<class name="com.wolfssl.wolfcrypt.Logging" />
<class name="com.wolfssl.wolfcrypt.Md5" />
<class name="com.wolfssl.wolfcrypt.Sha" />
<class name="com.wolfssl.wolfcrypt.Sha256" />

View File

@ -28,7 +28,8 @@ LOCAL_SRC_FILES := jni_fips.c \
jni_rsa.c \
jni_dh.c \
jni_ecc.c \
jni_asn.c
jni_asn.c \
jni_logging.c
LOCAL_CFLAGS := -DHAVE_CONFIG_H -Wall -Wno-unused
LOCAL_LDLIBS := -llog

View File

@ -0,0 +1,29 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_wolfssl_wolfcrypt_Logging */
#ifndef _Included_com_wolfssl_wolfcrypt_Logging
#define _Included_com_wolfssl_wolfcrypt_Logging
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_wolfssl_wolfcrypt_Logging
* Method: wolfSSL_Debugging_ON
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_wolfssl_wolfcrypt_Logging_wolfSSL_1Debugging_1ON
(JNIEnv *, jclass);
/*
* Class: com_wolfssl_wolfcrypt_Logging
* Method: wolfSSL_Debugging_OFF
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_wolfssl_wolfcrypt_Logging_wolfSSL_1Debugging_1OFF
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

42
jni/jni_logging.c 100644
View File

@ -0,0 +1,42 @@
/* jni_logging.c
*
* Copyright (C) 2006-2016 wolfSSL Inc.
*
* This file is part of wolfSSL. (formerly known as CyaSSL)
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <com_wolfssl_wolfcrypt_Logging.h>
#ifndef __ANDROID__
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/logging.h>
int wolfSSL_Debugging_ON(void);
void wolfSSL_Debugging_OFF(void);
JNIEXPORT jint JNICALL Java_com_wolfssl_wolfcrypt_Logging_wolfSSL_1Debugging_1ON
(JNIEnv* env, jclass class)
{
return wolfSSL_Debugging_ON();
}
JNIEXPORT void JNICALL Java_com_wolfssl_wolfcrypt_Logging_wolfSSL_1Debugging_1OFF
(JNIEnv* env, jclass class)
{
wolfSSL_Debugging_OFF();
}

View File

@ -4,7 +4,7 @@ INC_PATH = $(SRC_PATH)/include
OBJ_LIST = jni_fips.o jni_native_struct.o jni_aes.o jni_des3.o jni_md5.o \
jni_sha.o jni_hmac.o jni_rng.o jni_rsa.o jni_dh.o jni_ecc.o \
jni_error.o jni_asn.o
jni_error.o jni_asn.o jni_logging.o
OBJS = $(patsubst %,$(OUT_PATH)/%,$(OBJ_LIST))
TARGET = $(OUT_PATH)/libwolfcryptjni.jnilib

View File

@ -4,7 +4,7 @@ INC_PATH = $(SRC_PATH)/include
OBJ_LIST = jni_fips.o jni_native_struct.o jni_aes.o jni_des3.o jni_md5.o \
jni_sha.o jni_hmac.o jni_rng.o jni_rsa.o jni_dh.o jni_ecc.o \
jni_error.o jni_asn.o
jni_error.o jni_asn.o jni_logging.o
OBJS = $(patsubst %,$(OUT_PATH)/%,$(OBJ_LIST))
TARGET = $(OUT_PATH)/libwolfcryptjni.so

View File

@ -4,7 +4,7 @@ INC_PATH = $(SRC_PATH)/include
OBJ_LIST = jni_fips.o jni_native_struct.o jni_aes.o jni_des3.o jni_md5.o \
jni_sha.o jni_hmac.o jni_rng.o jni_rsa.o jni_dh.o jni_ecc.o \
jni_error.o jni_asn.o
jni_error.o jni_asn.o jni_logging.o
OBJS = $(patsubst %,$(OUT_PATH)/%,$(OBJ_LIST))
TARGET = $(OUT_PATH)/libwolfcryptjni.jnilib

View File

@ -0,0 +1,35 @@
/* Logging.java
*
* Copyright (C) 2006-2016 wolfSSL Inc.
*
* This file is part of wolfSSL. (formerly known as CyaSSL)
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package com.wolfssl.wolfcrypt;
/**
* Wrapper for the native WolfCrypt Logging implementation.
*
* @author Moisés Guimarães
* @version 1.0, March 2016
*/
public class Logging extends WolfObject {
public static native int wolfSSL_Debugging_ON();
public static native void wolfSSL_Debugging_OFF();
}