Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
1c8d9299
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
9 个月 前同步成功
通知
8
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看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1c8d9299
编写于
3月 11, 2010
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ctrl operations to retrieve RSA algorithm settings
上级
bf8883b3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
49 addition
and
5 deletion
+49
-5
crypto/rsa/rsa.h
crypto/rsa/rsa.h
+20
-1
crypto/rsa/rsa_err.c
crypto/rsa/rsa_err.c
+1
-0
crypto/rsa/rsa_pmeth.c
crypto/rsa/rsa_pmeth.c
+28
-4
未找到文件。
crypto/rsa/rsa.h
浏览文件 @
1c8d9299
...
...
@@ -222,12 +222,22 @@ struct rsa_st
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, EVP_PKEY_CTRL_RSA_PADDING, \
pad, NULL)
#define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, \
EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad)
#define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
(EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \
EVP_PKEY_CTRL_RSA_PSS_SALTLEN, \
len, NULL)
#define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
(EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \
EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, \
0, plen)
#define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \
EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL)
...
...
@@ -237,9 +247,13 @@ struct rsa_st
EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp)
#define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \
EVP_PKEY_CTX_ctrl(ctx,
-1
, EVP_PKEY_OP_TYPE_SIG, \
EVP_PKEY_CTX_ctrl(ctx,
EVP_PKEY_RSA
, EVP_PKEY_OP_TYPE_SIG, \
EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)md)
#define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_SIG, \
EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)pmd)
#define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1)
#define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2)
...
...
@@ -247,6 +261,10 @@ struct rsa_st
#define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4)
#define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5)
#define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6)
#define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7)
#define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8)
#define RSA_PKCS1_PADDING 1
#define RSA_SSLV23_PADDING 2
#define RSA_NO_PADDING 3
...
...
@@ -486,6 +504,7 @@ void ERR_load_RSA_strings(void);
#define RSA_R_INVALID_HEADER 137
#define RSA_R_INVALID_KEYBITS 145
#define RSA_R_INVALID_MESSAGE_LENGTH 131
#define RSA_R_INVALID_MGF1_MD 156
#define RSA_R_INVALID_PADDING 138
#define RSA_R_INVALID_PADDING_MODE 141
#define RSA_R_INVALID_PSS_PARAMETERS 149
...
...
crypto/rsa/rsa_err.c
浏览文件 @
1c8d9299
...
...
@@ -147,6 +147,7 @@ static ERR_STRING_DATA RSA_str_reasons[]=
{
ERR_REASON
(
RSA_R_INVALID_HEADER
)
,
"invalid header"
},
{
ERR_REASON
(
RSA_R_INVALID_KEYBITS
)
,
"invalid keybits"
},
{
ERR_REASON
(
RSA_R_INVALID_MESSAGE_LENGTH
),
"invalid message length"
},
{
ERR_REASON
(
RSA_R_INVALID_MGF1_MD
)
,
"invalid mgf1 md"
},
{
ERR_REASON
(
RSA_R_INVALID_PADDING
)
,
"invalid padding"
},
{
ERR_REASON
(
RSA_R_INVALID_PADDING_MODE
)
,
"invalid padding mode"
},
{
ERR_REASON
(
RSA_R_INVALID_PSS_PARAMETERS
),
"invalid pss parameters"
},
...
...
crypto/rsa/rsa_pmeth.c
浏览文件 @
1c8d9299
...
...
@@ -407,15 +407,25 @@ static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE
);
return
-
2
;
case
EVP_PKEY_CTRL_GET_RSA_PADDING
:
*
(
int
*
)
p2
=
rctx
->
pad_mode
;
return
1
;
case
EVP_PKEY_CTRL_RSA_PSS_SALTLEN
:
if
(
p1
<
-
2
)
return
-
2
;
case
EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN
:
if
(
rctx
->
pad_mode
!=
RSA_PKCS1_PSS_PADDING
)
{
RSAerr
(
RSA_F_PKEY_RSA_CTRL
,
RSA_R_INVALID_PSS_SALTLEN
);
return
-
2
;
}
rctx
->
saltlen
=
p1
;
if
(
type
==
EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN
)
*
(
int
*
)
p2
=
rctx
->
saltlen
;
else
{
if
(
p1
<
-
2
)
return
-
2
;
rctx
->
saltlen
=
p1
;
}
return
1
;
case
EVP_PKEY_CTRL_RSA_KEYGEN_BITS
:
...
...
@@ -440,7 +450,21 @@ static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
return
1
;
case
EVP_PKEY_CTRL_RSA_MGF1_MD
:
rctx
->
mgf1md
=
p2
;
case
EVP_PKEY_CTRL_GET_RSA_MGF1_MD
:
if
(
rctx
->
pad_mode
!=
RSA_PKCS1_PSS_PADDING
)
{
RSAerr
(
RSA_F_PKEY_RSA_CTRL
,
RSA_R_INVALID_MGF1_MD
);
return
-
2
;
}
if
(
type
==
EVP_PKEY_CTRL_GET_RSA_MGF1_MD
)
{
if
(
rctx
->
mgf1md
)
*
(
const
EVP_MD
**
)
p2
=
rctx
->
mgf1md
;
else
*
(
const
EVP_MD
**
)
p2
=
rctx
->
md
;
}
else
rctx
->
mgf1md
=
p2
;
return
1
;
case
EVP_PKEY_CTRL_DIGESTINIT
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录