Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
be86c7fc
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
9
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看板
提交
be86c7fc
编写于
3月 24, 2008
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add signed receipt ASN1 structures. Initial GENERAL_NAME utility functions.
上级
62051713
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
125 addition
and
48 deletion
+125
-48
crypto/cms/cms.h
crypto/cms/cms.h
+2
-0
crypto/cms/cms_asn1.c
crypto/cms/cms_asn1.c
+13
-0
crypto/cms/cms_lcl.h
crypto/cms/cms_lcl.h
+32
-0
crypto/x509v3/v3_alt.c
crypto/x509v3/v3_alt.c
+69
-47
crypto/x509v3/v3err.c
crypto/x509v3/v3err.c
+3
-1
crypto/x509v3/x509v3.h
crypto/x509v3/x509v3.h
+6
-0
未找到文件。
crypto/cms/cms.h
浏览文件 @
be86c7fc
...
@@ -71,6 +71,8 @@ typedef struct CMS_SignerInfo_st CMS_SignerInfo;
...
@@ -71,6 +71,8 @@ typedef struct CMS_SignerInfo_st CMS_SignerInfo;
typedef
struct
CMS_CertificateChoices
CMS_CertificateChoices
;
typedef
struct
CMS_CertificateChoices
CMS_CertificateChoices
;
typedef
struct
CMS_RevocationInfoChoice_st
CMS_RevocationInfoChoice
;
typedef
struct
CMS_RevocationInfoChoice_st
CMS_RevocationInfoChoice
;
typedef
struct
CMS_RecipientInfo_st
CMS_RecipientInfo
;
typedef
struct
CMS_RecipientInfo_st
CMS_RecipientInfo
;
typedef
struct
CMS_ReceiptRequest_st
CMS_ReceiptRequest
;
typedef
struct
CMS_Receipt_st
CMS_Receipt
;
DECLARE_STACK_OF
(
CMS_SignerInfo
)
DECLARE_STACK_OF
(
CMS_SignerInfo
)
DECLARE_ASN1_FUNCTIONS
(
CMS_ContentInfo
)
DECLARE_ASN1_FUNCTIONS
(
CMS_ContentInfo
)
...
...
crypto/cms/cms_asn1.c
浏览文件 @
be86c7fc
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
#include <openssl/asn1t.h>
#include <openssl/asn1t.h>
#include <openssl/pem.h>
#include <openssl/pem.h>
#include <openssl/x509v3.h>
#include "cms.h"
#include "cms.h"
#include "cms_lcl.h"
#include "cms_lcl.h"
...
@@ -357,3 +358,15 @@ ASN1_ITEM_TEMPLATE(CMS_Attributes_Verify) =
...
@@ -357,3 +358,15 @@ ASN1_ITEM_TEMPLATE(CMS_Attributes_Verify) =
V_ASN1_SET
,
CMS_ATTRIBUTES
,
X509_ATTRIBUTE
)
V_ASN1_SET
,
CMS_ATTRIBUTES
,
X509_ATTRIBUTE
)
ASN1_ITEM_TEMPLATE_END
(
CMS_Attributes_Verify
)
ASN1_ITEM_TEMPLATE_END
(
CMS_Attributes_Verify
)
ASN1_CHOICE
(
CMS_ReceiptsFrom
)
=
{
ASN1_IMP
(
CMS_ReceiptsFrom
,
d
.
allOrFirstTier
,
LONG
,
0
),
ASN1_IMP_SEQUENCE_OF
(
CMS_ReceiptsFrom
,
d
.
receiptList
,
GENERAL_NAME
,
1
)
}
ASN1_CHOICE_END
(
CMS_ReceiptsFrom
)
ASN1_SEQUENCE
(
CMS_ReceiptRequest
)
=
{
ASN1_SIMPLE
(
CMS_ReceiptRequest
,
signedContentIdentifier
,
ASN1_OCTET_STRING
),
ASN1_SIMPLE
(
CMS_ReceiptRequest
,
receiptsFrom
,
CMS_ReceiptsFrom
)
}
ASN1_SEQUENCE_END
(
CMS_ReceiptRequest
)
crypto/cms/cms_lcl.h
浏览文件 @
be86c7fc
...
@@ -91,6 +91,7 @@ typedef struct CMS_KEKIdentifier_st CMS_KEKIdentifier;
...
@@ -91,6 +91,7 @@ typedef struct CMS_KEKIdentifier_st CMS_KEKIdentifier;
typedef
struct
CMS_KEKRecipientInfo_st
CMS_KEKRecipientInfo
;
typedef
struct
CMS_KEKRecipientInfo_st
CMS_KEKRecipientInfo
;
typedef
struct
CMS_PasswordRecipientInfo_st
CMS_PasswordRecipientInfo
;
typedef
struct
CMS_PasswordRecipientInfo_st
CMS_PasswordRecipientInfo
;
typedef
struct
CMS_OtherRecipientInfo_st
CMS_OtherRecipientInfo
;
typedef
struct
CMS_OtherRecipientInfo_st
CMS_OtherRecipientInfo
;
typedef
struct
CMS_ReceiptsFrom_st
CMS_ReceiptsFrom
;
struct
CMS_ContentInfo_st
struct
CMS_ContentInfo_st
{
{
...
@@ -374,6 +375,37 @@ struct CMS_OtherKeyAttribute_st
...
@@ -374,6 +375,37 @@ struct CMS_OtherKeyAttribute_st
ASN1_TYPE
*
keyAttr
;
ASN1_TYPE
*
keyAttr
;
};
};
/* ESS structures */
#ifdef HEADER_X509V3_H
struct
CMS_ReceiptRequest_st
{
ASN1_OCTET_STRING
*
signedContentIdentifier
;
CMS_ReceiptsFrom
*
receiptsFrom
;
GENERAL_NAMES
*
receiptsTo
;
};
struct
CMS_ReceiptsFrom_st
{
int
type
;
union
{
long
allOrFirstTier
;
GENERAL_NAMES
*
receiptList
;
}
d
;
};
#endif
struct
CMS_Receipt_st
{
long
version
;
ASN1_OBJECT
*
contentType
;
ASN1_OCTET_STRING
*
signedContentIdentifier
;
ASN1_OCTET_STRING
*
originatorSignatureValue
;
};
DECLARE_ASN1_FUNCTIONS
(
CMS_ContentInfo
)
DECLARE_ASN1_FUNCTIONS
(
CMS_ContentInfo
)
DECLARE_ASN1_ITEM
(
CMS_SignerInfo
)
DECLARE_ASN1_ITEM
(
CMS_SignerInfo
)
DECLARE_ASN1_ITEM
(
CMS_IssuerAndSerialNumber
)
DECLARE_ASN1_ITEM
(
CMS_IssuerAndSerialNumber
)
...
...
crypto/x509v3/v3_alt.c
浏览文件 @
be86c7fc
...
@@ -414,22 +414,16 @@ GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
...
@@ -414,22 +414,16 @@ GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
return
v2i_GENERAL_NAME_ex
(
NULL
,
method
,
ctx
,
cnf
,
0
);
return
v2i_GENERAL_NAME_ex
(
NULL
,
method
,
ctx
,
cnf
,
0
);
}
}
GENERAL_NAME
*
v2i_GENERAL_NAME_ex
(
GENERAL_NAME
*
out
,
GENERAL_NAME
*
a2i_GENERAL_NAME
(
GENERAL_NAME
*
out
,
X509V3_EXT_METHOD
*
method
,
X509V3_CTX
*
ctx
,
X509V3_EXT_METHOD
*
method
,
X509V3_CTX
*
ctx
,
CONF_VALUE
*
cnf
,
int
is_nc
)
int
gen_type
,
char
*
value
,
int
is_nc
)
{
{
char
is_string
=
0
;
char
is_string
=
0
;
int
type
;
GENERAL_NAME
*
gen
=
NULL
;
GENERAL_NAME
*
gen
=
NULL
;
char
*
name
,
*
value
;
name
=
cnf
->
name
;
value
=
cnf
->
value
;
if
(
!
value
)
if
(
!
value
)
{
{
X509V3err
(
X509V3_F_
V2I_GENERAL_NAME_EX
,
X509V3_R_MISSING_VALUE
);
X509V3err
(
X509V3_F_
A2I_GENERAL_NAME
,
X509V3_R_MISSING_VALUE
);
return
NULL
;
return
NULL
;
}
}
...
@@ -440,74 +434,60 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
...
@@ -440,74 +434,60 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
gen
=
GENERAL_NAME_new
();
gen
=
GENERAL_NAME_new
();
if
(
gen
==
NULL
)
if
(
gen
==
NULL
)
{
{
X509V3err
(
X509V3_F_
V2I_GENERAL_NAME_EX
,
ERR_R_MALLOC_FAILURE
);
X509V3err
(
X509V3_F_
A2I_GENERAL_NAME
,
ERR_R_MALLOC_FAILURE
);
return
NULL
;
return
NULL
;
}
}
}
}
if
(
!
name_cmp
(
name
,
"email"
))
switch
(
gen_type
)
{
is_string
=
1
;
type
=
GEN_EMAIL
;
}
else
if
(
!
name_cmp
(
name
,
"URI"
))
{
is_string
=
1
;
type
=
GEN_URI
;
}
else
if
(
!
name_cmp
(
name
,
"DNS"
))
{
{
case
GEN_URI
:
case
GEN_EMAIL
:
case
GEN_DNS
:
is_string
=
1
;
is_string
=
1
;
type
=
GEN_DNS
;
break
;
}
else
if
(
!
name_cmp
(
name
,
"RID"
))
case
GEN_RID
:
{
{
ASN1_OBJECT
*
obj
;
ASN1_OBJECT
*
obj
;
if
(
!
(
obj
=
OBJ_txt2obj
(
value
,
0
)))
if
(
!
(
obj
=
OBJ_txt2obj
(
value
,
0
)))
{
{
X509V3err
(
X509V3_F_
V2I_GENERAL_NAME_EX
,
X509V3_R_BAD_OBJECT
);
X509V3err
(
X509V3_F_
A2I_GENERAL_NAME
,
X509V3_R_BAD_OBJECT
);
ERR_add_error_data
(
2
,
"value="
,
value
);
ERR_add_error_data
(
2
,
"value="
,
value
);
goto
err
;
goto
err
;
}
}
gen
->
d
.
rid
=
obj
;
gen
->
d
.
rid
=
obj
;
type
=
GEN_RID
;
}
}
else
if
(
!
name_cmp
(
name
,
"IP"
))
{
case
GEN_IPADD
:
if
(
is_nc
)
if
(
is_nc
)
gen
->
d
.
ip
=
a2i_IPADDRESS_NC
(
value
);
gen
->
d
.
ip
=
a2i_IPADDRESS_NC
(
value
);
else
else
gen
->
d
.
ip
=
a2i_IPADDRESS
(
value
);
gen
->
d
.
ip
=
a2i_IPADDRESS
(
value
);
if
(
gen
->
d
.
ip
==
NULL
)
if
(
gen
->
d
.
ip
==
NULL
)
{
{
X509V3err
(
X509V3_F_
V2I_GENERAL_NAME_EX
,
X509V3_R_BAD_IP_ADDRESS
);
X509V3err
(
X509V3_F_
A2I_GENERAL_NAME
,
X509V3_R_BAD_IP_ADDRESS
);
ERR_add_error_data
(
2
,
"value="
,
value
);
ERR_add_error_data
(
2
,
"value="
,
value
);
goto
err
;
goto
err
;
}
}
type
=
GEN_IPADD
;
break
;
}
else
if
(
!
name_cmp
(
name
,
"dirName"
))
case
GEN_DIRNAME
:
{
type
=
GEN_DIRNAME
;
if
(
!
do_dirname
(
gen
,
value
,
ctx
))
if
(
!
do_dirname
(
gen
,
value
,
ctx
))
{
{
X509V3err
(
X509V3_F_
V2I_GENERAL_NAME_EX
,
X509V3_R_DIRNAME_ERROR
);
X509V3err
(
X509V3_F_
A2I_GENERAL_NAME
,
X509V3_R_DIRNAME_ERROR
);
goto
err
;
goto
err
;
}
}
}
break
;
else
if
(
!
name_cmp
(
name
,
"otherName"
))
{
case
GEN_OTHERNAME
:
if
(
!
do_othername
(
gen
,
value
,
ctx
))
if
(
!
do_othername
(
gen
,
value
,
ctx
))
{
{
X509V3err
(
X509V3_F_
V2I_GENERAL_NAME_EX
,
X509V3_R_OTHERNAME_ERROR
);
X509V3err
(
X509V3_F_
A2I_GENERAL_NAME
,
X509V3_R_OTHERNAME_ERROR
);
goto
err
;
goto
err
;
}
}
type
=
GEN_OTHERNAME
;
default:
}
X509V3err
(
X509V3_F_A2I_GENERAL_NAME
,
X509V3_R_UNSUPPORTED_TYPE
);
else
{
X509V3err
(
X509V3_F_V2I_GENERAL_NAME_EX
,
X509V3_R_UNSUPPORTED_OPTION
);
ERR_add_error_data
(
2
,
"name="
,
name
);
goto
err
;
goto
err
;
}
}
...
@@ -517,12 +497,12 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
...
@@ -517,12 +497,12 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
!
ASN1_STRING_set
(
gen
->
d
.
ia5
,
(
unsigned
char
*
)
value
,
!
ASN1_STRING_set
(
gen
->
d
.
ia5
,
(
unsigned
char
*
)
value
,
strlen
(
value
)))
strlen
(
value
)))
{
{
X509V3err
(
X509V3_F_
V2I_GENERAL_NAME_EX
,
ERR_R_MALLOC_FAILURE
);
X509V3err
(
X509V3_F_
A2I_GENERAL_NAME
,
ERR_R_MALLOC_FAILURE
);
goto
err
;
goto
err
;
}
}
}
}
gen
->
type
=
type
;
gen
->
type
=
gen_
type
;
return
gen
;
return
gen
;
...
@@ -531,6 +511,48 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
...
@@ -531,6 +511,48 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
return
NULL
;
return
NULL
;
}
}
GENERAL_NAME
*
v2i_GENERAL_NAME_ex
(
GENERAL_NAME
*
out
,
X509V3_EXT_METHOD
*
method
,
X509V3_CTX
*
ctx
,
CONF_VALUE
*
cnf
,
int
is_nc
)
{
int
type
;
char
*
name
,
*
value
;
name
=
cnf
->
name
;
value
=
cnf
->
value
;
if
(
!
value
)
{
X509V3err
(
X509V3_F_V2I_GENERAL_NAME_EX
,
X509V3_R_MISSING_VALUE
);
return
NULL
;
}
if
(
!
name_cmp
(
name
,
"email"
))
type
=
GEN_EMAIL
;
else
if
(
!
name_cmp
(
name
,
"URI"
))
type
=
GEN_URI
;
else
if
(
!
name_cmp
(
name
,
"DNS"
))
type
=
GEN_DNS
;
else
if
(
!
name_cmp
(
name
,
"RID"
))
type
=
GEN_RID
;
else
if
(
!
name_cmp
(
name
,
"IP"
))
type
=
GEN_IPADD
;
else
if
(
!
name_cmp
(
name
,
"dirName"
))
type
=
GEN_DIRNAME
;
else
if
(
!
name_cmp
(
name
,
"otherName"
))
type
=
GEN_OTHERNAME
;
else
{
X509V3err
(
X509V3_F_V2I_GENERAL_NAME_EX
,
X509V3_R_UNSUPPORTED_OPTION
);
ERR_add_error_data
(
2
,
"name="
,
name
);
return
NULL
;
}
return
a2i_GENERAL_NAME
(
out
,
method
,
ctx
,
type
,
value
,
is_nc
);
}
static
int
do_othername
(
GENERAL_NAME
*
gen
,
char
*
value
,
X509V3_CTX
*
ctx
)
static
int
do_othername
(
GENERAL_NAME
*
gen
,
char
*
value
,
X509V3_CTX
*
ctx
)
{
{
char
*
objtmp
=
NULL
,
*
p
;
char
*
objtmp
=
NULL
,
*
p
;
...
...
crypto/x509v3/v3err.c
浏览文件 @
be86c7fc
/* crypto/x509v3/v3err.c */
/* crypto/x509v3/v3err.c */
/* ====================================================================
/* ====================================================================
* Copyright (c) 1999-200
6
The OpenSSL Project. All rights reserved.
* Copyright (c) 1999-200
7
The OpenSSL Project. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* modification, are permitted provided that the following conditions
...
@@ -70,6 +70,7 @@
...
@@ -70,6 +70,7 @@
static
ERR_STRING_DATA
X509V3_str_functs
[]
=
static
ERR_STRING_DATA
X509V3_str_functs
[]
=
{
{
{
ERR_FUNC
(
X509V3_F_A2I_GENERAL_NAME
),
"A2I_GENERAL_NAME"
},
{
ERR_FUNC
(
X509V3_F_ASIDENTIFIERCHOICE_CANONIZE
),
"ASIDENTIFIERCHOICE_CANONIZE"
},
{
ERR_FUNC
(
X509V3_F_ASIDENTIFIERCHOICE_CANONIZE
),
"ASIDENTIFIERCHOICE_CANONIZE"
},
{
ERR_FUNC
(
X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL
),
"ASIDENTIFIERCHOICE_IS_CANONICAL"
},
{
ERR_FUNC
(
X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL
),
"ASIDENTIFIERCHOICE_IS_CANONICAL"
},
{
ERR_FUNC
(
X509V3_F_COPY_EMAIL
),
"COPY_EMAIL"
},
{
ERR_FUNC
(
X509V3_F_COPY_EMAIL
),
"COPY_EMAIL"
},
...
@@ -205,6 +206,7 @@ static ERR_STRING_DATA X509V3_str_reasons[]=
...
@@ -205,6 +206,7 @@ static ERR_STRING_DATA X509V3_str_reasons[]=
{
ERR_REASON
(
X509V3_R_UNKNOWN_EXTENSION_NAME
),
"unknown extension name"
},
{
ERR_REASON
(
X509V3_R_UNKNOWN_EXTENSION_NAME
),
"unknown extension name"
},
{
ERR_REASON
(
X509V3_R_UNKNOWN_OPTION
)
,
"unknown option"
},
{
ERR_REASON
(
X509V3_R_UNKNOWN_OPTION
)
,
"unknown option"
},
{
ERR_REASON
(
X509V3_R_UNSUPPORTED_OPTION
)
,
"unsupported option"
},
{
ERR_REASON
(
X509V3_R_UNSUPPORTED_OPTION
)
,
"unsupported option"
},
{
ERR_REASON
(
X509V3_R_UNSUPPORTED_TYPE
)
,
"unsupported type"
},
{
ERR_REASON
(
X509V3_R_USER_TOO_LONG
)
,
"user too long"
},
{
ERR_REASON
(
X509V3_R_USER_TOO_LONG
)
,
"user too long"
},
{
0
,
NULL
}
{
0
,
NULL
}
};
};
...
...
crypto/x509v3/x509v3.h
浏览文件 @
be86c7fc
...
@@ -553,6 +553,10 @@ DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
...
@@ -553,6 +553,10 @@ DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
DECLARE_ASN1_ALLOC_FUNCTIONS
(
POLICY_CONSTRAINTS
)
DECLARE_ASN1_ALLOC_FUNCTIONS
(
POLICY_CONSTRAINTS
)
DECLARE_ASN1_ITEM
(
POLICY_CONSTRAINTS
)
DECLARE_ASN1_ITEM
(
POLICY_CONSTRAINTS
)
GENERAL_NAME
*
a2i_GENERAL_NAME
(
GENERAL_NAME
*
out
,
X509V3_EXT_METHOD
*
method
,
X509V3_CTX
*
ctx
,
int
gen_type
,
char
*
value
,
int
is_nc
);
#ifdef HEADER_CONF_H
#ifdef HEADER_CONF_H
GENERAL_NAME
*
v2i_GENERAL_NAME
(
X509V3_EXT_METHOD
*
method
,
X509V3_CTX
*
ctx
,
GENERAL_NAME
*
v2i_GENERAL_NAME
(
X509V3_EXT_METHOD
*
method
,
X509V3_CTX
*
ctx
,
CONF_VALUE
*
cnf
);
CONF_VALUE
*
cnf
);
...
@@ -818,6 +822,7 @@ void ERR_load_X509V3_strings(void);
...
@@ -818,6 +822,7 @@ void ERR_load_X509V3_strings(void);
/* Error codes for the X509V3 functions. */
/* Error codes for the X509V3 functions. */
/* Function codes. */
/* Function codes. */
#define X509V3_F_A2I_GENERAL_NAME 164
#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161
#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161
#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162
#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162
#define X509V3_F_COPY_EMAIL 122
#define X509V3_F_COPY_EMAIL 122
...
@@ -950,6 +955,7 @@ void ERR_load_X509V3_strings(void);
...
@@ -950,6 +955,7 @@ void ERR_load_X509V3_strings(void);
#define X509V3_R_UNKNOWN_EXTENSION_NAME 130
#define X509V3_R_UNKNOWN_EXTENSION_NAME 130
#define X509V3_R_UNKNOWN_OPTION 120
#define X509V3_R_UNKNOWN_OPTION 120
#define X509V3_R_UNSUPPORTED_OPTION 117
#define X509V3_R_UNSUPPORTED_OPTION 117
#define X509V3_R_UNSUPPORTED_TYPE 167
#define X509V3_R_USER_TOO_LONG 132
#define X509V3_R_USER_TOO_LONG 132
#ifdef __cplusplus
#ifdef __cplusplus
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录