Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
9716a8f9
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
10
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
“f822c411b26ce0353c8b97877e53a12e4f895ca1”上不存在“README.md”
提交
9716a8f9
编写于
25年前
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix to PKCS#7 routines so it can decrypt some oddball RC2 handling.
上级
74400f73
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
11 deletion
+34
-11
CHANGES
CHANGES
+12
-0
crypto/pkcs7/pk7_doit.c
crypto/pkcs7/pk7_doit.c
+22
-11
未找到文件。
CHANGES
浏览文件 @
9716a8f9
...
...
@@ -4,6 +4,18 @@
Changes between 0.9.4 and 0.9.5 [xx XXX 1999]
*) Hack to fix PKCS#7 decryption when used with some unorthodox RC2
handling. Most clients have the effective key size in bits equal to
the key length in bits: so a 40 bit RC2 key uses a 40 bit (5 byte) key.
A few however don't do this and instead use the size of the decrypted key
to determine the RC2 key length and the AlgorithmIdentifier to determine
the effective key length. In this case the effective key lenth can still
be 40 bits but the key length can be 168 bits for example. This is fixed
by manually forcing an RC2 key into the EVP_PKEY structure because the
EVP code can't currently handle unusual RC2 key sizes: it always assumes
the key length and effective key length are equal.
[Steve Henson]
*) Add a bunch of functions that should simplify the creation of
X509_NAME structures. Now you should be able to do:
X509_NAME_add_entry_by_txt(nm, "CN", MBSTRING_ASC, "Steve", -1, -1, 0);
...
...
This diff is collapsed.
Click to expand it.
crypto/pkcs7/pk7_doit.c
浏览文件 @
9716a8f9
...
...
@@ -251,7 +251,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
{
int
i
,
j
;
BIO
*
out
=
NULL
,
*
btmp
=
NULL
,
*
etmp
=
NULL
,
*
bio
=
NULL
;
char
*
tmp
=
NULL
;
unsigned
char
*
tmp
=
NULL
;
X509_ALGOR
*
xa
;
ASN1_OCTET_STRING
*
data_body
=
NULL
;
const
EVP_MD
*
evp_md
;
...
...
@@ -262,6 +262,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
STACK_OF
(
PKCS7_RECIP_INFO
)
*
rsk
=
NULL
;
X509_ALGOR
*
xalg
=
NULL
;
PKCS7_RECIP_INFO
*
ri
=
NULL
;
char
is_rc2
=
0
;
/* EVP_PKEY *pkey; */
#if 0
X509_STORE_CTX s_ctx;
...
...
@@ -306,6 +307,8 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
goto
err
;
}
if
(
EVP_CIPHER_nid
(
evp_cipher
)
==
NID_rc2_cbc
)
is_rc2
=
1
;
/* We will be checking the signature */
if
(
md_sk
!=
NULL
)
{
...
...
@@ -375,17 +378,15 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
}
jj
=
EVP_PKEY_size
(
pkey
);
tmp
=
Malloc
(
jj
+
10
);
tmp
=
(
unsigned
char
*
)
Malloc
(
jj
+
10
);
if
(
tmp
==
NULL
)
{
PKCS7err
(
PKCS7_F_PKCS7_DATADECODE
,
ERR_R_MALLOC_FAILURE
);
goto
err
;
}
jj
=
EVP_PKEY_decrypt
((
unsigned
char
*
)
tmp
,
M_ASN1_STRING_data
(
ri
->
enc_key
),
M_ASN1_STRING_length
(
ri
->
enc_key
),
pkey
);
jj
=
EVP_PKEY_decrypt
(
tmp
,
M_ASN1_STRING_data
(
ri
->
enc_key
),
M_ASN1_STRING_length
(
ri
->
enc_key
),
pkey
);
if
(
jj
<=
0
)
{
PKCS7err
(
PKCS7_F_PKCS7_DATADECODE
,
ERR_R_EVP_LIB
);
...
...
@@ -398,13 +399,23 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
if
(
EVP_CIPHER_asn1_to_param
(
evp_ctx
,
enc_alg
->
parameter
)
<
0
)
return
(
NULL
);
if
(
jj
!=
EVP_CIPHER_CTX_key_length
(
evp_ctx
))
{
PKCS7err
(
PKCS7_F_PKCS7_DATADECODE
,
if
(
jj
!=
EVP_CIPHER_CTX_key_length
(
evp_ctx
))
{
/* HACK: some S/MIME clients don't use the same key
* and effective key length. The key length is
* determined by the size of the decrypted RSA key.
* So we hack things to manually set the RC2 key
* because we currently can't do this with the EVP
* interface.
*/
if
(
is_rc2
)
RC2_set_key
(
&
(
evp_ctx
->
c
.
rc2_ks
),
jj
,
tmp
,
EVP_CIPHER_CTX_key_length
(
evp_ctx
)
*
8
);
else
{
PKCS7err
(
PKCS7_F_PKCS7_DATADECODE
,
PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH
);
goto
err
;
goto
err
;
}
EVP_CipherInit
(
evp_ctx
,
NULL
,(
unsigned
char
*
)
tmp
,
NULL
,
0
);
}
else
EVP_CipherInit
(
evp_ctx
,
NULL
,
tmp
,
NULL
,
0
);
memset
(
tmp
,
0
,
jj
);
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部