Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
7ef82068
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看板
提交
7ef82068
编写于
24年前
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Handle ASN1_SET_OF and PKCS12_STACK_OF using function casts in the same way as STACK_OF.
上级
438fa2fd
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
382 addition
and
83 deletion
+382
-83
CHANGES
CHANGES
+2
-2
crypto/asn1/asn1.h
crypto/asn1/asn1.h
+2
-43
crypto/cryptlib.c
crypto/cryptlib.c
+3
-3
crypto/pkcs12/p12_kiss.c
crypto/pkcs12/p12_kiss.c
+6
-6
crypto/pkcs12/pkcs12.h
crypto/pkcs12/pkcs12.h
+9
-9
crypto/stack/safestack.h
crypto/stack/safestack.h
+333
-0
crypto/x509/x509.h
crypto/x509/x509.h
+2
-20
util/mkstack.pl
util/mkstack.pl
+25
-0
未找到文件。
CHANGES
浏览文件 @
7ef82068
...
...
@@ -13,8 +13,8 @@
then the non typesafe macros are used instead. Also modified the
mkstack.pl script to handle the new form. Needs testing to see
if which (if any) compilers it chokes and maybe make DEBUG_SAFESTACK
the default if no major problems.
Also need analagous stuff for
ASN1_SET_OF etc
.
the default if no major problems.
Similar behaviour for ASN1_SET_OF
and PKCS12_STACK_OF
.
[Steve Henson]
*) When some versions of IIS use the 'NET' form of private key the
...
...
This diff is collapsed.
Click to expand it.
crypto/asn1/asn1.h
浏览文件 @
7ef82068
...
...
@@ -145,49 +145,8 @@ extern "C" {
struct
X509_algor_st
;
#define DECLARE_ASN1_SET_OF(type) \
int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
int (*func)(type *,unsigned char **), int ex_tag, \
int ex_class, int is_set); \
STACK_OF(type) *d2i_ASN1_SET_OF_##type(STACK_OF(type) **a,unsigned char **pp, \
long length, \
type *(*func)(type **, \
unsigned char **,long), \
void (*free_func)(type *), \
int ex_tag,int ex_class); \
unsigned char *ASN1_seq_pack_##type(STACK_OF(type) *st, \
int (*i2d)(type *,unsigned char **), \
unsigned char **buf,int *len); \
STACK_OF(type) *ASN1_seq_unpack_##type(unsigned char *buf,int len, \
type *(*d2i)(type **,unsigned char **, \
long), \
void (*free_func)(type *));
#define IMPLEMENT_ASN1_SET_OF(type) \
int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
int (*func)(type *,unsigned char **), int ex_tag, \
int ex_class, int is_set) \
{ return i2d_ASN1_SET((STACK *)a,pp,func,ex_tag,ex_class,is_set); } \
STACK_OF(type) *d2i_ASN1_SET_OF_##type(STACK_OF(type) **a,unsigned char **pp, \
long length, \
type *(*func)(type **, \
unsigned char **,long), \
void (*free_func)(type *), \
int ex_tag,int ex_class) \
{ return (STACK_OF(type) *)d2i_ASN1_SET((STACK **)a,pp,length, \
(char *(*)())func, \
(void (*)())free_func, \
ex_tag,ex_class); } \
unsigned char *ASN1_seq_pack_##type(STACK_OF(type) *st, \
int (*i2d)(type *,unsigned char **), \
unsigned char **buf,int *len) \
{ return ASN1_seq_pack((STACK *)st,i2d,buf,len); } \
STACK_OF(type) *ASN1_seq_unpack_##type(unsigned char *buf,int len, \
type *(*d2i)(type **,unsigned char **, \
long), \
void (*free_func)(type *)) \
{ return (STACK_OF(type) *)ASN1_seq_unpack(buf,len,(char *(*)())d2i, \
(void(*)(void *))free_func); }
#define DECLARE_ASN1_SET_OF(type)
/* filled in by mkstack.pl */
#define IMPLEMENT_ASN1_SET_OF(type)
/* nothing, no longer needed */
typedef
struct
asn1_ctx_st
{
...
...
This diff is collapsed.
Click to expand it.
crypto/cryptlib.c
浏览文件 @
7ef82068
...
...
@@ -66,8 +66,8 @@
static
double
SSLeay_MSVC5_hack
=
0
.
0
;
/* and for VC1.5 */
#endif
DECLARE_STACK_OF
(
CRYPTO_dynlock
)
;
IMPLEMENT_STACK_OF
(
CRYPTO_dynlock
)
;
DECLARE_STACK_OF
(
CRYPTO_dynlock
)
IMPLEMENT_STACK_OF
(
CRYPTO_dynlock
)
/* real #defines in crypto.h, keep these upto date */
static
const
char
*
lock_names
[
CRYPTO_NUM_LOCKS
]
=
...
...
@@ -175,7 +175,7 @@ int CRYPTO_get_new_dynlockid(void)
}
CRYPTO_w_lock
(
CRYPTO_LOCK_DYNLOCK
);
if
((
dyn_locks
==
NULL
)
&&
((
dyn_locks
=
sk_new_null
())
==
NULL
))
&&
((
dyn_locks
=
sk_
CRYPTO_dynlock_
new_null
())
==
NULL
))
{
CRYPTO_w_unlock
(
CRYPTO_LOCK_DYNLOCK
);
CRYPTOerr
(
CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID
,
ERR_R_MALLOC_FAILURE
);
...
...
This diff is collapsed.
Click to expand it.
crypto/pkcs12/p12_kiss.c
浏览文件 @
7ef82068
...
...
@@ -135,9 +135,9 @@ int PKCS12_parse (PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
err:
if
(
pkey
&&
*
pkey
)
EVP_PKEY_free
(
*
pkey
);
if
(
cert
&&
*
cert
)
X509_free
(
*
cert
);
if
(
ca
)
sk_X509_pop_free
(
*
ca
,
X509_free
);
if
(
pkey
&&
*
pkey
)
EVP_PKEY_free
(
*
pkey
);
if
(
cert
&&
*
cert
)
X509_free
(
*
cert
);
if
(
ca
)
sk_X509_pop_free
(
*
ca
,
X509_free
);
return
0
;
}
...
...
@@ -159,12 +159,12 @@ static int parse_pk12 (PKCS12 *p12, const char *pass, int passlen,
p7
=
sk_PKCS7_value
(
asafes
,
i
);
bagnid
=
OBJ_obj2nid
(
p7
->
type
);
if
(
bagnid
==
NID_pkcs7_data
)
{
bags
=
M_PKCS12_unpack_p7data
(
p7
);
bags
=
M_PKCS12_unpack_p7data
(
p7
);
}
else
if
(
bagnid
==
NID_pkcs7_encrypted
)
{
bags
=
M_PKCS12_unpack_p7encdata
(
p7
,
pass
,
passlen
);
bags
=
M_PKCS12_unpack_p7encdata
(
p7
,
pass
,
passlen
);
}
else
continue
;
if
(
!
bags
)
{
sk_PKCS7_pop_free
(
asafes
,
PKCS7_free
);
sk_PKCS7_pop_free
(
asafes
,
PKCS7_free
);
return
0
;
}
if
(
!
parse_bags
(
bags
,
pass
,
passlen
,
pkey
,
cert
,
ca
,
...
...
This diff is collapsed.
Click to expand it.
crypto/pkcs12/pkcs12.h
浏览文件 @
7ef82068
...
...
@@ -146,24 +146,24 @@ union {
#define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type
#define M_PKCS12_x5092certbag(x509) \
PKCS12_pack_safebag
((char *)(x509), i2d_X509, NID_x509Certificate, NID_certBag)
PKCS12_pack_safebag((char *)(x509), i2d_X509, NID_x509Certificate, NID_certBag)
#define M_PKCS12_x509crl2certbag(crl) \
PKCS12_pack_safebag
((char *)(crl), i2d_X509CRL, NID_x509Crl, NID_crlBag)
PKCS12_pack_safebag((char *)(crl), i2d_X509CRL, NID_x509Crl, NID_crlBag)
#define M_PKCS12_certbag2x509(bg) \
(X509 *) ASN1_unpack_string
((bg)->value.bag->value.octet, \
(X509 *) ASN1_unpack_string((bg)->value.bag->value.octet, \
(char *(*)())d2i_X509)
#define M_PKCS12_certbag2x509crl(bg) \
(X509CRL *) ASN1_unpack_string
((bg)->value.bag->value.octet, \
(X509CRL *) ASN1_unpack_string((bg)->value.bag->value.octet, \
(char *(*)())d2i_X509CRL)
/*#define M_PKCS12_pkcs82rsa(p8) \
(RSA *) ASN1_unpack_string
((p8)->pkey, (char *(*)())d2i_RSAPrivateKey)*/
(RSA *) ASN1_unpack_string((p8)->pkey, (char *(*)())d2i_RSAPrivateKey)*/
#define M_PKCS12_unpack_p7data(p7) \
ASN1_seq_unpack_PKCS12_SAFEBAG
((p7)->d.data->data, p7->d.data->length, \
ASN1_seq_unpack_PKCS12_SAFEBAG((p7)->d.data->data, p7->d.data->length, \
d2i_PKCS12_SAFEBAG, PKCS12_SAFEBAG_free)
#define M_PKCS12_pack_authsafes(p12, safes) \
...
...
@@ -175,19 +175,19 @@ ASN1_seq_unpack_PKCS7((p12)->authsafes->d.data->data, \
(p12)->authsafes->d.data->length, d2i_PKCS7, PKCS7_free)
#define M_PKCS12_unpack_p7encdata(p7, pass, passlen) \
PKCS12_decrypt_d2i_PKCS12_SAFEBAG
((p7)->d.encrypted->enc_data->algorithm,\
PKCS12_decrypt_d2i_PKCS12_SAFEBAG((p7)->d.encrypted->enc_data->algorithm,\
d2i_PKCS12_SAFEBAG, PKCS12_SAFEBAG_free, \
(pass), (passlen), \
(p7)->d.encrypted->enc_data->enc_data, 3)
#define M_PKCS12_decrypt_skey(bag, pass, passlen) \
(PKCS8_PRIV_KEY_INFO *) PKCS12_decrypt_d2i
((bag)->value.shkeybag->algor, \
(PKCS8_PRIV_KEY_INFO *) PKCS12_decrypt_d2i((bag)->value.shkeybag->algor, \
(char *(*)())d2i_PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free, \
(pass), (passlen), \
(bag)->value.shkeybag->digest, 2)
#define M_PKCS8_decrypt(p8, pass, passlen) \
(PKCS8_PRIV_KEY_INFO *) PKCS12_decrypt_d2i
((p8)->algor, \
(PKCS8_PRIV_KEY_INFO *) PKCS12_decrypt_d2i((p8)->algor, \
(char *(*)())d2i_PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free,\
(pass), (passlen), (p8)->digest, 2)
...
...
This diff is collapsed.
Click to expand it.
crypto/stack/safestack.h
浏览文件 @
7ef82068
此差异已折叠。
点击以展开。
crypto/x509/x509.h
浏览文件 @
7ef82068
...
...
@@ -102,26 +102,8 @@ extern "C" {
#endif
/* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */
#define DECLARE_PKCS12_STACK_OF(type) \
STACK_OF(type) *PKCS12_decrypt_d2i_##type(struct X509_algor_st *algor, \
type *(*d2i)(type **, \
unsigned char **, \
long), \
void (*free_func)(type *), \
const char *pass, int passlen, \
ASN1_STRING *oct, int seq);
#define IMPLEMENT_PKCS12_STACK_OF(type) \
STACK_OF(type) *PKCS12_decrypt_d2i_##type(struct X509_algor_st *algor, \
type *(*d2i)(type **, \
unsigned char **, \
long), \
void (*free_func)(type *), \
const char *pass, int passlen, \
ASN1_STRING *oct, int seq) \
{ return (STACK_OF(type) *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i, \
(void(*)(void *))free_func, \
pass,passlen,oct,seq); }
#define DECLARE_PKCS12_STACK_OF(type)
/* Nothing */
#define IMPLEMENT_PKCS12_STACK_OF(type)
/* Nothing */
#define X509_FILETYPE_PEM 1
#define X509_FILETYPE_ASN1 2
...
...
This diff is collapsed.
Click to expand it.
util/mkstack.pl
浏览文件 @
7ef82068
...
...
@@ -31,12 +31,17 @@ foreach $file (@source) {
while
(
<
IN
>
)
{
if
(
/^DECLARE_STACK_OF\(([^)]+)\)/
)
{
push
@stacklst
,
$
1
;
}
if
(
/^DECLARE_ASN1_SET_OF\(([^)]+)\)/
)
{
push
@asn1setlst
,
$
1
;
}
if
(
/^DECLARE_PKCS12_STACK_OF\(([^)]+)\)/
)
{
push
@p12stklst
,
$
1
;
}
}
close
(
IN
);
}
my
$old_stackfile
=
"";
my
$new_stackfile
=
"";
my
$inside_block
=
0
;
...
...
@@ -79,6 +84,26 @@ while(<IN>) {
#define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st))
#define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st))
#define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st))
EOF
}
foreach
$type_thing
(
@asn1setlst
)
{
$new_stackfile
.=
<<EOF;
#define d2i_ASN1_SET_OF_${type_thing}(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\
SKM_ASN1_SET_OF_d2i($type_thing, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
#define i2d_ASN1_SET_OF_${type_thing}(st, pp, i2d_func, ex_tag, ex_class, is_set) \\
SKM_ASN1_SET_OF_i2d($type_thing, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
#define ASN1_seq_pack_${type_thing}(st, i2d_func, buf, len) \\
SKM_ASN1_seq_pack($type_thing, (st), (i2d_func), (buf), (len))
#define ASN1_seq_unpack_${type_thing}(buf, len, d2i_func, free_func) \\
SKM_ASN1_seq_unpack($type_thing, (buf), (len), (d2i_func), (free_func))
EOF
}
foreach
$type_thing
(
@p12stklst
)
{
$new_stackfile
.=
<<EOF;
#define PKCS12_decrypt_d2i_${type_thing}(algor, d2i_func, free_func, pass, passlen, oct, seq) \\
SKM_PKCS12_decrypt_d2i($type_thing, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))
EOF
}
$new_stackfile
.=
"
/* End of util/mkstack.pl block, you may now edit :-) */
\n
";
...
...
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部