Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
2872dbe1
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看板
提交
2872dbe1
编写于
12月 13, 2015
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add EVP_PKEY_get0_* functions.
Reviewed-by:
N
Viktor Dukhovni
<
viktor@openssl.org
>
上级
2986ecdc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
72 addition
and
22 deletion
+72
-22
crypto/evp/evp_err.c
crypto/evp/evp_err.c
+5
-5
crypto/evp/p_lib.c
crypto/evp/p_lib.c
+45
-12
doc/crypto/EVP_PKEY_set1_RSA.pod
doc/crypto/EVP_PKEY_set1_RSA.pod
+12
-0
include/openssl/evp.h
include/openssl/evp.h
+10
-5
未找到文件。
crypto/evp/evp_err.c
浏览文件 @
2872dbe1
...
...
@@ -118,11 +118,11 @@ static ERR_STRING_DATA EVP_str_functs[] = {
{
ERR_FUNC
(
EVP_F_EVP_PKEY_ENCRYPT
),
"EVP_PKEY_encrypt"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_ENCRYPT_INIT
),
"EVP_PKEY_encrypt_init"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_ENCRYPT_OLD
),
"EVP_PKEY_encrypt_old"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
1_DH
),
"EVP_PKEY_get1
_DH"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
1_DSA
),
"EVP_PKEY_get1
_DSA"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
1_ECDSA
),
"EVP_PKEY_GET1
_ECDSA"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
1_EC_KEY
),
"EVP_PKEY_get1
_EC_KEY"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
1_RSA
),
"EVP_PKEY_get1
_RSA"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
0_DH
),
"EVP_PKEY_get0
_DH"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
0_DSA
),
"EVP_PKEY_get0
_DSA"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
0_ECDSA
),
"EVP_PKEY_GET0
_ECDSA"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
0_EC_KEY
),
"EVP_PKEY_get0
_EC_KEY"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_GET
0_RSA
),
"EVP_PKEY_get0
_RSA"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_KEYGEN
),
"EVP_PKEY_keygen"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_KEYGEN_INIT
),
"EVP_PKEY_keygen_init"
},
{
ERR_FUNC
(
EVP_F_EVP_PKEY_NEW
),
"EVP_PKEY_new"
},
...
...
crypto/evp/p_lib.c
浏览文件 @
2872dbe1
...
...
@@ -204,6 +204,11 @@ EVP_PKEY *EVP_PKEY_new(void)
return
(
ret
);
}
void
EVP_PKEY_up_ref
(
EVP_PKEY
*
pkey
)
{
CRYPTO_add
(
&
pkey
->
references
,
1
,
CRYPTO_LOCK_EVP_PKEY
);
}
/*
* Setup a public key ASN1 method and ENGINE from a NID or a string. If pkey
* is NULL just return 1 or 0 if the algorithm exists.
...
...
@@ -284,15 +289,22 @@ int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key)
return
ret
;
}
RSA
*
EVP_PKEY_get
1
_RSA
(
EVP_PKEY
*
pkey
)
RSA
*
EVP_PKEY_get
0
_RSA
(
EVP_PKEY
*
pkey
)
{
if
(
pkey
->
type
!=
EVP_PKEY_RSA
)
{
EVPerr
(
EVP_F_EVP_PKEY_GET
1
_RSA
,
EVP_R_EXPECTING_AN_RSA_KEY
);
EVPerr
(
EVP_F_EVP_PKEY_GET
0
_RSA
,
EVP_R_EXPECTING_AN_RSA_KEY
);
return
NULL
;
}
RSA_up_ref
(
pkey
->
pkey
.
rsa
);
return
pkey
->
pkey
.
rsa
;
}
RSA
*
EVP_PKEY_get1_RSA
(
EVP_PKEY
*
pkey
)
{
RSA
*
ret
=
EVP_PKEY_get0_RSA
(
pkey
);
if
(
ret
!=
NULL
)
RSA_up_ref
(
ret
);
return
ret
;
}
#endif
#ifndef OPENSSL_NO_DSA
...
...
@@ -304,15 +316,22 @@ int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key)
return
ret
;
}
DSA
*
EVP_PKEY_get
1
_DSA
(
EVP_PKEY
*
pkey
)
DSA
*
EVP_PKEY_get
0
_DSA
(
EVP_PKEY
*
pkey
)
{
if
(
pkey
->
type
!=
EVP_PKEY_DSA
)
{
EVPerr
(
EVP_F_EVP_PKEY_GET
1
_DSA
,
EVP_R_EXPECTING_A_DSA_KEY
);
EVPerr
(
EVP_F_EVP_PKEY_GET
0
_DSA
,
EVP_R_EXPECTING_A_DSA_KEY
);
return
NULL
;
}
DSA_up_ref
(
pkey
->
pkey
.
dsa
);
return
pkey
->
pkey
.
dsa
;
}
DSA
*
EVP_PKEY_get1_DSA
(
EVP_PKEY
*
pkey
)
{
DSA
*
ret
=
EVP_PKEY_get0_DSA
(
pkey
);
if
(
ret
!=
NULL
)
DSA_up_ref
(
ret
);
return
ret
;
}
#endif
#ifndef OPENSSL_NO_EC
...
...
@@ -325,15 +344,22 @@ int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key)
return
ret
;
}
EC_KEY
*
EVP_PKEY_get
1
_EC_KEY
(
EVP_PKEY
*
pkey
)
EC_KEY
*
EVP_PKEY_get
0
_EC_KEY
(
EVP_PKEY
*
pkey
)
{
if
(
pkey
->
type
!=
EVP_PKEY_EC
)
{
EVPerr
(
EVP_F_EVP_PKEY_GET
1
_EC_KEY
,
EVP_R_EXPECTING_A_EC_KEY
);
EVPerr
(
EVP_F_EVP_PKEY_GET
0
_EC_KEY
,
EVP_R_EXPECTING_A_EC_KEY
);
return
NULL
;
}
EC_KEY_up_ref
(
pkey
->
pkey
.
ec
);
return
pkey
->
pkey
.
ec
;
}
EC_KEY
*
EVP_PKEY_get1_EC_KEY
(
EVP_PKEY
*
pkey
)
{
EC_KEY
*
ret
=
EVP_PKEY_get0_EC_KEY
(
pkey
);
if
(
ret
!=
NULL
)
EC_KEY_up_ref
(
ret
);
return
ret
;
}
#endif
#ifndef OPENSSL_NO_DH
...
...
@@ -346,15 +372,22 @@ int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key)
return
ret
;
}
DH
*
EVP_PKEY_get
1
_DH
(
EVP_PKEY
*
pkey
)
DH
*
EVP_PKEY_get
0
_DH
(
EVP_PKEY
*
pkey
)
{
if
(
pkey
->
type
!=
EVP_PKEY_DH
&&
pkey
->
type
!=
EVP_PKEY_DHX
)
{
EVPerr
(
EVP_F_EVP_PKEY_GET
1
_DH
,
EVP_R_EXPECTING_A_DH_KEY
);
EVPerr
(
EVP_F_EVP_PKEY_GET
0
_DH
,
EVP_R_EXPECTING_A_DH_KEY
);
return
NULL
;
}
DH_up_ref
(
pkey
->
pkey
.
dh
);
return
pkey
->
pkey
.
dh
;
}
DH
*
EVP_PKEY_get1_DH
(
EVP_PKEY
*
pkey
)
{
DH
*
ret
=
EVP_PKEY_get0_DH
(
pkey
);
if
(
ret
!=
NULL
)
DH_up_ref
(
ret
);
return
ret
;
}
#endif
int
EVP_PKEY_type
(
int
type
)
...
...
doc/crypto/EVP_PKEY_set1_RSA.pod
浏览文件 @
2872dbe1
...
...
@@ -4,6 +4,7 @@
EVP_PKEY_set1_RSA, EVP_PKEY_set1_DSA, EVP_PKEY_set1_DH, EVP_PKEY_set1_EC_KEY,
EVP_PKEY_get1_RSA, EVP_PKEY_get1_DSA, EVP_PKEY_get1_DH, EVP_PKEY_get1_EC_KEY,
EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, EVP_PKEY_get0_DH, EVP_PKEY_get0_EC_KEY,
EVP_PKEY_assign_RSA, EVP_PKEY_assign_DSA, EVP_PKEY_assign_DH, EVP_PKEY_assign_EC_KEY,
EVP_PKEY_type - EVP_PKEY assignment functions.
...
...
@@ -21,6 +22,11 @@ EVP_PKEY_type - EVP_PKEY assignment functions.
DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
DSA *EVP_PKEY_get0_DSA(EVP_PKEY *pkey);
DH *EVP_PKEY_get0_DH(EVP_PKEY *pkey);
EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
int EVP_PKEY_assign_RSA(EVP_PKEY *pkey,RSA *key);
int EVP_PKEY_assign_DSA(EVP_PKEY *pkey,DSA *key);
int EVP_PKEY_assign_DH(EVP_PKEY *pkey,DH *key);
...
...
@@ -37,6 +43,12 @@ EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and
EVP_PKEY_get1_EC_KEY() return the referenced key in B<pkey> or
B<NULL> if the key is not of the correct type.
EVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH() and
EVP_PKEY_get0_EC_KEY() also return the referenced key in B<pkey> or
B<NULL> if the key is not of the correct type but the reference
count of the returned key is B<not> incremented and so must not
be freed up after use.
EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH()
and EVP_PKEY_assign_EC_KEY() also set the referenced key to B<key>
however these use the supplied B<key> internally and so B<key>
...
...
include/openssl/evp.h
浏览文件 @
2872dbe1
...
...
@@ -966,25 +966,30 @@ void *EVP_PKEY_get0(EVP_PKEY *pkey);
# ifndef OPENSSL_NO_RSA
struct
rsa_st
;
int
EVP_PKEY_set1_RSA
(
EVP_PKEY
*
pkey
,
struct
rsa_st
*
key
);
struct
rsa_st
*
EVP_PKEY_get0_RSA
(
EVP_PKEY
*
pkey
);
struct
rsa_st
*
EVP_PKEY_get1_RSA
(
EVP_PKEY
*
pkey
);
# endif
# ifndef OPENSSL_NO_DSA
struct
dsa_st
;
int
EVP_PKEY_set1_DSA
(
EVP_PKEY
*
pkey
,
struct
dsa_st
*
key
);
struct
dsa_st
*
EVP_PKEY_get0_DSA
(
EVP_PKEY
*
pkey
);
struct
dsa_st
*
EVP_PKEY_get1_DSA
(
EVP_PKEY
*
pkey
);
# endif
# ifndef OPENSSL_NO_DH
struct
dh_st
;
int
EVP_PKEY_set1_DH
(
EVP_PKEY
*
pkey
,
struct
dh_st
*
key
);
struct
dh_st
*
EVP_PKEY_get0_DH
(
EVP_PKEY
*
pkey
);
struct
dh_st
*
EVP_PKEY_get1_DH
(
EVP_PKEY
*
pkey
);
# endif
# ifndef OPENSSL_NO_EC
struct
ec_key_st
;
int
EVP_PKEY_set1_EC_KEY
(
EVP_PKEY
*
pkey
,
struct
ec_key_st
*
key
);
struct
ec_key_st
*
EVP_PKEY_get0_EC_KEY
(
EVP_PKEY
*
pkey
);
struct
ec_key_st
*
EVP_PKEY_get1_EC_KEY
(
EVP_PKEY
*
pkey
);
# endif
EVP_PKEY
*
EVP_PKEY_new
(
void
);
void
EVP_PKEY_up_ref
(
EVP_PKEY
*
pkey
);
void
EVP_PKEY_free
(
EVP_PKEY
*
pkey
);
EVP_PKEY
*
d2i_PublicKey
(
int
type
,
EVP_PKEY
**
a
,
const
unsigned
char
**
pp
,
...
...
@@ -1543,11 +1548,11 @@ void ERR_load_EVP_strings(void);
# define EVP_F_EVP_PKEY_ENCRYPT 105
# define EVP_F_EVP_PKEY_ENCRYPT_INIT 139
# define EVP_F_EVP_PKEY_ENCRYPT_OLD 152
# define EVP_F_EVP_PKEY_GET
1
_DH 119
# define EVP_F_EVP_PKEY_GET
1
_DSA 120
# define EVP_F_EVP_PKEY_GET
1
_ECDSA 130
# define EVP_F_EVP_PKEY_GET
1
_EC_KEY 131
# define EVP_F_EVP_PKEY_GET
1
_RSA 121
# define EVP_F_EVP_PKEY_GET
0
_DH 119
# define EVP_F_EVP_PKEY_GET
0
_DSA 120
# define EVP_F_EVP_PKEY_GET
0
_ECDSA 130
# define EVP_F_EVP_PKEY_GET
0
_EC_KEY 131
# define EVP_F_EVP_PKEY_GET
0
_RSA 121
# define EVP_F_EVP_PKEY_KEYGEN 146
# define EVP_F_EVP_PKEY_KEYGEN_INIT 147
# define EVP_F_EVP_PKEY_NEW 106
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录