Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c119da7a
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c119da7a
编写于
7月 23, 2018
作者:
I
igerasim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8206295: More reliable p11 transactions
Reviewed-by: valeriep, mschoene, rhalade
上级
e22562ff
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
16 deletion
+34
-16
src/windows/native/sun/security/pkcs11/wrapper/p11_md.c
src/windows/native/sun/security/pkcs11/wrapper/p11_md.c
+34
-16
未找到文件。
src/windows/native/sun/security/pkcs11/wrapper/p11_md.c
浏览文件 @
c119da7a
/*
* Copyright (c) 2003, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
18
, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
...
...
@@ -75,18 +75,20 @@
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT
void
JNICALL
Java_sun_security_pkcs11_wrapper_PKCS11_connect
(
JNIEnv
*
env
,
jobject
obj
,
jstring
jPkcs11ModulePath
,
jstring
jGetFunctionList
)
(
JNIEnv
*
env
,
jobject
obj
,
jstring
jPkcs11ModulePath
,
jstring
jGetFunctionList
)
{
HINSTANCE
hModule
;
CK_C_GetFunctionList
C_GetFunctionList
;
CK_RV
rv
;
CK_RV
rv
=
CK_ASSERT_OK
;
ModuleData
*
moduleData
;
jobject
globalPKCS11ImplementationReference
;
LPVOID
lpMsgBuf
;
char
*
exceptionMessage
;
LPVOID
lpMsgBuf
=
NULL
;
char
*
exceptionMessage
=
NULL
;
const
char
*
getFunctionListStr
;
const
char
*
libraryNameStr
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jPkcs11ModulePath
,
0
);
const
char
*
libraryNameStr
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jPkcs11ModulePath
,
0
);
TRACE1
(
"DEBUG: connect to PKCS#11 module: %s ... "
,
libraryNameStr
);
...
...
@@ -106,21 +108,24 @@ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_connect
0
,
NULL
);
exceptionMessage
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
strlen
((
LPTSTR
)
lpMsgBuf
)
+
strlen
(
libraryNameStr
)
+
1
));
exceptionMessage
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
strlen
((
LPTSTR
)
lpMsgBuf
)
+
strlen
(
libraryNameStr
)
+
1
));
if
(
exceptionMessage
==
NULL
)
{
throwOutOfMemoryError
(
env
,
0
);
goto
cleanup
;
}
strcpy
(
exceptionMessage
,
(
LPTSTR
)
lpMsgBuf
);
strcat
(
exceptionMessage
,
libraryNameStr
);
throwIOException
(
env
,
(
LPTSTR
)
exceptionMessage
);
/* Free the buffer. */
free
(
exceptionMessage
);
LocalFree
(
lpMsgBuf
);
return
;
goto
cleanup
;
}
/*
* Get function pointer to C_GetFunctionList
*/
getFunctionListStr
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jGetFunctionList
,
0
);
C_GetFunctionList
=
(
CK_C_GetFunctionList
)
GetProcAddress
(
hModule
,
getFunctionListStr
);
C_GetFunctionList
=
(
CK_C_GetFunctionList
)
GetProcAddress
(
hModule
,
getFunctionListStr
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jGetFunctionList
,
getFunctionListStr
);
if
(
C_GetFunctionList
==
NULL
)
{
FormatMessage
(
...
...
@@ -135,24 +140,37 @@ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_connect
NULL
);
throwIOException
(
env
,
(
LPTSTR
)
lpMsgBuf
);
/* Free the buffer. */
LocalFree
(
lpMsgBuf
);
return
;
goto
cleanup
;
}
/*
* Get function pointers to all PKCS #11 functions
*/
moduleData
=
(
ModuleData
*
)
malloc
(
sizeof
(
ModuleData
));
if
(
moduleData
==
NULL
)
{
throwOutOfMemoryError
(
env
,
0
);
goto
cleanup
;
}
moduleData
->
hModule
=
hModule
;
moduleData
->
applicationMutexHandler
=
NULL
;
rv
=
(
C_GetFunctionList
)(
&
(
moduleData
->
ckFunctionListPtr
));
globalPKCS11ImplementationReference
=
(
*
env
)
->
NewGlobalRef
(
env
,
obj
);
putModuleEntry
(
env
,
globalPKCS11ImplementationReference
,
moduleData
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jPkcs11ModulePath
,
libraryNameStr
);
TRACE0
(
"FINISHED
\n
"
);
cleanup:
/* Free up allocated buffers we no longer need */
if
(
lpMsgBuf
!=
NULL
)
{
LocalFree
(
lpMsgBuf
);
}
if
(
libraryNameStr
!=
NULL
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jPkcs11ModulePath
,
libraryNameStr
);
}
if
(
exceptionMessage
!=
NULL
)
{
free
(
exceptionMessage
);
}
if
(
ckAssertReturnValueOK
(
env
,
rv
)
!=
CK_ASSERT_OK
)
{
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录