13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #include <stdlib.h>
27 #include <string.h>
28 #include <strings.h>
29 #include <jni.h>
30 #include "jni_util.h"
31 #include "nativeCrypto.h"
32 #include "nativeFunc.h"
33
34
35 extern void throwOutOfMemoryError(JNIEnv *env, const char *msg);
36 extern jbyte* getBytes(JNIEnv *env, jbyteArray bytes, int offset, int len);
37
38 ///////////////////////////////////////////////////////
39 // SPECIAL ENTRIES FOR JVM JNI-BYPASSING OPTIMIZATION
40 ////////////////////////////////////////////////////////
41 JNIEXPORT jlong JNICALL
42 JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeInit(jint mech) {
43 void *pContext = NULL;
44
45 switch (mech) {
46 case com_oracle_security_ucrypto_NativeDigestMD_MECH_SHA1:
47 pContext = malloc(sizeof(SHA1_CTX));
48 if (pContext != NULL) {
49 (*ftab->sha1Init)((SHA1_CTX *)pContext);
50 }
51 break;
52 case com_oracle_security_ucrypto_NativeDigestMD_MECH_MD5:
53 pContext = malloc(sizeof(MD5_CTX));
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #include <stdlib.h>
27 #include <string.h>
28 #include <strings.h>
29 #include <jni.h>
30 #include "jni_util.h"
31 #include "nativeCrypto.h"
32 #include "nativeFunc.h"
33 #include "com_oracle_security_ucrypto_NativeDigestMD.h"
34
35 extern void throwOutOfMemoryError(JNIEnv *env, const char *msg);
36 extern jbyte* getBytes(JNIEnv *env, jbyteArray bytes, int offset, int len);
37
38 ///////////////////////////////////////////////////////
39 // SPECIAL ENTRIES FOR JVM JNI-BYPASSING OPTIMIZATION
40 ////////////////////////////////////////////////////////
41 JNIEXPORT jlong JNICALL
42 JavaCritical_com_oracle_security_ucrypto_NativeDigestMD_nativeInit(jint mech) {
43 void *pContext = NULL;
44
45 switch (mech) {
46 case com_oracle_security_ucrypto_NativeDigestMD_MECH_SHA1:
47 pContext = malloc(sizeof(SHA1_CTX));
48 if (pContext != NULL) {
49 (*ftab->sha1Init)((SHA1_CTX *)pContext);
50 }
51 break;
52 case com_oracle_security_ucrypto_NativeDigestMD_MECH_MD5:
53 pContext = malloc(sizeof(MD5_CTX));
|