Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
63b825c9
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看板
提交
63b825c9
编写于
3月 07, 2010
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add separate PSS decode function, rename PSS parameters to RSA_PSS_PARAMS
上级
77f4b6ba
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
63 addition
and
32 deletion
+63
-32
crypto/rsa/rsa.h
crypto/rsa/rsa.h
+4
-3
crypto/rsa/rsa_ameth.c
crypto/rsa/rsa_ameth.c
+52
-22
crypto/rsa/rsa_asn1.c
crypto/rsa/rsa_asn1.c
+7
-7
未找到文件。
crypto/rsa/rsa.h
浏览文件 @
63b825c9
...
...
@@ -241,6 +241,7 @@ struct rsa_st
#define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3)
#define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4)
#define EVP_PKEY_CTRL_MGF1_MD (EVP_PKEY_ALG_CTRL + 5)
#define RSA_PKCS1_PADDING 1
#define RSA_SSLV23_PADDING 2
...
...
@@ -300,15 +301,15 @@ const RSA_METHOD *RSA_null_method(void);
DECLARE_ASN1_ENCODE_FUNCTIONS_const
(
RSA
,
RSAPublicKey
)
DECLARE_ASN1_ENCODE_FUNCTIONS_const
(
RSA
,
RSAPrivateKey
)
typedef
struct
rsa
ssaPssP
arams_st
typedef
struct
rsa
_pss_p
arams_st
{
X509_ALGOR
*
hashAlgorithm
;
X509_ALGOR
*
maskGenAlgorithm
;
ASN1_INTEGER
*
saltLength
;
ASN1_INTEGER
*
trailerField
;
}
RSA
SSA
_PSS_PARAMS
;
}
RSA_PSS_PARAMS
;
DECLARE_ASN1_FUNCTIONS
(
RSA
SSA
_PSS_PARAMS
)
DECLARE_ASN1_FUNCTIONS
(
RSA_PSS_PARAMS
)
#ifndef OPENSSL_NO_FP_API
int
RSA_print_fp
(
FILE
*
fp
,
const
RSA
*
r
,
int
offset
);
...
...
crypto/rsa/rsa_ameth.c
浏览文件 @
63b825c9
...
...
@@ -265,14 +265,48 @@ static int rsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
return
do_rsa_print
(
bp
,
pkey
->
pkey
.
rsa
,
indent
,
1
);
}
static
int
rsa_pss_param_print
(
BIO
*
bp
,
RSASSA_PSS_PARAMS
*
pss
,
int
indent
)
static
RSA_PSS_PARAMS
*
rsa_pss_decode
(
const
X509_ALGOR
*
alg
,
X509_ALGOR
**
pmaskHash
)
{
const
unsigned
char
*
p
;
int
plen
;
RSA_PSS_PARAMS
*
pss
;
*
pmaskHash
=
NULL
;
if
(
!
alg
->
parameter
||
alg
->
parameter
->
type
!=
V_ASN1_SEQUENCE
)
return
NULL
;
p
=
alg
->
parameter
->
value
.
sequence
->
data
;
plen
=
alg
->
parameter
->
value
.
sequence
->
length
;
pss
=
d2i_RSA_PSS_PARAMS
(
NULL
,
&
p
,
plen
);
if
(
!
pss
)
return
NULL
;
if
(
pss
->
maskGenAlgorithm
)
{
ASN1_TYPE
*
param
=
pss
->
maskGenAlgorithm
->
parameter
;
if
(
OBJ_obj2nid
(
pss
->
maskGenAlgorithm
->
algorithm
)
==
NID_mgf1
&&
param
->
type
==
V_ASN1_SEQUENCE
)
{
p
=
param
->
value
.
sequence
->
data
;
plen
=
param
->
value
.
sequence
->
length
;
*
pmaskHash
=
d2i_X509_ALGOR
(
NULL
,
&
p
,
plen
);
}
}
return
pss
;
}
static
int
rsa_pss_param_print
(
BIO
*
bp
,
RSA_PSS_PARAMS
*
pss
,
X509_ALGOR
*
maskHash
,
int
indent
)
{
int
rv
=
0
;
X509_ALGOR
*
maskHash
=
NULL
;
if
(
!
pss
)
{
if
(
BIO_puts
(
bp
,
" (INVALID PSS PARAMETERS)
\n
"
)
<=
0
)
return
0
;
return
1
;
}
if
(
BIO_puts
(
bp
,
"
\n
"
)
<=
0
)
goto
err
;
...
...
@@ -299,18 +333,16 @@ static int rsa_pss_param_print(BIO *bp, RSASSA_PSS_PARAMS *pss, int indent)
goto
err
;
if
(
pss
->
maskGenAlgorithm
)
{
ASN1_TYPE
*
param
=
pss
->
maskGenAlgorithm
->
parameter
;
if
(
param
->
type
==
V_ASN1_SEQUENCE
)
{
const
unsigned
char
*
p
=
param
->
value
.
sequence
->
data
;
int
plen
=
param
->
value
.
sequence
->
length
;
maskHash
=
d2i_X509_ALGOR
(
NULL
,
&
p
,
plen
);
}
if
(
i2a_ASN1_OBJECT
(
bp
,
pss
->
maskGenAlgorithm
->
algorithm
)
<=
0
)
goto
err
;
if
(
BIO_puts
(
bp
,
" with "
)
<=
0
)
goto
err
;
if
(
i2a_ASN1_OBJECT
(
bp
,
maskHash
->
algorithm
)
<=
0
)
if
(
maskHash
)
{
if
(
i2a_ASN1_OBJECT
(
bp
,
maskHash
->
algorithm
)
<=
0
)
goto
err
;
}
else
if
(
BIO_puts
(
bp
,
"INVALID"
)
<=
0
)
goto
err
;
}
else
if
(
BIO_puts
(
bp
,
"mgf1 with sha1 (default)"
)
<=
0
)
...
...
@@ -346,9 +378,6 @@ static int rsa_pss_param_print(BIO *bp, RSASSA_PSS_PARAMS *pss, int indent)
rv
=
1
;
err:
if
(
maskHash
)
X509_ALGOR_free
(
maskHash
);
RSASSA_PSS_PARAMS_free
(
pss
);
return
rv
;
}
...
...
@@ -359,15 +388,16 @@ static int rsa_sig_print(BIO *bp, const X509_ALGOR *sigalg,
{
if
(
OBJ_obj2nid
(
sigalg
->
algorithm
)
==
NID_rsassaPss
)
{
RSASSA_PSS_PARAMS
*
pss
=
NULL
;
ASN1_TYPE
*
param
=
sigalg
->
parameter
;
if
(
param
&&
param
->
type
==
V_ASN1_SEQUENCE
)
{
const
unsigned
char
*
p
=
param
->
value
.
sequence
->
data
;
int
plen
=
param
->
value
.
sequence
->
length
;
pss
=
d2i_RSASSA_PSS_PARAMS
(
NULL
,
&
p
,
plen
);
}
if
(
!
rsa_pss_param_print
(
bp
,
pss
,
indent
))
int
rv
;
RSA_PSS_PARAMS
*
pss
;
X509_ALGOR
*
maskHash
;
pss
=
rsa_pss_decode
(
sigalg
,
&
maskHash
);
rv
=
rsa_pss_param_print
(
bp
,
pss
,
maskHash
,
indent
);
if
(
pss
)
RSA_PSS_PARAMS_free
(
pss
);
if
(
maskHash
)
X509_ALGOR_free
(
maskHash
);
if
(
!
rv
)
return
0
;
}
...
...
crypto/rsa/rsa_asn1.c
浏览文件 @
63b825c9
...
...
@@ -97,14 +97,14 @@ ASN1_SEQUENCE_cb(RSAPublicKey, rsa_cb) = {
ASN1_SIMPLE
(
RSA
,
e
,
BIGNUM
),
}
ASN1_SEQUENCE_END_cb
(
RSA
,
RSAPublicKey
)
ASN1_SEQUENCE
(
RSA
SSA
_PSS_PARAMS
)
=
{
ASN1_EXP_OPT
(
RSA
SSA
_PSS_PARAMS
,
hashAlgorithm
,
X509_ALGOR
,
0
),
ASN1_EXP_OPT
(
RSA
SSA
_PSS_PARAMS
,
maskGenAlgorithm
,
X509_ALGOR
,
1
),
ASN1_EXP_OPT
(
RSA
SSA
_PSS_PARAMS
,
saltLength
,
ASN1_INTEGER
,
2
),
ASN1_EXP_OPT
(
RSA
SSA
_PSS_PARAMS
,
trailerField
,
ASN1_INTEGER
,
3
)
}
ASN1_SEQUENCE_END
(
RSA
SSA
_PSS_PARAMS
)
ASN1_SEQUENCE
(
RSA_PSS_PARAMS
)
=
{
ASN1_EXP_OPT
(
RSA_PSS_PARAMS
,
hashAlgorithm
,
X509_ALGOR
,
0
),
ASN1_EXP_OPT
(
RSA_PSS_PARAMS
,
maskGenAlgorithm
,
X509_ALGOR
,
1
),
ASN1_EXP_OPT
(
RSA_PSS_PARAMS
,
saltLength
,
ASN1_INTEGER
,
2
),
ASN1_EXP_OPT
(
RSA_PSS_PARAMS
,
trailerField
,
ASN1_INTEGER
,
3
)
}
ASN1_SEQUENCE_END
(
RSA_PSS_PARAMS
)
IMPLEMENT_ASN1_FUNCTIONS
(
RSA
SSA
_PSS_PARAMS
)
IMPLEMENT_ASN1_FUNCTIONS
(
RSA_PSS_PARAMS
)
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname
(
RSA
,
RSAPrivateKey
,
RSAPrivateKey
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录