提交 4a01135f 编写于 作者: C chegar

7103549: Remove dependencies on libjava and libjvm from security libraries

Reviewed-by: vinnie, ohair, alanb, dholmes
上级 c67831ac
......@@ -78,7 +78,3 @@ endif # linux
#
include $(BUILDDIR)/common/Library.gmk
#
# JVMDI implementation lives in the VM.
#
OTHER_LDLIBS = $(JVMLIB)
......@@ -220,14 +220,30 @@ JDK_LOCALES = ja zh_CN
JRE_NONEXIST_LOCALES = en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
#
# All libraries except libjava and libjvm itself link against libjvm and
# libjava, the latter for its exported common utilities. libjava only links
# against libjvm. Programs' makefiles take their own responsibility for
# For now, most libraries except libjava and libjvm itself link against libjvm
# and libjava, the latter for its exported common utilities. libjava only
# links against libjvm. Programs' makefiles take their own responsibility for
# adding other libs.
#
# The makefiles for these packages do not link against libjvm and libjava.
# This list will eventually go away and each Programs' makefiles
# will have to explicitly declare that they want to link to libjava/libjvm
#
NO_JAVALIB_PKGS = \
sun.security.mscapi \
sun.security.krb5 \
sun.security.pkcs11 \
sun.security.jgss \
sun.security.jgss.wrapper \
sun.security.ec \
sun.security.smartcardio \
com.sun.security.auth.module
ifdef PACKAGE
# put JAVALIB first, but do not lose any platform specific values....
LDLIBS_COMMON = $(JAVALIB)
ifeq (,$(findstring $(PACKAGE),$(NO_JAVALIB_PKGS)))
LDLIBS_COMMON = $(JAVALIB)
endif
endif # PACKAGE
#
......
......@@ -165,7 +165,7 @@ $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
$(LINK) -dll -out:$(OBJDIR)/$(@F) \
-map:$(OBJDIR)/$(LIBRARY).map \
$(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \
$(OTHER_LCF) $(JAVALIB) $(LDLIBS)
$(OTHER_LCF) $(LDLIBS)
$(CP) $(OBJDIR)/$(@F) $@
@$(call binary_file_verification,$@)
$(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
......
......@@ -192,10 +192,8 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
#
# Libraries to link
#
ifeq ($(PLATFORM), windows)
OTHER_LDLIBS += $(JVMLIB)
else
OTHER_LDLIBS = -ldl $(JVMLIB) $(LIBCXX)
ifneq ($(PLATFORM), windows)
OTHER_LDLIBS = $(LIBCXX)
endif
include $(BUILDDIR)/common/Mapfile-vers.gmk
......
......@@ -72,5 +72,6 @@ include $(BUILDDIR)/common/Library.gmk
# Libraries to link
#
ifneq ($(PLATFORM), windows)
OTHER_LDLIBS = -ldl $(JVMLIB)
OTHER_LDLIBS = -ldl
endif
......@@ -69,15 +69,6 @@ else
include $(BUILDDIR)/common/Classes.gmk
endif # PLATFORM
#
# Libraries to link
#
ifeq ($(PLATFORM), windows)
OTHER_LDLIBS = $(JVMLIB)
else
OTHER_LDLIBS = -ldl $(JVMLIB)
endif
build:
ifeq ($(PLATFORM),windows)
$(call make-launcher, kinit, sun.security.krb5.internal.tools.Kinit, , )
......
......@@ -159,7 +159,7 @@ include $(BUILDDIR)/common/Library.gmk
# Libraries to link
#
ifeq ($(PLATFORM), windows)
OTHER_LDLIBS += $(JVMLIB) Crypt32.Lib
OTHER_LDLIBS += Crypt32.Lib
endif
#
......
......@@ -159,10 +159,8 @@ include $(BUILDDIR)/common/Library.gmk
#
# Libraries to link
#
ifeq ($(PLATFORM), windows)
OTHER_LDLIBS = $(JVMLIB)
else
OTHER_LDLIBS = -ldl $(JVMLIB)
ifneq ($(PLATFORM), windows)
OTHER_LDLIBS = -ldl
endif
# Other config files
......
......@@ -73,8 +73,8 @@ include $(BUILDDIR)/common/Library.gmk
# Libraries to link
#
ifeq ($(PLATFORM), windows)
OTHER_LDLIBS = $(JVMLIB) winscard.lib
OTHER_LDLIBS = winscard.lib
else
OTHER_LDLIBS = -ldl $(JVMLIB)
OTHER_LDLIBS = -ldl
OTHER_CFLAGS = -D__sun_jdk
endif
......@@ -273,7 +273,7 @@ CK_VERSION_PTR jVersionToCKVersionPtr(JNIEnv *env, jobject jVersion)
/* allocate memory for CK_VERSION pointer */
ckpVersion = (CK_VERSION_PTR) malloc(sizeof(CK_VERSION));
if (ckpVersion == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
ckpVersion->major = jByteToCKByte(jMajor);
......@@ -326,7 +326,7 @@ CK_DATE * jDateObjectPtrToCKDatePtr(JNIEnv *env, jobject jDate)
/* allocate memory for CK_DATE pointer */
ckpDate = (CK_DATE *) malloc(sizeof(CK_DATE));
if (ckpDate == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......@@ -340,7 +340,7 @@ CK_DATE * jDateObjectPtrToCKDatePtr(JNIEnv *env, jobject jDate)
jTempChars = (jchar*) malloc((ckLength) * sizeof(jchar));
if (jTempChars == NULL) {
free(ckpDate);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
(*env)->GetCharArrayRegion(env, jYear, 0, ckLength, jTempChars);
......@@ -364,7 +364,7 @@ CK_DATE * jDateObjectPtrToCKDatePtr(JNIEnv *env, jobject jDate)
jTempChars = (jchar*) malloc((ckLength) * sizeof(jchar));
if (jTempChars == NULL) {
free(ckpDate);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
(*env)->GetCharArrayRegion(env, jMonth, 0, ckLength, jTempChars);
......@@ -388,7 +388,7 @@ CK_DATE * jDateObjectPtrToCKDatePtr(JNIEnv *env, jobject jDate)
jTempChars = (jchar*) malloc((ckLength) * sizeof(jchar));
if (jTempChars == NULL) {
free(ckpDate);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
(*env)->GetCharArrayRegion(env, jDay, 0, ckLength, jTempChars);
......@@ -558,7 +558,7 @@ CK_TLS_PRF_PARAMS jTlsPrfParamsToCKTlsPrfParam(JNIEnv *env, jobject jParam)
if (ckParam.pulOutputLen == NULL) {
free(ckParam.pSeed);
free(ckParam.pLabel);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return ckParam;
}
jByteArrayToCKByteArray(env, jOutput, &(ckParam.pOutput), ckParam.pulOutputLen);
......@@ -665,7 +665,7 @@ CK_SSL3_KEY_MAT_PARAMS jSsl3KeyMatParamToCKSsl3KeyMatParam(JNIEnv *env, jobject
if (ckParam.pReturnedKeyMaterial == NULL) {
free(ckParam.RandomInfo.pClientRandom);
free(ckParam.RandomInfo.pServerRandom);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return ckParam;
}
......@@ -1013,7 +1013,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR) malloc(sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1040,7 +1040,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_SSL3_KEY_MAT_PARAMS_PTR) malloc(sizeof(CK_SSL3_KEY_MAT_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1067,7 +1067,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_TLS_PRF_PARAMS_PTR) malloc(sizeof(CK_TLS_PRF_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1094,7 +1094,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_AES_CTR_PARAMS_PTR) malloc(sizeof(CK_AES_CTR_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1121,7 +1121,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_RSA_PKCS_OAEP_PARAMS_PTR) malloc(sizeof(CK_RSA_PKCS_OAEP_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1148,7 +1148,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_PBE_PARAMS_PTR) malloc(sizeof(CK_PBE_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1175,7 +1175,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_PKCS5_PBKD2_PARAMS_PTR) malloc(sizeof(CK_PKCS5_PBKD2_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1202,7 +1202,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_RSA_PKCS_PSS_PARAMS_PTR) malloc(sizeof(CK_RSA_PKCS_PSS_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1229,7 +1229,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_ECDH1_DERIVE_PARAMS_PTR) malloc(sizeof(CK_ECDH1_DERIVE_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1256,7 +1256,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_ECDH2_DERIVE_PARAMS_PTR) malloc(sizeof(CK_ECDH2_DERIVE_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1283,7 +1283,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_X9_42_DH1_DERIVE_PARAMS_PTR) malloc(sizeof(CK_X9_42_DH1_DERIVE_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......@@ -1310,7 +1310,7 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
ckpParam = (CK_X9_42_DH2_DERIVE_PARAMS_PTR) malloc(sizeof(CK_X9_42_DH2_DERIVE_PARAMS));
if (ckpParam == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
......
......@@ -131,7 +131,7 @@ JNIEXPORT jint JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DigestSingle
/* always use single part op, even for large data */
bufP = (CK_BYTE_PTR) malloc((size_t)jInLen);
if (bufP == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return 0;
}
}
......@@ -190,7 +190,7 @@ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DigestUpdate
bufLen = min(MAX_HEAP_BUFFER_LEN, jInLen);
bufP = (CK_BYTE_PTR) malloc((size_t)bufLen);
if (bufP == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
}
......
......@@ -92,7 +92,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DigestEn
ckpEncryptedPart = (CK_BYTE_PTR) malloc(ckEncryptedPartLength * sizeof(CK_BYTE));
if (ckpEncryptedPart == NULL) {
free(ckpPart);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......@@ -144,7 +144,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptD
ckpPart = (CK_BYTE_PTR) malloc(ckPartLength * sizeof(CK_BYTE));
if (ckpPart == NULL) {
free(ckpEncryptedPart);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......@@ -196,7 +196,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1SignEncr
ckpEncryptedPart = (CK_BYTE_PTR) malloc(ckEncryptedPartLength * sizeof(CK_BYTE));
if (ckpEncryptedPart == NULL) {
free(ckpPart);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......@@ -248,7 +248,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptV
ckpPart = (CK_BYTE_PTR) malloc(ckPartLength * sizeof(CK_BYTE));
if (ckpPart == NULL) {
free(ckpEncryptedPart);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......
......@@ -71,7 +71,10 @@ jfieldID mech_pParameterID;
jclass jByteArrayClass;
jclass jLongClass;
JavaVM* jvm = NULL;
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
jvm = vm;
return JNI_VERSION_1_4;
}
......@@ -351,7 +354,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetSlotList
ckpSlotList = (CK_SLOT_ID_PTR) malloc(ckTokenNumber * sizeof(CK_SLOT_ID));
if (ckpSlotList == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......@@ -652,7 +655,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetMechanismList
ckpMechanismList = (CK_MECHANISM_TYPE_PTR)
malloc(ckMechanismNumber * sizeof(CK_MECHANISM_TYPE));
if (ckpMechanismList == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......
......@@ -165,7 +165,7 @@ JNIEXPORT jlongArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1Generate
if (ckMechanism.pParameter != NULL_PTR) {
free(ckMechanism.pParameter);
}
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
ckpPublicKeyHandle = ckpKeyHandles; /* first element of array is Public Key */
......@@ -253,7 +253,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1WrapKey
if (ckMechanism.pParameter != NULL_PTR) {
free(ckMechanism.pParameter);
}
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......
......@@ -92,7 +92,7 @@ CK_C_INITIALIZE_ARGS_PTR makeCKInitArgsAdapter(JNIEnv *env, jobject jInitArgs)
/* convert the Java InitArgs object to a pointer to a CK_C_INITIALIZE_ARGS structure */
ckpInitArgs = (CK_C_INITIALIZE_ARGS_PTR) malloc(sizeof(CK_C_INITIALIZE_ARGS));
if (ckpInitArgs == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL_PTR;
}
......@@ -141,7 +141,7 @@ CK_C_INITIALIZE_ARGS_PTR makeCKInitArgsAdapter(JNIEnv *env, jobject jInitArgs)
ckpGlobalInitArgs = (CK_C_INITIALIZE_ARGS_PTR) malloc(sizeof(CK_C_INITIALIZE_ARGS));
if (ckpGlobalInitArgs == NULL) {
free(ckpInitArgs);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL_PTR;
}
......@@ -178,9 +178,8 @@ CK_C_INITIALIZE_ARGS_PTR makeCKInitArgsAdapter(JNIEnv *env, jobject jInitArgs)
*/
CK_RV callJCreateMutex(CK_VOID_PTR_PTR ppMutex)
{
JavaVM *jvm;
extern JavaVM *jvm;
JNIEnv *env;
jsize actualNumberVMs;
jint returnValue;
jthrowable pkcs11Exception;
jclass pkcs11ExceptionClass;
......@@ -196,8 +195,7 @@ CK_RV callJCreateMutex(CK_VOID_PTR_PTR ppMutex)
/* Get the currently running Java VM */
returnValue = JNI_GetCreatedJavaVMs(&jvm, (jsize) 1, &actualNumberVMs);
if ((returnValue != 0) || (actualNumberVMs <= 0)) { return rv ;} /* there is no VM running */
if (jvm == NULL) { return rv ;} /* there is no VM running */
/* Determine, if current thread is already attached */
returnValue = (*jvm)->GetEnv(jvm, (void **) &env, JNI_VERSION_1_2);
......@@ -273,9 +271,8 @@ CK_RV callJCreateMutex(CK_VOID_PTR_PTR ppMutex)
*/
CK_RV callJDestroyMutex(CK_VOID_PTR pMutex)
{
JavaVM *jvm;
extern JavaVM *jvm;
JNIEnv *env;
jsize actualNumberVMs;
jint returnValue;
jthrowable pkcs11Exception;
jclass pkcs11ExceptionClass;
......@@ -291,8 +288,7 @@ CK_RV callJDestroyMutex(CK_VOID_PTR pMutex)
/* Get the currently running Java VM */
returnValue = JNI_GetCreatedJavaVMs(&jvm, (jsize) 1, &actualNumberVMs);
if ((returnValue != 0) || (actualNumberVMs <= 0)) { return rv ; } /* there is no VM running */
if (jvm == NULL) { return rv ; } /* there is no VM running */
/* Determine, if current thread is already attached */
returnValue = (*jvm)->GetEnv(jvm, (void **) &env, JNI_VERSION_1_2);
......@@ -367,9 +363,8 @@ CK_RV callJDestroyMutex(CK_VOID_PTR pMutex)
*/
CK_RV callJLockMutex(CK_VOID_PTR pMutex)
{
JavaVM *jvm;
extern JavaVM *jvm;
JNIEnv *env;
jsize actualNumberVMs;
jint returnValue;
jthrowable pkcs11Exception;
jclass pkcs11ExceptionClass;
......@@ -385,8 +380,7 @@ CK_RV callJLockMutex(CK_VOID_PTR pMutex)
/* Get the currently running Java VM */
returnValue = JNI_GetCreatedJavaVMs(&jvm, (jsize) 1, &actualNumberVMs);
if ((returnValue != 0) || (actualNumberVMs <= 0)) { return rv ; } /* there is no VM running */
if (jvm == NULL) { return rv ; } /* there is no VM running */
/* Determine, if current thread is already attached */
returnValue = (*jvm)->GetEnv(jvm, (void **) &env, JNI_VERSION_1_2);
......@@ -457,9 +451,8 @@ CK_RV callJLockMutex(CK_VOID_PTR pMutex)
*/
CK_RV callJUnlockMutex(CK_VOID_PTR pMutex)
{
JavaVM *jvm;
extern JavaVM *jvm;
JNIEnv *env;
jsize actualNumberVMs;
jint returnValue;
jthrowable pkcs11Exception;
jclass pkcs11ExceptionClass;
......@@ -475,8 +468,7 @@ CK_RV callJUnlockMutex(CK_VOID_PTR pMutex)
/* Get the currently running Java VM */
returnValue = JNI_GetCreatedJavaVMs(&jvm, (jsize) 1, &actualNumberVMs);
if ((returnValue != 0) || (actualNumberVMs <= 0)) { return rv ; } /* there is no VM running */
if (jvm == NULL) { return rv ; } /* there is no VM running */
/* Determine, if current thread is already attached */
returnValue = (*jvm)->GetEnv(jvm, (void **) &env, JNI_VERSION_1_2);
......
......@@ -258,7 +258,7 @@ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetAttributeVa
ckpAttributes[i].pValue = (void *) malloc(ckBufferLength);
if (ckpAttributes[i].pValue == NULL) {
freeCKAttributeArray(ckpAttributes, i);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
ckpAttributes[i].ulValueLen = ckBufferLength;
......@@ -390,7 +390,7 @@ JNIEXPORT jlongArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1FindObje
ckMaxObjectLength = jLongToCKULong(jMaxObjectCount);
ckpObjectHandleArray = (CK_OBJECT_HANDLE_PTR) malloc(sizeof(CK_OBJECT_HANDLE) * ckMaxObjectLength);
if (ckpObjectHandleArray == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......
......@@ -98,7 +98,7 @@ JNIEXPORT jlong JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1OpenSession
if (jNotify != NULL) {
notifyEncapsulation = (NotifyEncapsulation *) malloc(sizeof(NotifyEncapsulation));
if (notifyEncapsulation == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return 0L;
}
notifyEncapsulation->jApplicationData = (jApplication != NULL)
......@@ -301,7 +301,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetOpera
ckpState = (CK_BYTE_PTR) malloc(ckStateLength);
if (ckpState == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......@@ -435,7 +435,7 @@ void putNotifyEntry(JNIEnv *env, CK_SESSION_HANDLE hSession, NotifyEncapsulation
newNode = (NotifyListNode *) malloc(sizeof(NotifyListNode));
if (newNode == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
newNode->hSession = hSession;
......@@ -558,9 +558,8 @@ CK_RV notifyCallback(
)
{
NotifyEncapsulation *notifyEncapsulation;
JavaVM *jvm;
extern JavaVM *jvm;
JNIEnv *env;
jsize actualNumberVMs;
jint returnValue;
jlong jSessionHandle;
jlong jEvent;
......@@ -577,8 +576,7 @@ CK_RV notifyCallback(
notifyEncapsulation = (NotifyEncapsulation *) pApplication;
/* Get the currently running Java VM */
returnValue = JNI_GetCreatedJavaVMs(&jvm, (jsize) 1, &actualNumberVMs);
if ((returnValue != 0) || (actualNumberVMs <= 0)) { return rv ; } /* there is no VM running */
if (jvm == NULL) { return rv ; } /* there is no VM running */
/* Determine, if current thread is already attached */
returnValue = (*jvm)->GetEnv(jvm, (void **) &env, JNI_VERSION_1_2);
......
......@@ -132,7 +132,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1Sign
ckpSignature = (CK_BYTE_PTR) malloc(ckSignatureLength * sizeof(CK_BYTE));
if (ckpSignature == NULL) {
free(ckpData);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
......@@ -146,7 +146,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1Sign
ckpSignature = (CK_BYTE_PTR) malloc(256 * sizeof(CK_BYTE));
if (ckpSignature == NULL) {
free(ckpData);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
rv = (*ckpFunctions->C_Sign)(ckSessionHandle, ckpData, ckDataLength, ckpSignature, &ckSignatureLength);
......@@ -156,7 +156,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1Sign
ckpSignature = (CK_BYTE_PTR) malloc(ckSignatureLength * sizeof(CK_BYTE));
if (ckpSignature == NULL) {
free(ckpData);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
rv = (*ckpFunctions->C_Sign)(ckSessionHandle, ckpData, ckDataLength, ckpSignature, &ckSignatureLength);
......@@ -210,7 +210,7 @@ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1SignUpdate
bufLen = min(MAX_HEAP_BUFFER_LEN, jInLen);
bufP = (CK_BYTE_PTR) malloc((size_t)bufLen);
if (bufP == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
}
......@@ -270,7 +270,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1SignFina
if (rv == CKR_BUFFER_TOO_SMALL) {
bufP = (CK_BYTE_PTR) malloc(ckSignatureLength);
if (bufP == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
rv = (*ckpFunctions->C_SignFinal)(ckSessionHandle, bufP, &ckSignatureLength);
......@@ -355,7 +355,7 @@ JNIEXPORT jint JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1SignRecover
} else {
inBufP = (CK_BYTE_PTR) malloc((size_t)jInLen);
if (inBufP == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return 0;
}
}
......@@ -373,7 +373,7 @@ JNIEXPORT jint JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1SignRecover
if (inBufP != INBUF) {
free(inBufP);
}
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return 0;
}
rv = (*ckpFunctions->C_SignRecover)(ckSessionHandle, inBufP, jInLen, outBufP, &ckSignatureLength);
......@@ -508,7 +508,7 @@ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1VerifyUpdate
bufLen = min(MAX_HEAP_BUFFER_LEN, jInLen);
bufP = (CK_BYTE_PTR) malloc((size_t)bufLen);
if (bufP == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
}
......@@ -638,7 +638,7 @@ JNIEXPORT jint JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1VerifyRecover
} else {
inBufP = (CK_BYTE_PTR) malloc((size_t)jInLen);
if (inBufP == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return 0;
}
}
......@@ -656,7 +656,7 @@ JNIEXPORT jint JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1VerifyRecover
outBufP = (CK_BYTE_PTR) malloc(ckDataLength);
if (outBufP == NULL) {
if (inBufP != INBUF) { free(inBufP); }
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return 0;
}
rv = (*ckpFunctions->C_VerifyRecover)(ckSessionHandle, inBufP, jInLen, outBufP, &ckDataLength);
......
......@@ -213,28 +213,52 @@ jlong ckAssertReturnValueOK(JNIEnv *env, CK_RV returnValue)
return jErrorCode ;
}
/*
* This function simply throws an IOException
*
* @param env Used to call JNI funktions and to get the Exception class.
* @param message The message string of the Exception object.
* Throws a Java Exception by name
*/
void throwByName(JNIEnv *env, const char *name, const char *msg)
{
jclass cls = (*env)->FindClass(env, name);
if (cls != 0) /* Otherwise an exception has already been thrown */
(*env)->ThrowNew(env, cls, msg);
}
/*
* Throws java.lang.OutOfMemoryError
*/
void throwOutOfMemoryError(JNIEnv *env, const char *msg)
{
throwByName(env, "java/lang/OutOfMemoryError", msg);
}
/*
* Throws java.lang.NullPointerException
*/
void throwNullPointerException(JNIEnv *env, const char *msg)
{
throwByName(env, "java/lang/NullPointerException", msg);
}
/*
* Throws java.io.IOException
*/
void throwIOException(JNIEnv *env, const char *message)
void throwIOException(JNIEnv *env, const char *msg)
{
JNU_ThrowByName(env, CLASS_IO_EXCEPTION, message);
throwByName(env, "java/io/IOException", msg);
}
/*
* This function simply throws a PKCS#11RuntimeException with the given
* string as its message. If the message is NULL, the exception is created
* using the default constructor.
* string as its message.
*
* @param env Used to call JNI funktions and to get the Exception class.
* @param jmessage The message string of the Exception object.
*/
void throwPKCS11RuntimeException(JNIEnv *env, const char *message)
{
JNU_ThrowByName(env, CLASS_PKCS11RUNTIMEEXCEPTION, message);
throwByName(env, CLASS_PKCS11RUNTIMEEXCEPTION, message);
}
/*
......@@ -318,7 +342,7 @@ void jBooleanArrayToCKBBoolArray(JNIEnv *env, const jbooleanArray jArray, CK_BBO
*ckpLength = (*env)->GetArrayLength(env, jArray);
jpTemp = (jboolean*) malloc((*ckpLength) * sizeof(jboolean));
if (jpTemp == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
(*env)->GetBooleanArrayRegion(env, jArray, 0, *ckpLength, jpTemp);
......@@ -330,7 +354,7 @@ void jBooleanArrayToCKBBoolArray(JNIEnv *env, const jbooleanArray jArray, CK_BBO
*ckpArray = (CK_BBOOL*) malloc ((*ckpLength) * sizeof(CK_BBOOL));
if (*ckpArray == NULL) {
free(jpTemp);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
for (i=0; i<(*ckpLength); i++) {
......@@ -360,7 +384,7 @@ void jByteArrayToCKByteArray(JNIEnv *env, const jbyteArray jArray, CK_BYTE_PTR *
*ckpLength = (*env)->GetArrayLength(env, jArray);
jpTemp = (jbyte*) malloc((*ckpLength) * sizeof(jbyte));
if (jpTemp == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
(*env)->GetByteArrayRegion(env, jArray, 0, *ckpLength, jpTemp);
......@@ -376,7 +400,7 @@ void jByteArrayToCKByteArray(JNIEnv *env, const jbyteArray jArray, CK_BYTE_PTR *
*ckpArray = (CK_BYTE_PTR) malloc ((*ckpLength) * sizeof(CK_BYTE));
if (*ckpArray == NULL) {
free(jpTemp);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
for (i=0; i<(*ckpLength); i++) {
......@@ -407,7 +431,7 @@ void jLongArrayToCKULongArray(JNIEnv *env, const jlongArray jArray, CK_ULONG_PTR
*ckpLength = (*env)->GetArrayLength(env, jArray);
jTemp = (jlong*) malloc((*ckpLength) * sizeof(jlong));
if (jTemp == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
(*env)->GetLongArrayRegion(env, jArray, 0, *ckpLength, jTemp);
......@@ -419,7 +443,7 @@ void jLongArrayToCKULongArray(JNIEnv *env, const jlongArray jArray, CK_ULONG_PTR
*ckpArray = (CK_ULONG_PTR) malloc (*ckpLength * sizeof(CK_ULONG));
if (*ckpArray == NULL) {
free(jTemp);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
for (i=0; i<(*ckpLength); i++) {
......@@ -449,7 +473,7 @@ void jCharArrayToCKCharArray(JNIEnv *env, const jcharArray jArray, CK_CHAR_PTR *
*ckpLength = (*env)->GetArrayLength(env, jArray);
jpTemp = (jchar*) malloc((*ckpLength) * sizeof(jchar));
if (jpTemp == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
(*env)->GetCharArrayRegion(env, jArray, 0, *ckpLength, jpTemp);
......@@ -461,7 +485,7 @@ void jCharArrayToCKCharArray(JNIEnv *env, const jcharArray jArray, CK_CHAR_PTR *
*ckpArray = (CK_CHAR_PTR) malloc (*ckpLength * sizeof(CK_CHAR));
if (*ckpArray == NULL) {
free(jpTemp);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
for (i=0; i<(*ckpLength); i++) {
......@@ -491,7 +515,7 @@ void jCharArrayToCKUTF8CharArray(JNIEnv *env, const jcharArray jArray, CK_UTF8CH
*ckpLength = (*env)->GetArrayLength(env, jArray);
jTemp = (jchar*) malloc((*ckpLength) * sizeof(jchar));
if (jTemp == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
(*env)->GetCharArrayRegion(env, jArray, 0, *ckpLength, jTemp);
......@@ -503,7 +527,7 @@ void jCharArrayToCKUTF8CharArray(JNIEnv *env, const jcharArray jArray, CK_UTF8CH
*ckpArray = (CK_UTF8CHAR_PTR) malloc (*ckpLength * sizeof(CK_UTF8CHAR));
if (*ckpArray == NULL) {
free(jTemp);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
for (i=0; i<(*ckpLength); i++) {
......@@ -538,7 +562,7 @@ void jStringToCKUTF8CharArray(JNIEnv *env, const jstring jArray, CK_UTF8CHAR_PTR
*ckpArray = (CK_UTF8CHAR_PTR) malloc((*ckpLength + 1) * sizeof(CK_UTF8CHAR));
if (*ckpArray == NULL) {
(*env)->ReleaseStringUTFChars(env, (jstring) jArray, pCharArray);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
strcpy((char*)*ckpArray, pCharArray);
......@@ -571,7 +595,7 @@ void jAttributeArrayToCKAttributeArray(JNIEnv *env, jobjectArray jArray, CK_ATTR
*ckpLength = jLongToCKULong(jLength);
*ckpArray = (CK_ATTRIBUTE_PTR) malloc(*ckpLength * sizeof(CK_ATTRIBUTE));
if (*ckpArray == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
TRACE1(", converting %d attibutes", jLength);
......@@ -613,7 +637,7 @@ jbyteArray ckByteArrayToJByteArray(JNIEnv *env, const CK_BYTE_PTR ckpArray, CK_U
} else {
jpTemp = (jbyte*) malloc((ckLength) * sizeof(jbyte));
if (jpTemp == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
for (i=0; i<ckLength; i++) {
......@@ -647,7 +671,7 @@ jlongArray ckULongArrayToJLongArray(JNIEnv *env, const CK_ULONG_PTR ckpArray, CK
jpTemp = (jlong*) malloc((ckLength) * sizeof(jlong));
if (jpTemp == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
for (i=0; i<ckLength; i++) {
......@@ -678,7 +702,7 @@ jcharArray ckCharArrayToJCharArray(JNIEnv *env, const CK_CHAR_PTR ckpArray, CK_U
jpTemp = (jchar*) malloc(ckLength * sizeof(jchar));
if (jpTemp == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
for (i=0; i<ckLength; i++) {
......@@ -709,7 +733,7 @@ jcharArray ckUTF8CharArrayToJCharArray(JNIEnv *env, const CK_UTF8CHAR_PTR ckpArr
jpTemp = (jchar*) malloc(ckLength * sizeof(jchar));
if (jpTemp == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
for (i=0; i<ckLength; i++) {
......@@ -812,7 +836,7 @@ CK_BBOOL* jBooleanObjectToCKBBoolPtr(JNIEnv *env, jobject jObject)
jValue = (*env)->CallBooleanMethod(env, jObject, jValueMethod);
ckpValue = (CK_BBOOL *) malloc(sizeof(CK_BBOOL));
if (ckpValue == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
*ckpValue = jBooleanToCKBBool(jValue);
......@@ -842,7 +866,7 @@ CK_BYTE_PTR jByteObjectToCKBytePtr(JNIEnv *env, jobject jObject)
jValue = (*env)->CallByteMethod(env, jObject, jValueMethod);
ckpValue = (CK_BYTE_PTR) malloc(sizeof(CK_BYTE));
if (ckpValue == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
*ckpValue = jByteToCKByte(jValue);
......@@ -871,7 +895,7 @@ CK_ULONG* jIntegerObjectToCKULongPtr(JNIEnv *env, jobject jObject)
jValue = (*env)->CallIntMethod(env, jObject, jValueMethod);
ckpValue = (CK_ULONG *) malloc(sizeof(CK_ULONG));
if (ckpValue == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
*ckpValue = jLongToCKLong(jValue);
......@@ -900,7 +924,7 @@ CK_ULONG* jLongObjectToCKULongPtr(JNIEnv *env, jobject jObject)
jValue = (*env)->CallLongMethod(env, jObject, jValueMethod);
ckpValue = (CK_ULONG *) malloc(sizeof(CK_ULONG));
if (ckpValue == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
*ckpValue = jLongToCKULong(jValue);
......@@ -930,7 +954,7 @@ CK_CHAR_PTR jCharObjectToCKCharPtr(JNIEnv *env, jobject jObject)
jValue = (*env)->CallCharMethod(env, jObject, jValueMethod);
ckpValue = (CK_CHAR_PTR) malloc(sizeof(CK_CHAR));
if (ckpValue == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return NULL;
}
*ckpValue = jCharToCKChar(jValue);
......@@ -1087,7 +1111,7 @@ void jObjectToPrimitiveCKObjectPtrPtr(JNIEnv *env, jobject jObject, CK_VOID_PTR
malloc((strlen(exceptionMsgPrefix) + strlen(classNameString) + 1));
if (exceptionMsg == NULL) {
(*env)->ReleaseStringUTFChars(env, jClassNameString, classNameString);
JNU_ThrowOutOfMemoryError(env, 0);
throwOutOfMemoryError(env, 0);
return;
}
strcpy(exceptionMsg, exceptionMsgPrefix);
......
......@@ -228,7 +228,6 @@
#define CLASS_PKCS11EXCEPTION "sun/security/pkcs11/wrapper/PKCS11Exception"
#define CLASS_PKCS11RUNTIMEEXCEPTION "sun/security/pkcs11/wrapper/PKCS11RuntimeException"
#define CLASS_FILE_NOT_FOUND_EXCEPTION "java/io/FileNotFoundException"
#define CLASS_IO_EXCEPTION "java/io/IOException"
#define CLASS_C_INITIALIZE_ARGS "sun/security/pkcs11/wrapper/CK_C_INITIALIZE_ARGS"
#define CLASS_CREATEMUTEX "sun/security/pkcs11/wrapper/CK_CREATEMUTEX"
#define CLASS_DESTROYMUTEX "sun/security/pkcs11/wrapper/CK_DESTROYMUTEX"
......@@ -280,6 +279,8 @@
*/
jlong ckAssertReturnValueOK(JNIEnv *env, CK_RV returnValue);
void throwOutOfMemoryError(JNIEnv *env, const char *message);
void throwNullPointerException(JNIEnv *env, const char *message);
void throwIOException(JNIEnv *env, const char *message);
void throwPKCS11RuntimeException(JNIEnv *env, const char *message);
void throwDisconnectedRuntimeException(JNIEnv *env);
......
......@@ -40,7 +40,7 @@ void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName) {
if (fAddress == NULL) {
char errorMessage[256];
snprintf(errorMessage, sizeof(errorMessage), "Symbol not found: %s", functionName);
JNU_ThrowNullPointerException(env, errorMessage);
throwNullPointerException(env, errorMessage);
return NULL;
}
return fAddress;
......@@ -69,7 +69,7 @@ JNIEXPORT jlong JNICALL Java_sun_security_pkcs11_Secmod_nssLoadLibrary
dprintf2("-handle: %u (0X%X)\n", hModule, hModule);
if (hModule == NULL) {
JNU_ThrowIOException(env, dlerror());
throwIOException(env, dlerror());
return 0;
}
......
......@@ -51,12 +51,40 @@ FPTR_SCardBeginTransaction scardBeginTransaction;
FPTR_SCardEndTransaction scardEndTransaction;
FPTR_SCardControl scardControl;
/*
* Throws a Java Exception by name
*/
void throwByName(JNIEnv *env, const char *name, const char *msg)
{
jclass cls = (*env)->FindClass(env, name);
if (cls != 0) /* Otherwise an exception has already been thrown */
(*env)->ThrowNew(env, cls, msg);
}
/*
* Throws java.lang.NullPointerException
*/
void throwNullPointerException(JNIEnv *env, const char *msg)
{
throwByName(env, "java/lang/NullPointerException", msg);
}
/*
* Throws java.io.IOException
*/
void throwIOException(JNIEnv *env, const char *msg)
{
throwByName(env, "java/io/IOException", msg);
}
void *findFunction(JNIEnv *env, void *hModule, char *functionName) {
void *fAddress = dlsym(hModule, functionName);
if (fAddress == NULL) {
char errorMessage[256];
snprintf(errorMessage, sizeof(errorMessage), "Symbol not found: %s", functionName);
JNU_ThrowNullPointerException(env, errorMessage);
throwNullPointerException(env, errorMessage);
return NULL;
}
return fAddress;
......@@ -69,7 +97,7 @@ JNIEXPORT void JNICALL Java_sun_security_smartcardio_PlatformPCSC_initialize
(*env)->ReleaseStringUTFChars(env, jLibName, libName);
if (hModule == NULL) {
JNU_ThrowIOException(env, dlerror());
throwIOException(env, dlerror());
return;
}
scardEstablishContext = (FPTR_SCardEstablishContext)findFunction(env, hModule, "SCardEstablishContext");
......
......@@ -37,7 +37,7 @@ void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName) {
if (fAddress == NULL) {
char errorMessage[256];
_snprintf(errorMessage, sizeof(errorMessage), "Symbol not found: %s", functionName);
JNU_ThrowNullPointerException(env, errorMessage);
throwNullPointerException(env, errorMessage);
return NULL;
}
return fAddress;
......@@ -78,7 +78,7 @@ JNIEXPORT jlong JNICALL Java_sun_security_pkcs11_Secmod_nssLoadLibrary
NULL
);
dprintf1("-error: %s\n", lpMsgBuf);
JNU_ThrowIOException(env, (char*)lpMsgBuf);
throwIOException(env, (char*)lpMsgBuf);
LocalFree(lpMsgBuf);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册