You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by xu...@apache.org on 2016/04/26 05:20:14 UTC
commons-crypto git commit: CRYPTO-10: Rename Chimera in makefile to
Apache Common Crypto
Repository: commons-crypto
Updated Branches:
refs/heads/master 35c716304 -> f819dd404
CRYPTO-10: Rename Chimera in makefile to Apache Common Crypto
Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/f819dd40
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/f819dd40
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/f819dd40
Branch: refs/heads/master
Commit: f819dd404177ba13371d1a7c1b94940c6a73e220
Parents: 35c7163
Author: Ferdinand Xu <ch...@intel.com>
Authored: Mon Apr 25 07:36:34 2016 +0800
Committer: Ferdinand Xu <ch...@intel.com>
Committed: Tue Apr 26 03:57:09 2016 +0800
----------------------------------------------------------------------
Makefile | 14 +--
Makefile.common | 104 +++++++++----------
lib/include/config.h | 2 +-
.../commons/crypto/utils/NativeCodeLoader.java | 38 +++----
.../commons/crypto/cipher/OpensslNative.c | 6 +-
.../org/apache/commons/crypto/exception.h | 4 +-
.../commons/crypto/org_apache_commons_crypto.h | 8 +-
.../crypto/random/OpensslSecureRandomNative.c | 38 +++----
8 files changed, 107 insertions(+), 107 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f819dd40/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index 8309b5c..0b356fc 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,8 @@ include Makefile.common
MVN:=mvn
-CHIMERA_OUT:=$(TARGET)/$(chimera)-$(os_arch)
-CHIMERA_OBJ:=$(addprefix $(CHIMERA_OUT)/,OpensslSecureRandom.o OpensslNative.o)
+COMMONS_CRYPTO_OUT:=$(TARGET)/$(commons-crypto)-$(os_arch)
+COMMONS_CRYPTO_OBJ:=$(addprefix $(COMMONS_CRYPTO_OUT)/,OpensslSecureRandom.o OpensslNative.o)
ifeq ($(OS_NAME),SunOS)
TAR:= gtar
@@ -30,25 +30,25 @@ $(TARGET)/jni-classes/org/apache/commons/crypto/cipher/OpensslNative.h: $(TARGET
$(TARGET)/jni-classes/org/apache/commons/crypto/random/OpensslSecureRandomNative.h: $(TARGET)/jni-classes/org/apache/commons/crypto/random/OpensslSecureRandomNative.class
$(JAVAH) -force -classpath $(TARGET)/jni-classes -o $@ org.apache.commons.crypto.random.OpensslSecureRandomNative
-$(CHIMERA_OUT)/OpensslNative.o : $(SRC_NATIVE)/org/apache/commons/crypto/cipher/OpensslNative.c $(TARGET)/jni-classes/org/apache/commons/crypto/cipher/OpensslNative.h
+$(COMMONS_CRYPTO_OUT)/OpensslNative.o : $(SRC_NATIVE)/org/apache/commons/crypto/cipher/OpensslNative.c $(TARGET)/jni-classes/org/apache/commons/crypto/cipher/OpensslNative.h
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
-$(CHIMERA_OUT)/OpensslSecureRandom.o : $(SRC_NATIVE)/org/apache/commons/crypto/random/OpensslSecureRandomNative.c $(TARGET)/jni-classes/org/apache/commons/crypto/random/OpensslSecureRandomNative.h
+$(COMMONS_CRYPTO_OUT)/OpensslSecureRandom.o : $(SRC_NATIVE)/org/apache/commons/crypto/random/OpensslSecureRandomNative.c $(TARGET)/jni-classes/org/apache/commons/crypto/random/OpensslSecureRandomNative.h
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
-$(CHIMERA_OUT)/$(LIBNAME): $(CHIMERA_OBJ)
+$(COMMONS_CRYPTO_OUT)/$(LIBNAME): $(COMMONS_CRYPTO_OBJ)
$(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS)
$(STRIP) $@
clean:
rm -rf $(TARGET)
- rm -rf $(CHIMERA_OUT)
+ rm -rf $(COMMONS_CRYPTO_OUT)
native: $(NATIVE_DLL)
-$(NATIVE_DLL): $(CHIMERA_OUT)/$(LIBNAME)
+$(NATIVE_DLL): $(COMMONS_CRYPTO_OUT)/$(LIBNAME)
@mkdir -p $(@D)
cp $< $@
@mkdir -p $(NATIVE_TARGET_DIR)
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f819dd40/Makefile.common
----------------------------------------------------------------------
diff --git a/Makefile.common b/Makefile.common
index 8091727..e6ddbfb 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -9,13 +9,13 @@ endif
JAVA := "$$JAVA_HOME/bin/java"
-JAVAC := "$$JAVA_HOME/bin/javac"
+JAVAC := "$$JAVA_HOME/bin/javac"
JAVAH := "$$JAVA_HOME/bin/javah"
OSINFO_CLASS := org.apache.commons.crypto.utils.OSInfo
OSINFO_PROG := lib/org/apache/commons/crypto/utils/OSInfo.class
-## building OSInfo.java
+## building OSInfo.java
$(info compiling OSInfo.java)
$(shell mkdir -p lib)
$(shell $(JAVAC) src/main/java/org/apache/commons/crypto/utils/OSInfo.java -d lib)
@@ -32,7 +32,7 @@ else
sep := :
endif
-chimera := chimera-$(VERSION)
+commons-crypto := commons-crypto-$(VERSION)
jni_md := $(shell find -L "$(JAVA_HOME)" -name jni_md.h | head -1)
@@ -72,8 +72,8 @@ Default_STRIP := $(CROSS_PREFIX)strip
Default_CFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden
Default_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden
Default_LINKFLAGS := -shared -static
-Default_LIBNAME := libchimera.so
-Default_CHIMERA_FLAGS :=
+Default_LIBNAME := libcommons-crypto.so
+Default_COMMONS_CRYPTO_FLAGS :=
Linux-x86_CC := $(CROSS_PREFIX)gcc
Linux-x86_CXX := $(CROSS_PREFIX)g++
@@ -86,22 +86,22 @@ else
Linux-x86_CFLAGS := -include $(IBM_JDK_LIB)/jni_md.h -include $(IBM_JDK_LIB)/jniport.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -m32
endif
Linux-x86_LINKFLAGS := -shared -static-libgcc -static-libstdc++
-Linux-x86_LIBNAME := libchimera.so
-Linux-x86_CHIMERA_FLAGS:=
+Linux-x86_LIBNAME := libcommons-crypto.so
+Linux-x86_COMMONS_CRYPTO_FLAGS:=
Linux-x86_64_CC := $(CROSS_PREFIX)gcc
-Linux-x86_64_CXX := $(CROSS_PREFIX)g++
+Linux-x86_64_CXX := $(CROSS_PREFIX)g++
Linux-x86_64_STRIP := $(CROSS_PREFIX)strip
ifeq ($(IBM_JDK_7),)
Linux-x86_64_CXXFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
- Linux-x86_64_CFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
+ Linux-x86_64_CFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
else
Linux-x86_64_CXXFLAGS := -include $(IBM_JDK_LIB)/jni_md.h -include $(IBM_JDK_LIB)/jniport.h -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
- Linux-x86_64_CFLAGS := -include $(IBM_JDK_LIB)/jni_md.h -include $(IBM_JDK_LIB)/jniport.h -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
+ Linux-x86_64_CFLAGS := -include $(IBM_JDK_LIB)/jni_md.h -include $(IBM_JDK_LIB)/jniport.h -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
endif
Linux-x86_64_LINKFLAGS := -shared -static-libgcc -static-libstdc++
-Linux-x86_64_LIBNAME := libchimera.so
-Linux-x86_64_CHIMERA_FLAGS :=
+Linux-x86_64_LIBNAME := libcommons-crypto.so
+Linux-x86_64_COMMONS_CRYPTO_FLAGS :=
Linux-ppc_CC := gcc
Linux-ppc_CXX := g++
@@ -114,27 +114,27 @@ else
Linux-ppc_CFLAGS := -DHAVE_CONFIG_H -include lib/inc_linux/jni_md.h -include $(IBM_JDK_LIB)/jniport.h -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -O2 -fPIC -m32
endif
Linux-ppc_LINKFLAGS := -shared -static-libgcc -static-libstdc++
-Linux-ppc_LIBNAME := libchimera.so
-Linux-ppc_CHIMERA_FLAGS :=
+Linux-ppc_LIBNAME := libcommons-crypto.so
+Linux-ppc_COMMONS_CRYPTO_FLAGS :=
Linux-ppc64_CC := gcc
Linux-ppc64_CXX := g++
Linux-ppc64_STRIP := strip
ifeq ($(IBM_JDK_7),)
Linux-ppc64_CXXFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
- Linux-ppc64_CFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
+ Linux-ppc64_CFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
else
Linux-ppc64_CXXFLAGS := -DHAVE_CONFIG_H -include $(IBM_JDK_LIB)/jni_md.h -include $(IBM_JDK_LIB)/jniport.h -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -O2 -fPIC -m64
Linux-ppc64_CFLAGS := -DHAVE_CONFIG_H -include $(IBM_JDK_LIB)/jni_md.h -include $(IBM_JDK_LIB)/jniport.h -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -O2 -fPIC -m64
endif
Linux-ppc64_LINKFLAGS := -shared -static-libgcc -static-libstdc++
-Linux-ppc64_LIBNAME := libchimera.so
-Linux-ppc64_CHIMERA_FLAGS :=
+Linux-ppc64_LIBNAME := libcommons-crypto.so
+Linux-ppc64_COMMONS_CRYPTO_FLAGS :=
AIX-ppc64_CC := gcc
AIX-ppc64_CXX := g++
AIX-ppc64_STRIP := strip -X64
-AIX-ppc64_LIBNAME := libchimera.a
+AIX-ppc64_LIBNAME := libcommons-crypto.a
ifeq ($(IBM_JDK_7),)
AIX-ppc64_CXXFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
AIX-ppc64_CFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
@@ -143,25 +143,25 @@ else
AIX-ppc64_CFLAGS := -DHAVE_CONFIG_H -I$(JAVA_HOME)/include/aix -Ilib/inc_ibm -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -maix64
endif
AIX-ppc64_LINKFLAGS := -shared -static-libgcc -static-libstdc++ -lcrypt
-AIX-ppc64_CHIMERA_FLAGS :=
+AIX-ppc64_COMMONS_CRYPTO_FLAGS :=
SunOS-x86_CC := gcc
-SunOS-x86_CXX := g++
+SunOS-x86_CXX := g++
SunOS-x86_STRIP := strip
SunOS-x86_CFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden
SunOS-x86_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden
SunOS-x86_LINKFLAGS := -shared -static-libgcc -static-libstdc++
-SunOS-x86_LIBNAME := libchimera.so
-SunOS-x86_CHIMERA_FLAGS :=
+SunOS-x86_LIBNAME := libcommons-crypto.so
+SunOS-x86_COMMONS_CRYPTO_FLAGS :=
SunOS-sparc_CC := gcc
-SunOS-sparc_CXX := g++
+SunOS-sparc_CXX := g++
SunOS-sparc_STRIP := strip
SunOS-sparc_CFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden
SunOS-sparc_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden
SunOS-sparc_LINKFLAGS := -shared -static-libgcc -static-libstdc++
-SunOS-sparc_LIBNAME := libchimera.so
-SunOS-sparc_CHIMERA_FLAGS :=
+SunOS-sparc_LIBNAME := libcommons-crypto.so
+SunOS-sparc_COMMONS_CRYPTO_FLAGS :=
SunOS-x86_64_CC := gcc
SunOS-x86_64_CXX := g++
@@ -169,8 +169,8 @@ SunOS-x86_64_STRIP := strip
SunOS-x86_64_CFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -m64
SunOS-x86_64_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -m64
SunOS-x86_64_LINKFLAGS := -shared -static-libgcc -static-libstdc++
-SunOS-x86_64_LIBNAME := libchimera.so
-SunOS-x86_64_CHIMERA_FLAGS :=
+SunOS-x86_64_LIBNAME := libcommons-crypto.so
+SunOS-x86_64_COMMONS_CRYPTO_FLAGS :=
# '-include lib/inc_linux/jni_md.h' is used to force the use of our version,
# which defines JNIEXPORT differently; otherwise, since OpenJDK includes
@@ -183,8 +183,8 @@ Linux-arm_STRIP := $(CROSS_PREFIX)strip
Linux-arm_CFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=softfp
Linux-arm_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=softfp
Linux-arm_LINKFLAGS := -shared -static-libgcc
-Linux-arm_LIBNAME := libchimera.so
-Linux-arm_CHIMERA_FLAGS:=
+Linux-arm_LIBNAME := libcommons-crypto.so
+Linux-arm_COMMONS_CRYPTO_FLAGS:=
Linux-armhf_CC := $(CROSS_PREFIX)gcc
Linux-armhf_CXX := $(CROSS_PREFIX)g++
@@ -192,8 +192,8 @@ Linux-armhf_STRIP := $(CROSS_PREFIX)strip
Linux-armhf_CFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=hard
Linux-armhf_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=hard
Linux-armhf_LINKFLAGS := -shared -static-libgcc
-Linux-armhf_LIBNAME := libchimera.so
-Linux-armhf_CHIMERA_FLAGS:=
+Linux-armhf_LIBNAME := libcommons-crypto.so
+Linux-armhf_COMMONS_CRYPTO_FLAGS:=
Mac-x86_CC := gcc -arch i386
Mac-x86_CXX := g++ -arch i386
@@ -201,17 +201,17 @@ Mac-x86_STRIP := strip -x
Mac-x86_CFLAGS := -Ilib/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.4 -fvisibility=hidden
Mac-x86_CXXFLAGS := -Ilib/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.4 -fvisibility=hidden
Mac-x86_LINKFLAGS := -dynamiclib -static-libgcc
-Mac-x86_LIBNAME := libchimera.jnilib
-Mac-x86_CHIMERA_FLAGS :=
+Mac-x86_LIBNAME := libcommons-crypto.jnilib
+Mac-x86_COMMONS_CRYPTO_FLAGS :=
Mac-x86_64_CC := gcc -arch $(OS_ARCH)
-Mac-x86_64_CXX := g++ -arch $(OS_ARCH)
+Mac-x86_64_CXX := g++ -arch $(OS_ARCH)
Mac-x86_64_STRIP := strip -x
Mac-x86_64_CFLAGS := -Ilib/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden
Mac-x86_64_CXXFLAGS := -Ilib/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden
-Mac-x86_64_LINKFLAGS := -dynamiclib
-Mac-x86_64_LIBNAME := libchimera.jnilib
-Mac-x86_64_CHIMERA_FLAGS :=
+Mac-x86_64_LINKFLAGS := -dynamiclib
+Mac-x86_64_LIBNAME := libcommons-crypto.jnilib
+Mac-x86_64_COMMONS_CRYPTO_FLAGS :=
FreeBSD-x86_64_CC := $(CROSS_PREFIX)gcc
FreeBSD-x86_64_CXX := $(CROSS_PREFIX)g++
@@ -219,37 +219,37 @@ FreeBSD-x86_64_STRIP := $(CROSS_PREFIX)strip
FreeBSD-x86_64_CFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden
FreeBSD-x86_64_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden
FreeBSD-x86_64_LINKFLAGS := -shared -static-libgcc
-FreeBSD-x86_64_LIBNAME := libchimera.so
-FreeBSD-x86_64_CHIMERA_FLAGS :=
+FreeBSD-x86_64_LIBNAME := libcommons-crypto.so
+FreeBSD-x86_64_COMMONS_CRYPTO_FLAGS :=
Windows-x86_CC := $(CROSS_PREFIX)gcc
Windows-x86_CXX := $(CROSS_PREFIX)g++
Windows-x86_STRIP := $(CROSS_PREFIX)strip
-Windows-x86_CFLAGS := -Ilib/inc_win -O2
-Windows-x86_CXXFLAGS := -Ilib/inc_win -O2
+Windows-x86_CFLAGS := -Ilib/inc_win -O2
+Windows-x86_CXXFLAGS := -Ilib/inc_win -O2
Windows-x86_LINKFLAGS := -Wl,--kill-at -shared -static
-Windows-x86_LIBNAME := chimera.dll
-Windows-x86_CHIMERA_FLAGS :=
+Windows-x86_LIBNAME := commons-crypto.dll
+Windows-x86_COMMONS_CRYPTO_FLAGS :=
Windows-x86_64_CC := $(CROSS_PREFIX)gcc
Windows-x86_64_CXX := $(CROSS_PREFIX)g++
Windows-x86_64_STRIP := $(CROSS_PREFIX)strip
-Windows-x86_64_CFLAGS := -Ilib/inc_win -O2
-Windows-x86_64_CXXFLAGS := -Ilib/inc_win -O2
-Windows-x86_64_LINKFLAGS := -Wl,--kill-at -shared -static
-Windows-x86_64_LIBNAME := chimera.dll
-Windows-x86_64_CHIMERA_FLAGS :=
+Windows-x86_64_CFLAGS := -Ilib/inc_win -O2
+Windows-x86_64_CXXFLAGS := -Ilib/inc_win -O2
+Windows-x86_64_LINKFLAGS := -Wl,--kill-at -shared -static
+Windows-x86_64_LIBNAME := commons-crypto.dll
+Windows-x86_64_COMMONS-CRYPTO_FLAGS :=
STRIP := $($(os_arch)_STRIP)
CC := $($(os_arch)_CC)
CXX := $($(os_arch)_CXX)
STRIP := $($(os_arch)_STRIP)
-CFLAGS := $($(os_arch)_CXXFLAGS)
-CXXFLAGS := $($(os_arch)_CXXFLAGS)
-LINKFLAGS := $($(os_arch)_LINKFLAGS)
+CFLAGS := $($(os_arch)_CXXFLAGS)
+CXXFLAGS := $($(os_arch)_CXXFLAGS)
+LINKFLAGS := $($(os_arch)_LINKFLAGS)
LIBNAME := $($(os_arch)_LIBNAME)
-CHIMERA_FLAGS := $($(os_arch)_CHIMERA_FLAGS)
+COMMONS-CRYPTO_FLAGS := $($(os_arch)_COMMONS-CRYPTO_FLAGS)
CFLAGS := $(CFLAGS) -Ilib/include -I/usr/include -I"$(SRC_NATIVE)/org/apache/commons/crypto/"
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f819dd40/lib/include/config.h
----------------------------------------------------------------------
diff --git a/lib/include/config.h b/lib/include/config.h
index c831b82..6c22f9e 100755
--- a/lib/include/config.h
+++ b/lib/include/config.h
@@ -1,5 +1,5 @@
#ifndef __CONFIG_H
#define __CONFIG_H
-#define CHIMERA_OPENSSL_LIBRARY "libcrypto.so"
+#define COMMONS_CRYPTO_OPENSSL_LIBRARY "libcrypto.so"
#endif // __CONFIG_H
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f819dd40/src/main/java/org/apache/commons/crypto/utils/NativeCodeLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/utils/NativeCodeLoader.java b/src/main/java/org/apache/commons/crypto/utils/NativeCodeLoader.java
index 475fdda..17c5528 100644
--- a/src/main/java/org/apache/commons/crypto/utils/NativeCodeLoader.java
+++ b/src/main/java/org/apache/commons/crypto/utils/NativeCodeLoader.java
@@ -32,21 +32,21 @@ import org.apache.commons.logging.LogFactory;
/**
- * A helper to load the native code i.e. libchimera.so.
- * This handles the fallback to either the bundled libchimera-Linux-i386-32.so
+ * A helper to load the native code i.e. libcommons-crypto.so.
+ * This handles the fallback to either the bundled libcommons-crypto-Linux-i386-32.so
* or the default java implementations where appropriate.
*/
public class NativeCodeLoader {
private static final Log LOG =
LogFactory.getLog(NativeCodeLoader.class);
-
+
private static boolean nativeCodeLoaded = false;
-
+
static {
// Try to load native library and set fallback flag appropriately
if(LOG.isDebugEnabled()) {
- LOG.debug("Trying to load the custom-built native-chimera library...");
+ LOG.debug("Trying to load the custom-built native-commons-crypto library...");
}
try {
@@ -56,7 +56,7 @@ public class NativeCodeLoader {
System.load(nativeLibFile.getAbsolutePath());
} else {
// Load preinstalled library (in the path -Djava.library.path)
- System.loadLibrary("chimera");
+ System.loadLibrary("commons-crypto");
}
LOG.debug("Loaded the native library");
nativeCodeLoaded = true;
@@ -76,7 +76,7 @@ public class NativeCodeLoader {
}
static File findNativeLibrary() {
- // Try to load the library in chimera.lib.path */
+ // Try to load the library in commons-crypto.lib.path */
String nativeLibraryPath = Utils
.getLibPath();
String nativeLibraryName = Utils
@@ -84,7 +84,7 @@ public class NativeCodeLoader {
// Resolve the library file name with a suffix (e.g., dll, .so, etc.)
if (nativeLibraryName == null)
- nativeLibraryName = System.mapLibraryName("chimera");
+ nativeLibraryName = System.mapLibraryName("commons-crypto");
if (nativeLibraryPath != null) {
File nativeLib = new File(nativeLibraryPath,
@@ -101,7 +101,7 @@ public class NativeCodeLoader {
if(!hasNativeLib) {
if (OSInfo.getOSName().equals("Mac")) {
// Fix for openjdk7 for Mac
- String altName = "libchimera.jnilib";
+ String altName = "libcommons-crypto.jnilib";
if (hasResource(nativeLibraryPath + "/" + altName)) {
nativeLibraryName = altName;
hasNativeLib = true;
@@ -117,7 +117,7 @@ public class NativeCodeLoader {
}
// Temporary folder for the native lib. Use the value of
- // chimera.tempdir or java.io.tmpdir
+ // commons-crypto.tempdir or java.io.tmpdir
String tempFolder = new File(Utils.getTmpDir())
.getAbsolutePath();
@@ -128,11 +128,11 @@ public class NativeCodeLoader {
/**
* Extracts the specified library file to the target folder.
- *
- * @param libFolderForCurrentOS the library in chimera.lib.path.
+ *
+ * @param libFolderForCurrentOS the library in commons-crypto.lib.path.
* @param libraryFileName the library name.
* @param targetFolder Target folder for the native lib. Use the value of
- * chimera.tempdir or java.io.tmpdir.
+ * commons-crypto.tempdir or java.io.tmpdir.
* @return the library file.
*/
private static File extractLibraryFile(String libFolderForCurrentOS,
@@ -141,9 +141,9 @@ public class NativeCodeLoader {
+ libraryFileName;
// Attach UUID to the native library file to ensure multiple class loaders
- // can read the libchimera multiple times.
+ // can read the libcommons-crypto multiple times.
String uuid = UUID.randomUUID().toString();
- String extractedLibFileName = String.format("chimera-%s-%s-%s", getVersion(), uuid,
+ String extractedLibFileName = String.format("commons-crypto-%s-%s-%s", getVersion(), uuid,
libraryFileName);
File extractedLibFile = new File(targetFolder, extractedLibFileName);
@@ -217,12 +217,12 @@ public class NativeCodeLoader {
* Gets the version by reading pom.properties embedded in jar.
* This version data is used as a suffix of a dll file extracted from the
* jar.
- *
+ *
* @return the version string
*/
public static String getVersion() {
URL versionFile = NativeCodeLoader.class
- .getResource("/META-INF/maven/org.apache.commons.crypto/chimera/pom.properties");
+ .getResource("/META-INF/maven/org.apache.commons.crypto/commons-crypto/pom.properties");
if (versionFile == null)
versionFile = NativeCodeLoader.class
.getResource("/org/apache/commons/crypto/VERSION");
@@ -269,8 +269,8 @@ public class NativeCodeLoader {
/**
* Checks whether native code is loaded for this platform.
- *
- * @return <code>true</code> if native is loaded,
+ *
+ * @return <code>true</code> if native is loaded,
* else <code>false</code>.
*/
public static boolean isNativeCodeLoaded() {
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f819dd40/src/main/native/org/apache/commons/crypto/cipher/OpensslNative.c
----------------------------------------------------------------------
diff --git a/src/main/native/org/apache/commons/crypto/cipher/OpensslNative.c b/src/main/native/org/apache/commons/crypto/cipher/OpensslNative.c
index 552babd..956c251 100644
--- a/src/main/native/org/apache/commons/crypto/cipher/OpensslNative.c
+++ b/src/main/native/org/apache/commons/crypto/cipher/OpensslNative.c
@@ -112,15 +112,15 @@ JNIEXPORT void JNICALL Java_org_apache_commons_crypto_cipher_OpensslNative_initI
{
char msg[1000];
#ifdef UNIX
- openssl = dlopen(CHIMERA_OPENSSL_LIBRARY, RTLD_LAZY | RTLD_GLOBAL);
+ openssl = dlopen(COMMONS_CRYPTO_OPENSSL_LIBRARY, RTLD_LAZY | RTLD_GLOBAL);
#endif
#ifdef WINDOWS
- openssl = LoadLibrary(CHIMERA_OPENSSL_LIBRARY);
+ openssl = LoadLibrary(COMMONS_CRYPTO_OPENSSL_LIBRARY);
#endif
if (!openssl) {
- snprintf(msg, sizeof(msg), "Cannot load %s (%s)!", CHIMERA_OPENSSL_LIBRARY, \
+ snprintf(msg, sizeof(msg), "Cannot load %s (%s)!", COMMONS_CRYPTO_OPENSSL_LIBRARY, \
dlerror());
THROW(env, "java/lang/UnsatisfiedLinkError", msg);
return;
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f819dd40/src/main/native/org/apache/commons/crypto/exception.h
----------------------------------------------------------------------
diff --git a/src/main/native/org/apache/commons/crypto/exception.h b/src/main/native/org/apache/commons/crypto/exception.h
index 2d9a018..d67d553 100644
--- a/src/main/native/org/apache/commons/crypto/exception.h
+++ b/src/main/native/org/apache/commons/crypto/exception.h
@@ -14,8 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef CHIMERA_NATIVE_SRC_EXCEPTION_H
-#define CHIMERA_NATIVE_SRC_EXCEPTION_H
+#ifndef COMMONS_CRYPTO_NATIVE_SRC_EXCEPTION_H
+#define COMMONS_CRYPTO_NATIVE_SRC_EXCEPTION_H
#include <jni.h> /* for jthrowable */
#include <stdarg.h> /* for va_list */
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f819dd40/src/main/native/org/apache/commons/crypto/org_apache_commons_crypto.h
----------------------------------------------------------------------
diff --git a/src/main/native/org/apache/commons/crypto/org_apache_commons_crypto.h b/src/main/native/org/apache/commons/crypto/org_apache_commons_crypto.h
index ae965c5..f8cdd1e 100644
--- a/src/main/native/org/apache/commons/crypto/org_apache_commons_crypto.h
+++ b/src/main/native/org/apache/commons/crypto/org_apache_commons_crypto.h
@@ -18,7 +18,7 @@
/**
* This file includes some common utilities
- * for all native code used in chimera.
+ * for all native code used in commons-crypto.
*/
#if !defined ORG_APACHE_COMMONS_CRYPTO_H
@@ -198,13 +198,13 @@ static FARPROC WINAPI do_dlsym(JNIEnv *env, HMODULE handle, LPCSTR symbol) {
#include <openssl/err.h>
/**
- * A helper macro to convert the java 'context-handle'
- * to a EVP_CIPHER_CTX pointer.
+ * A helper macro to convert the java 'context-handle'
+ * to a EVP_CIPHER_CTX pointer.
*/
#define CONTEXT(context) ((EVP_CIPHER_CTX*)((ptrdiff_t)(context)))
/**
- * A helper macro to convert the EVP_CIPHER_CTX pointer to the
+ * A helper macro to convert the EVP_CIPHER_CTX pointer to the
* java 'context-handle'.
*/
#define JLONG(context) ((jlong)((ptrdiff_t)(context)))
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f819dd40/src/main/native/org/apache/commons/crypto/random/OpensslSecureRandomNative.c
----------------------------------------------------------------------
diff --git a/src/main/native/org/apache/commons/crypto/random/OpensslSecureRandomNative.c b/src/main/native/org/apache/commons/crypto/random/OpensslSecureRandomNative.c
index 404697f..5dcfd1f 100644
--- a/src/main/native/org/apache/commons/crypto/random/OpensslSecureRandomNative.c
+++ b/src/main/native/org/apache/commons/crypto/random/OpensslSecureRandomNative.c
@@ -32,7 +32,7 @@
#ifdef WINDOWS
#include <windows.h>
#endif
-
+
#include "OpensslSecureRandomNative.h"
#ifdef UNIX
@@ -91,15 +91,15 @@ JNIEXPORT void JNICALL Java_org_apache_commons_crypto_random_OpensslSecureRandom
{
char msg[1000];
#ifdef UNIX
- void *openssl = dlopen(CHIMERA_OPENSSL_LIBRARY, RTLD_LAZY | RTLD_GLOBAL);
+ void *openssl = dlopen(COMMONS_CRYPTO_OPENSSL_LIBRARY, RTLD_LAZY | RTLD_GLOBAL);
#endif
#ifdef WINDOWS
- HMODULE openssl = LoadLibrary(CHIMERA_OPENSSL_LIBRARY);
+ HMODULE openssl = LoadLibrary(COMMONS_CRYPTO_OPENSSL_LIBRARY);
#endif
if (!openssl) {
- snprintf(msg, sizeof(msg), "Cannot load %s (%s)!", CHIMERA_OPENSSL_LIBRARY, \
+ snprintf(msg, sizeof(msg), "Cannot load %s (%s)!", COMMONS_CRYPTO_OPENSSL_LIBRARY, \
dlerror());
THROW(env, "java/lang/UnsatisfiedLinkError", msg);
return;
@@ -175,7 +175,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_commons_crypto_random_OpensslSecureRa
int b_len = (*env)->GetArrayLength(env, bytes);
int ret = openssl_rand_bytes((unsigned char *)b, b_len);
(*env)->ReleaseByteArrayElements(env, bytes, b, 0);
-
+
if (1 != ret) {
return JNI_FALSE;
}
@@ -183,7 +183,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_commons_crypto_random_OpensslSecureRa
}
/**
- * To ensure thread safety for random number generators, we need to call
+ * To ensure thread safety for random number generators, we need to call
* CRYPTO_set_locking_callback.
* http://wiki.openssl.org/index.php/Random_Numbers
* Example: crypto/threads/mttest.c
@@ -221,7 +221,7 @@ static void locks_cleanup(void)
static void windows_locking_callback(int mode, int type, char *file, int line)
{
UNUSED(file), UNUSED(line);
-
+
if (mode & CRYPTO_LOCK) {
WaitForSingleObject(lock_cs[type], INFINITE);
} else {
@@ -244,7 +244,7 @@ static void locks_setup(void)
for (i = 0; i < dlsym_CRYPTO_num_locks(); i++) {
pthread_mutex_init(&(lock_cs[i]), NULL);
}
-
+
dlsym_CRYPTO_set_id_callback((unsigned long (*)())pthreads_thread_id);
dlsym_CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback);
}
@@ -253,18 +253,18 @@ static void locks_cleanup(void)
{
int i;
dlsym_CRYPTO_set_locking_callback(NULL);
-
+
for (i = 0; i < dlsym_CRYPTO_num_locks(); i++) {
pthread_mutex_destroy(&(lock_cs[i]));
}
-
+
dlsym_CRYPTO_free(lock_cs);
}
static void pthreads_locking_callback(int mode, int type, char *file, int line)
{
UNUSED(file), UNUSED(line);
-
+
if (mode & CRYPTO_LOCK) {
pthread_mutex_lock(&(lock_cs[type]));
} else {
@@ -286,33 +286,33 @@ static unsigned long pthreads_thread_id(void)
static ENGINE * openssl_rand_init(void)
{
locks_setup();
-
+
dlsym_ENGINE_load_rdrand();
ENGINE *eng = dlsym_ENGINE_by_id("rdrand");
-
+
int ret = -1;
do {
if (NULL == eng) {
break;
}
-
+
int rc = dlsym_ENGINE_init(eng);
if (0 == rc) {
break;
}
-
+
rc = dlsym_ENGINE_set_default(eng, ENGINE_METHOD_RAND);
if (0 == rc) {
break;
}
-
+
ret = 0;
} while(0);
-
+
if (ret == -1) {
openssl_rand_clean(eng, 0);
}
-
+
return eng;
}
@@ -322,7 +322,7 @@ static void openssl_rand_clean(ENGINE *eng, int clean_locks)
dlsym_ENGINE_finish(eng);
dlsym_ENGINE_free(eng);
}
-
+
dlsym_ENGINE_cleanup();
if (clean_locks) {
locks_cleanup();