Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
847865d0
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看板
提交
847865d0
编写于
2月 12, 2014
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add suppot for ASCII with CRLF canonicalisation.
上级
4dce7041
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
5 deletion
+47
-5
apps/cms.c
apps/cms.c
+2
-0
crypto/asn1/asn_mime.c
crypto/asn1/asn_mime.c
+23
-5
crypto/cms/cms.h
crypto/cms/cms.h
+1
-0
crypto/cms/cms_smime.c
crypto/cms/cms_smime.c
+8
-0
crypto/pkcs7/pkcs7.h
crypto/pkcs7/pkcs7.h
+3
-0
doc/apps/cms.pod
doc/apps/cms.pod
+10
-0
未找到文件。
apps/cms.c
浏览文件 @
847865d0
...
...
@@ -258,6 +258,8 @@ int MAIN(int argc, char **argv)
flags
|=
CMS_DEBUG_DECRYPT
;
else
if
(
!
strcmp
(
*
args
,
"-text"
))
flags
|=
CMS_TEXT
;
else
if
(
!
strcmp
(
*
args
,
"-asciicrlf"
))
flags
|=
CMS_ASCIICRLF
;
else
if
(
!
strcmp
(
*
args
,
"-nointern"
))
flags
|=
CMS_NOINTERN
;
else
if
(
!
strcmp
(
*
args
,
"-noverify"
)
...
...
crypto/asn1/asn_mime.c
浏览文件 @
847865d0
...
...
@@ -102,7 +102,7 @@ static int mime_param_cmp(const MIME_PARAM * const *a,
static
void
mime_param_free
(
MIME_PARAM
*
param
);
static
int
mime_bound_check
(
char
*
line
,
int
linelen
,
char
*
bound
,
int
blen
);
static
int
multi_split
(
BIO
*
bio
,
char
*
bound
,
STACK_OF
(
BIO
)
**
ret
);
static
int
strip_eol
(
char
*
linebuf
,
int
*
plen
);
static
int
strip_eol
(
char
*
linebuf
,
int
*
plen
,
int
flags
);
static
MIME_HEADER
*
mime_hdr_find
(
STACK_OF
(
MIME_HEADER
)
*
hdrs
,
char
*
name
);
static
MIME_PARAM
*
mime_param_find
(
MIME_HEADER
*
hdr
,
char
*
name
);
static
void
mime_hdr_free
(
MIME_HEADER
*
hdr
);
...
...
@@ -554,14 +554,30 @@ int SMIME_crlf_copy(BIO *in, BIO *out, int flags)
}
else
{
int
eolcnt
=
0
;
if
(
flags
&
SMIME_TEXT
)
BIO_printf
(
out
,
"Content-Type: text/plain
\r\n\r\n
"
);
while
((
len
=
BIO_gets
(
in
,
linebuf
,
MAX_SMLEN
))
>
0
)
{
eol
=
strip_eol
(
linebuf
,
&
len
);
eol
=
strip_eol
(
linebuf
,
&
len
,
flags
);
if
(
len
)
{
/* Not EOF: write out all CRLF */
if
(
flags
&
SMIME_ASCIICRLF
)
{
int
i
;
for
(
i
=
0
;
i
<
eolcnt
;
i
++
)
BIO_write
(
out
,
"
\r\n
"
,
2
);
eolcnt
=
0
;
}
BIO_write
(
out
,
linebuf
,
len
);
if
(
eol
)
BIO_write
(
out
,
"
\r\n
"
,
2
);
if
(
eol
)
BIO_write
(
out
,
"
\r\n
"
,
2
);
}
else
if
(
flags
&
SMIME_ASCIICRLF
)
eolcnt
++
;
else
if
(
eol
)
BIO_write
(
out
,
"
\r\n
"
,
2
);
}
}
(
void
)
BIO_flush
(
out
);
...
...
@@ -630,7 +646,7 @@ static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret)
return
1
;
}
else
if
(
part
)
{
/* Strip CR+LF from linebuf */
next_eol
=
strip_eol
(
linebuf
,
&
len
);
next_eol
=
strip_eol
(
linebuf
,
&
len
,
0
);
if
(
first
)
{
first
=
0
;
if
(
bpart
)
sk_BIO_push
(
parts
,
bpart
);
...
...
@@ -932,7 +948,7 @@ static int mime_bound_check(char *line, int linelen, char *bound, int blen)
return
0
;
}
static
int
strip_eol
(
char
*
linebuf
,
int
*
plen
)
static
int
strip_eol
(
char
*
linebuf
,
int
*
plen
,
int
flags
)
{
int
len
=
*
plen
;
char
*
p
,
c
;
...
...
@@ -943,6 +959,8 @@ static int strip_eol(char *linebuf, int *plen)
c
=
*
p
;
if
(
c
==
'\n'
)
is_eol
=
1
;
else
if
(
is_eol
&&
flags
&
SMIME_ASCIICRLF
&&
c
<
33
)
continue
;
else
if
(
c
!=
'\r'
)
break
;
}
...
...
crypto/cms/cms.h
浏览文件 @
847865d0
...
...
@@ -117,6 +117,7 @@ DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
#define CMS_USE_KEYID 0x10000
#define CMS_DEBUG_DECRYPT 0x20000
#define CMS_KEY_PARAM 0x40000
#define CMS_ASCIICRLF 0x80000
const
ASN1_OBJECT
*
CMS_get0_type
(
CMS_ContentInfo
*
cms
);
...
...
crypto/cms/cms_smime.c
浏览文件 @
847865d0
...
...
@@ -334,6 +334,12 @@ int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
if
(
!
dcont
&&
!
check_content
(
cms
))
return
0
;
if
(
dcont
&&
!
(
flags
&
CMS_BINARY
))
{
const
ASN1_OBJECT
*
coid
=
CMS_get0_eContentType
(
cms
);
if
(
OBJ_obj2nid
(
coid
)
==
NID_id_ct_asciiTextWithCRLF
)
flags
|=
CMS_ASCIICRLF
;
}
/* Attempt to find all signer certificates */
...
...
@@ -519,6 +525,8 @@ CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
cms
=
CMS_ContentInfo_new
();
if
(
!
cms
||
!
CMS_SignedData_init
(
cms
))
goto
merr
;
if
(
flags
&
CMS_ASCIICRLF
&&
!
CMS_set1_eContentType
(
cms
,
OBJ_nid2obj
(
NID_id_ct_asciiTextWithCRLF
)))
goto
err
;
if
(
pkey
&&
!
CMS_add1_signer
(
cms
,
signcert
,
pkey
,
NULL
,
flags
))
{
...
...
crypto/pkcs7/pkcs7.h
浏览文件 @
847865d0
...
...
@@ -276,6 +276,9 @@ DECLARE_PKCS12_STACK_OF(PKCS7)
#define SMIME_BINARY PKCS7_BINARY
#define SMIME_NOATTR PKCS7_NOATTR
/* CRLF ASCII canonicalisation */
#define SMIME_ASCIICRLF 0x80000
DECLARE_ASN1_FUNCTIONS
(
PKCS7_ISSUER_AND_SERIAL
)
int
PKCS7_ISSUER_AND_SERIAL_digest
(
PKCS7_ISSUER_AND_SERIAL
*
data
,
const
EVP_MD
*
type
,
...
...
doc/apps/cms.pod
浏览文件 @
847865d0
...
...
@@ -43,6 +43,7 @@ B<openssl> B<cms>
[B<-noattr>]
[B<-nosmimecap>]
[B<-binary>]
[B<-asciicrlf>]
[B<-nodetach>]
[B<-certfile file>]
[B<-certsout file>]
...
...
@@ -291,6 +292,15 @@ effectively using CR and LF as end of line: as required by the S/MIME
specification. When this option is present no translation occurs. This
is useful when handling binary data which may not be in MIME format.
=item B<-asciicrlf>
when signing use ASCII CRLF format canonicalisation. This strips trailing
whitespace from all lines, deletes trailing blank lines at EOF and sets
the encapsulated content type. This option is normally used with detached
content and an output signature format of DER. This option is not normally
needed when verifying as it is enabled automatically if the encapsulated
content format is detected.
=item B<-nodetach>
when signing a message use opaque signing: this form is more resistant
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录