< prev index next >
src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCryptoMD.c
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -36,11 +36,12 @@
extern jbyte* getBytes(JNIEnv *env, jbyteArray bytes, int offset, int len);
///////////////////////////////////////////////////////
// SPECIAL ENTRIES FOR JVM JNI-BYPASSING OPTIMIZATION
////////////////////////////////////////////////////////
-jlong JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeInit(jint mech) {
+JNIEXPORT jlong JNICALL
+JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeInit(jint mech) {
void *pContext = NULL;
switch (mech) {
case com_oracle_security_ucrypto_NativeDigestMD_MECH_SHA1:
pContext = malloc(sizeof(SHA1_CTX));
@@ -76,11 +77,12 @@
if (J2UC_DEBUG) printf("ERROR: Unsupported mech %i\n", mech);
}
return (jlong) pContext;
}
-jint JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeUpdate
+JNIEXPORT jint JNICALL
+JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeUpdate
(jint mech, jlong pContext, int notUsed, unsigned char* in, jint ofs, jint len) {
if (mech == com_oracle_security_ucrypto_NativeDigestMD_MECH_SHA1) {
(*ftab->sha1Update)((SHA1_CTX*)pContext, (unsigned char*)(in+ofs), len);
} else if (mech == com_oracle_security_ucrypto_NativeDigestMD_MECH_MD5) {
(*ftab->md5Update)((MD5_CTX*)pContext, (unsigned char*)(in+ofs), len);
@@ -89,11 +91,12 @@
}
return 0;
}
// Do digest and free the context immediately
-jint JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeDigest
+JNIEXPORT jint JNICALL
+JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeDigest
(jint mech, jlong pContext, int notUsed, unsigned char* out, jint ofs, jint digestLen) {
if (mech == com_oracle_security_ucrypto_NativeDigestMD_MECH_SHA1) {
(*ftab->sha1Final)((unsigned char*)(out + ofs), (SHA1_CTX *)pContext);
free((SHA1_CTX *)pContext);
@@ -105,11 +108,12 @@
free((SHA2_CTX *)pContext);
}
return 0;
}
-jlong JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeClone
+JNIEXPORT jlong JNICALL
+JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeClone
(jint mech, jlong pContext) {
void *copy = NULL;
size_t len = 0;
if (mech == com_oracle_security_ucrypto_NativeDigestMD_MECH_SHA1) {
@@ -124,11 +128,12 @@
bcopy((void *)pContext, copy, len);
}
return (jlong) copy;
}
-void JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeFree
+JNIEXPORT void JNICALL
+JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeFree
(jint mech, jlong pContext) {
if (mech == com_oracle_security_ucrypto_NativeDigestMD_MECH_SHA1) {
free((SHA1_CTX*) pContext);
} else if (mech == com_oracle_security_ucrypto_NativeDigestMD_MECH_MD5) {
free((MD5_CTX*) pContext);
< prev index next >