Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
b518d2d5
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b518d2d5
编写于
12月 11, 2015
作者:
R
Richard Levitte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt BIO_f_base64 to the opaque EVP_ENCODE_CTX
Reviewed-by:
N
Rich Salz
<
rsalz@openssl.org
>
上级
a0be4fd1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
11 deletion
+14
-11
crypto/evp/bio_b64.c
crypto/evp/bio_b64.c
+14
-11
未找到文件。
crypto/evp/bio_b64.c
浏览文件 @
b518d2d5
...
...
@@ -89,7 +89,7 @@ typedef struct b64_struct {
int
encode
;
int
start
;
/* have we started decoding yet? */
int
cont
;
/* <= 0 when finished */
EVP_ENCODE_CTX
base64
;
EVP_ENCODE_CTX
*
base64
;
char
buf
[
EVP_ENCODE_LENGTH
(
B64_BLOCK_SIZE
)
+
10
];
char
tmp
[
B64_BLOCK_SIZE
];
}
BIO_B64_CTX
;
...
...
@@ -121,6 +121,7 @@ static int b64_new(BIO *bi)
ctx
->
cont
=
1
;
ctx
->
start
=
1
;
ctx
->
base64
=
EVP_ENCODE_CTX_new
();
bi
->
init
=
1
;
bi
->
ptr
=
(
char
*
)
ctx
;
bi
->
flags
=
0
;
...
...
@@ -132,6 +133,7 @@ static int b64_free(BIO *a)
{
if
(
a
==
NULL
)
return
(
0
);
EVP_ENCODE_CTX_free
(((
BIO_B64_CTX
*
)
a
->
ptr
)
->
base64
);
OPENSSL_free
(
a
->
ptr
);
a
->
ptr
=
NULL
;
a
->
init
=
0
;
...
...
@@ -159,7 +161,7 @@ static int b64_read(BIO *b, char *out, int outl)
ctx
->
buf_len
=
0
;
ctx
->
buf_off
=
0
;
ctx
->
tmp_len
=
0
;
EVP_DecodeInit
(
&
(
ctx
->
base64
)
);
EVP_DecodeInit
(
ctx
->
base64
);
}
/* First check if there are bytes decoded/encoded */
...
...
@@ -238,11 +240,11 @@ static int b64_read(BIO *b, char *out, int outl)
continue
;
}
k
=
EVP_DecodeUpdate
(
&
(
ctx
->
base64
)
,
k
=
EVP_DecodeUpdate
(
ctx
->
base64
,
(
unsigned
char
*
)
ctx
->
buf
,
&
num
,
p
,
q
-
p
);
if
((
k
<=
0
)
&&
(
num
==
0
)
&&
(
ctx
->
start
))
EVP_DecodeInit
(
&
ctx
->
base64
);
EVP_DecodeInit
(
ctx
->
base64
);
else
{
if
(
p
!=
(
unsigned
char
*
)
&
(
ctx
->
tmp
[
0
]))
{
...
...
@@ -251,7 +253,7 @@ static int b64_read(BIO *b, char *out, int outl)
for
(
x
=
0
;
x
<
i
;
x
++
)
ctx
->
tmp
[
x
]
=
p
[
x
];
}
EVP_DecodeInit
(
&
ctx
->
base64
);
EVP_DecodeInit
(
ctx
->
base64
);
ctx
->
start
=
0
;
break
;
}
...
...
@@ -315,7 +317,7 @@ static int b64_read(BIO *b, char *out, int outl)
}
i
=
z
;
}
else
{
i
=
EVP_DecodeUpdate
(
&
(
ctx
->
base64
)
,
i
=
EVP_DecodeUpdate
(
ctx
->
base64
,
(
unsigned
char
*
)
ctx
->
buf
,
&
ctx
->
buf_len
,
(
unsigned
char
*
)
ctx
->
tmp
,
i
);
ctx
->
tmp_len
=
0
;
...
...
@@ -362,7 +364,7 @@ static int b64_write(BIO *b, const char *in, int inl)
ctx
->
buf_len
=
0
;
ctx
->
buf_off
=
0
;
ctx
->
tmp_len
=
0
;
EVP_EncodeInit
(
&
(
ctx
->
base64
)
);
EVP_EncodeInit
(
ctx
->
base64
);
}
OPENSSL_assert
(
ctx
->
buf_off
<
(
int
)
sizeof
(
ctx
->
buf
));
...
...
@@ -431,7 +433,7 @@ static int b64_write(BIO *b, const char *in, int inl)
ret
+=
n
;
}
}
else
{
EVP_EncodeUpdate
(
&
(
ctx
->
base64
)
,
EVP_EncodeUpdate
(
ctx
->
base64
,
(
unsigned
char
*
)
ctx
->
buf
,
&
ctx
->
buf_len
,
(
unsigned
char
*
)
in
,
n
);
OPENSSL_assert
(
ctx
->
buf_len
<=
(
int
)
sizeof
(
ctx
->
buf
));
...
...
@@ -486,7 +488,7 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr)
OPENSSL_assert
(
ctx
->
buf_len
>=
ctx
->
buf_off
);
ret
=
ctx
->
buf_len
-
ctx
->
buf_off
;
if
((
ret
==
0
)
&&
(
ctx
->
encode
!=
B64_NONE
)
&&
(
ctx
->
base64
.
num
!=
0
))
&&
(
EVP_ENCODE_CTX_num
(
ctx
->
base64
)
!=
0
))
ret
=
1
;
else
if
(
ret
<=
0
)
ret
=
BIO_ctrl
(
b
->
next_bio
,
cmd
,
num
,
ptr
);
...
...
@@ -514,9 +516,10 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr)
ctx
->
tmp_len
=
0
;
goto
again
;
}
}
else
if
(
ctx
->
encode
!=
B64_NONE
&&
ctx
->
base64
.
num
!=
0
)
{
}
else
if
(
ctx
->
encode
!=
B64_NONE
&&
EVP_ENCODE_CTX_num
(
ctx
->
base64
)
!=
0
)
{
ctx
->
buf_off
=
0
;
EVP_EncodeFinal
(
&
(
ctx
->
base64
)
,
EVP_EncodeFinal
(
ctx
->
base64
,
(
unsigned
char
*
)
ctx
->
buf
,
&
(
ctx
->
buf_len
));
/* push out the bytes */
goto
again
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录