< prev index next >

src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCrypto.c

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2014, 2016, 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 --- 1,7 ---- /* ! * Copyright (c) 2014, 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
*** 307,317 **** } //////////////////////////////////////////////////////// // SPECIAL ENTRIES FOR JVM JNI-BYPASSING OPTIMIZATION //////////////////////////////////////////////////////// ! jlong JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeInit(jint mech) { crypto_ctx_t *context = NULL; int rv; context = malloc(sizeof(crypto_ctx_t)); if (context != NULL) { --- 307,318 ---- } //////////////////////////////////////////////////////// // SPECIAL ENTRIES FOR JVM JNI-BYPASSING OPTIMIZATION //////////////////////////////////////////////////////// ! JNIEXPORT jlong JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeInit(jint mech) { crypto_ctx_t *context = NULL; int rv; context = malloc(sizeof(crypto_ctx_t)); if (context != NULL) {
*** 323,333 **** } } return (jlong) context; } ! jint JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeUpdate (jint mech, jlong pContext, int notUsed, unsigned char* in, jint ofs, jint len) { crypto_ctx_t *context; jint rv = 0; context = (crypto_ctx_t *) pContext; --- 324,335 ---- } } return (jlong) context; } ! JNIEXPORT jint JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeUpdate (jint mech, jlong pContext, int notUsed, unsigned char* in, jint ofs, jint len) { crypto_ctx_t *context; jint rv = 0; context = (crypto_ctx_t *) pContext;
*** 340,350 **** } return -rv; // use negative value to indicate error } ! jint JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeDigest (jint mech, jlong pContext, int notUsed, unsigned char* out, jint ofs, jint digestLen) { crypto_ctx_t *context; jint rv = 0; size_t digest_len = digestLen; --- 342,353 ---- } return -rv; // use negative value to indicate error } ! JNIEXPORT jint JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeDigest (jint mech, jlong pContext, int notUsed, unsigned char* out, jint ofs, jint digestLen) { crypto_ctx_t *context; jint rv = 0; size_t digest_len = digestLen;
*** 357,376 **** } return -rv; // use negative value to indicate error } ! void JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeFree (jint mech, jlong pContext) { crypto_ctx_t *context; context = (crypto_ctx_t *) pContext; freeContext(context); } // AES ! jlong JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeInit (jint mech, jboolean encrypt, int keyLen, unsigned char* bufKey, int ivLen, unsigned char* bufIv, jint tagLen, int aadLen, unsigned char* bufAad) { crypto_ctx_t *context = NULL; int rv; --- 360,381 ---- } return -rv; // use negative value to indicate error } ! JNIEXPORT void JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeFree (jint mech, jlong pContext) { crypto_ctx_t *context; context = (crypto_ctx_t *) pContext; freeContext(context); } // AES ! JNIEXPORT jlong JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeInit (jint mech, jboolean encrypt, int keyLen, unsigned char* bufKey, int ivLen, unsigned char* bufIv, jint tagLen, int aadLen, unsigned char* bufAad) { crypto_ctx_t *context = NULL; int rv;
*** 389,399 **** /* * Class: com_oracle_security_ucrypto_NativeCipher * Method: nativeUpdate * Signature: (JZ[BII[BI)I */ ! jint JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate (jlong pContext, jboolean encrypt, int notUsed, jbyte* bufIn, jint inOfs, jint inLen, int outCapacity, jbyte* bufOut, jint outOfs) { crypto_ctx_t *context; int rv = 0; int outLen = outCapacity - outOfs; // recalculate the real out length --- 394,405 ---- /* * Class: com_oracle_security_ucrypto_NativeCipher * Method: nativeUpdate * Signature: (JZ[BII[BI)I */ ! JNIEXPORT jint JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate (jlong pContext, jboolean encrypt, int notUsed, jbyte* bufIn, jint inOfs, jint inLen, int outCapacity, jbyte* bufOut, jint outOfs) { crypto_ctx_t *context; int rv = 0; int outLen = outCapacity - outOfs; // recalculate the real out length
*** 411,421 **** /* * Class: com_oracle_security_ucrypto_NativeCipher * Method: nativeFinal * Signature: (JZ[BI)I */ ! jint JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal (jlong pContext, jboolean encrypt, int outLen, jbyte* out, jint outOfs) { crypto_ctx_t *context; int rv = 0; unsigned char* bufOut = (unsigned char*) out; --- 417,428 ---- /* * Class: com_oracle_security_ucrypto_NativeCipher * Method: nativeFinal * Signature: (JZ[BI)I */ ! JNIEXPORT jint JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal (jlong pContext, jboolean encrypt, int outLen, jbyte* out, jint outOfs) { crypto_ctx_t *context; int rv = 0; unsigned char* bufOut = (unsigned char*) out;
*** 662,672 **** /* * Class: com_oracle_security_ucrypto_NativeKey * Method: nativeFree * Signature: (JI)V */ ! void JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree (jlong id, jint numOfComponents) { crypto_object_attribute_t* pKey; int i; pKey = (crypto_object_attribute_t*) id; --- 669,680 ---- /* * Class: com_oracle_security_ucrypto_NativeKey * Method: nativeFree * Signature: (JI)V */ ! JNIEXPORT void JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree (jlong id, jint numOfComponents) { crypto_object_attribute_t* pKey; int i; pKey = (crypto_object_attribute_t*) id;
*** 684,694 **** /* * Class: com_oracle_security_ucrypto_NativeKey_RSAPrivate * Method: nativeInit * Signature: ([B[B)J */ ! jlong JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit (int modLen, jbyte* jMod, int privLen, jbyte* jPriv) { unsigned char *mod, *priv; crypto_object_attribute_t* pKey = NULL; --- 692,703 ---- /* * Class: com_oracle_security_ucrypto_NativeKey_RSAPrivate * Method: nativeInit * Signature: ([B[B)J */ ! JNIEXPORT jlong JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit (int modLen, jbyte* jMod, int privLen, jbyte* jPriv) { unsigned char *mod, *priv; crypto_object_attribute_t* pKey = NULL;
*** 764,774 **** /* * Class: com_oracle_security_ucrypto_NativeKey_RSAPrivateCrt * Method: nativeInit * Signature: ([B[B[B[B[B[B[B[B)J */ ! jlong JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit (int modLen, jbyte* jMod, int pubLen, jbyte* jPub, int privLen, jbyte* jPriv, int pLen, jbyte* jP, int qLen, jbyte* jQ, int expPLen, jbyte* jExpP, int expQLen, jbyte* jExpQ, int crtCoeffLen, jbyte* jCrtCoeff) { unsigned char *mod, *pub, *priv, *p, *q, *expP, *expQ, *crtCoeff; --- 773,784 ---- /* * Class: com_oracle_security_ucrypto_NativeKey_RSAPrivateCrt * Method: nativeInit * Signature: ([B[B[B[B[B[B[B[B)J */ ! JNIEXPORT jlong JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit (int modLen, jbyte* jMod, int pubLen, jbyte* jPub, int privLen, jbyte* jPriv, int pLen, jbyte* jP, int qLen, jbyte* jQ, int expPLen, jbyte* jExpP, int expQLen, jbyte* jExpQ, int crtCoeffLen, jbyte* jCrtCoeff) { unsigned char *mod, *pub, *priv, *p, *q, *expP, *expQ, *crtCoeff;
*** 935,945 **** * Class: com_oracle_security_ucrypto_NativeKey_RSAPublic * Method: nativeInit * Signature: ([B[B)J */ ! jlong JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit (int modLen, jbyte* jMod, int pubLen, jbyte* jPub) { unsigned char *mod, *pub; crypto_object_attribute_t* pKey = NULL; pKey = calloc(2, sizeof(crypto_object_attribute_t)); --- 945,956 ---- * Class: com_oracle_security_ucrypto_NativeKey_RSAPublic * Method: nativeInit * Signature: ([B[B)J */ ! JNIEXPORT jlong JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit (int modLen, jbyte* jMod, int pubLen, jbyte* jPub) { unsigned char *mod, *pub; crypto_object_attribute_t* pKey = NULL; pKey = calloc(2, sizeof(crypto_object_attribute_t));
*** 1046,1056 **** /* * Class: com_oracle_security_ucrypto_NativeRSASignature * Method: nativeInit * Signature: (IZJI[B)J */ ! jlong JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeInit (jint mech, jboolean sign, jlong jKey, jint keyLength) { crypto_ctx_t *context; int rv; uchar_t *pKey; --- 1057,1068 ---- /* * Class: com_oracle_security_ucrypto_NativeRSASignature * Method: nativeInit * Signature: (IZJI[B)J */ ! JNIEXPORT jlong JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeInit (jint mech, jboolean sign, jlong jKey, jint keyLength) { crypto_ctx_t *context; int rv; uchar_t *pKey;
*** 1092,1102 **** /* * Class: com_oracle_security_ucrypto_NativeRSASignature * Method: nativeUpdate * Signature: (JZ[BII)I */ ! jint JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII (jlong pCtxt, jboolean sign, int notUsed, jbyte* jIn, jint jInOfs, jint jInLen) { crypto_ctx_t *context; int rv = 0; context = (crypto_ctx_t *) pCtxt; --- 1104,1115 ---- /* * Class: com_oracle_security_ucrypto_NativeRSASignature * Method: nativeUpdate * Signature: (JZ[BII)I */ ! JNIEXPORT jint JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII (jlong pCtxt, jboolean sign, int notUsed, jbyte* jIn, jint jInOfs, jint jInLen) { crypto_ctx_t *context; int rv = 0; context = (crypto_ctx_t *) pCtxt;
*** 1140,1150 **** /* * Class: com_oracle_security_ucrypto_NativeRSASignature * Method: nativeUpdate * Signature: (JZJI)I */ ! jint JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZJI (jlong pCtxt, jboolean sign, jlong inAddr, jint inLen) { return JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII (pCtxt, sign, inLen, (jbyte*)inAddr, 0, inLen); } --- 1153,1164 ---- /* * Class: com_oracle_security_ucrypto_NativeRSASignature * Method: nativeUpdate * Signature: (JZJI)I */ ! JNIEXPORT jint JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZJI (jlong pCtxt, jboolean sign, jlong inAddr, jint inLen) { return JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII (pCtxt, sign, inLen, (jbyte*)inAddr, 0, inLen); }
*** 1159,1169 **** /* * Class: com_oracle_security_ucrypto_NativeRSASignature * Method: nativeFinal * Signature: (JZ[BII)I */ ! jint JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeFinal (jlong pCtxt, jboolean sign, int notUsed, jbyte* bufSig, jint sigOfs, jint jSigLen) { crypto_ctx_t *context; int rv = 0; size_t sigLength = (size_t) jSigLen; --- 1173,1184 ---- /* * Class: com_oracle_security_ucrypto_NativeRSASignature * Method: nativeFinal * Signature: (JZ[BII)I */ ! JNIEXPORT jint JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeFinal (jlong pCtxt, jboolean sign, int notUsed, jbyte* bufSig, jint sigOfs, jint jSigLen) { crypto_ctx_t *context; int rv = 0; size_t sigLength = (size_t) jSigLen;
*** 1234,1244 **** /* * Class: com_oracle_security_ucrypto_NativeRSACipher * Method: nativeAtomic * Signature: (IZJI[BI[BII)I */ ! jint JavaCritical_com_oracle_security_ucrypto_NativeRSACipher_nativeAtomic (jint mech, jboolean encrypt, jlong keyValue, jint keyLength, int notUsed1, jbyte* bufIn, jint jInLen, int notUsed2, jbyte* bufOut, jint jOutOfs, jint jOutLen) { uchar_t *pKey; --- 1249,1260 ---- /* * Class: com_oracle_security_ucrypto_NativeRSACipher * Method: nativeAtomic * Signature: (IZJI[BI[BII)I */ ! JNIEXPORT jint JNICALL ! JavaCritical_com_oracle_security_ucrypto_NativeRSACipher_nativeAtomic (jint mech, jboolean encrypt, jlong keyValue, jint keyLength, int notUsed1, jbyte* bufIn, jint jInLen, int notUsed2, jbyte* bufOut, jint jOutOfs, jint jOutLen) { uchar_t *pKey;
< prev index next >