Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
947e1292
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
947e1292
编写于
12月 19, 2012
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
engine/cchost: fix bugs.
PR: 2821 Submitted by: Dmitry Belyavsky, Serguei Leontiev
上级
0a2d5003
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
9 deletion
+27
-9
engines/ccgost/gost89.c
engines/ccgost/gost89.c
+13
-1
engines/ccgost/gost_crypt.c
engines/ccgost/gost_crypt.c
+12
-6
engines/ccgost/gost_lcl.h
engines/ccgost/gost_lcl.h
+2
-2
未找到文件。
engines/ccgost/gost89.c
浏览文件 @
947e1292
...
...
@@ -369,7 +369,13 @@ int gost_mac(gost_ctx *ctx,int mac_len,const unsigned char *data,
memset
(
buf2
,
0
,
8
);
memcpy
(
buf2
,
data
+
i
,
data_len
-
i
);
mac_block
(
ctx
,
buffer
,
buf2
);
}
i
+=
8
;
}
if
(
i
==
8
)
{
memset
(
buf2
,
0
,
8
);
mac_block
(
ctx
,
buffer
,
buf2
);
}
get_mac
(
buffer
,
mac_len
,
mac
);
return
1
;
}
...
...
@@ -389,7 +395,13 @@ int gost_mac_iv(gost_ctx *ctx,int mac_len,const unsigned char *iv,const unsigned
memset
(
buf2
,
0
,
8
);
memcpy
(
buf2
,
data
+
i
,
data_len
-
i
);
mac_block
(
ctx
,
buffer
,
buf2
);
i
+=
8
;
}
if
(
i
==
8
)
{
memset
(
buf2
,
0
,
8
);
mac_block
(
ctx
,
buffer
,
buf2
);
}
get_mac
(
buffer
,
mac_len
,
mac
);
return
1
;
}
...
...
engines/ccgost/gost_crypt.c
浏览文件 @
947e1292
...
...
@@ -206,12 +206,12 @@ int gost_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
static
void
gost_crypt_mesh
(
void
*
ctx
,
unsigned
char
*
iv
,
unsigned
char
*
buf
)
{
struct
ossl_gost_cipher_ctx
*
c
=
ctx
;
if
(
c
->
count
&&
c
->
key_meshing
&&
c
->
count
%
1024
==
0
)
if
(
c
->
key_meshing
&&
c
->
count
==
1024
)
{
cryptopro_key_meshing
(
&
(
c
->
cctx
),
iv
);
}
gostcrypt
(
&
(
c
->
cctx
),
iv
,
buf
);
c
->
count
+=
8
;
c
->
count
=
(
c
->
count
+
8
)
%
1024
+
1024
;
}
static
void
gost_cnt_next
(
void
*
ctx
,
unsigned
char
*
iv
,
unsigned
char
*
buf
)
...
...
@@ -219,7 +219,7 @@ static void gost_cnt_next (void *ctx, unsigned char *iv, unsigned char *buf)
struct
ossl_gost_cipher_ctx
*
c
=
ctx
;
word32
g
,
go
;
unsigned
char
buf1
[
8
];
if
(
c
->
count
&&
c
->
key_meshing
&&
c
->
count
%
1024
==
0
)
if
(
c
->
key_meshing
&&
c
->
count
==
1024
)
{
cryptopro_key_meshing
(
&
(
c
->
cctx
),
iv
);
}
...
...
@@ -248,7 +248,7 @@ static void gost_cnt_next (void *ctx, unsigned char *iv, unsigned char *buf)
buf1
[
7
]
=
(
unsigned
char
)((
g
>>
24
)
&
0xff
);
memcpy
(
iv
,
buf1
,
8
);
gostcrypt
(
&
(
c
->
cctx
),
buf1
,
buf
);
c
->
count
+=
8
;
c
->
count
=
(
c
->
count
+
8
)
%
1024
+
1024
;
}
/* GOST encryption in CFB mode */
...
...
@@ -511,12 +511,12 @@ static void mac_block_mesh(struct ossl_gost_imit_ctx *c,const unsigned char *dat
* interpret internal state of MAC algorithm as iv during keymeshing
* (but does initialize internal state from iv in key transport
*/
if
(
c
->
key_meshing
&&
c
->
count
&&
c
->
count
%
1024
==
0
)
if
(
c
->
key_meshing
&&
c
->
count
==
1024
)
{
cryptopro_key_meshing
(
&
(
c
->
cctx
),
buffer
);
}
mac_block
(
&
(
c
->
cctx
),
c
->
buffer
,
data
);
c
->
count
+=
8
;
c
->
count
=
(
c
->
count
+
1
)
%
1024
+
1024
;
}
int
gost_imit_update
(
EVP_MD_CTX
*
ctx
,
const
void
*
data
,
size_t
count
)
...
...
@@ -565,6 +565,12 @@ int gost_imit_final(EVP_MD_CTX *ctx,unsigned char *md)
GOSTerr
(
GOST_F_GOST_IMIT_FINAL
,
GOST_R_MAC_KEY_NOT_SET
);
return
0
;
}
if
(
c
->
count
==
0
&&
c
->
bytes_left
)
{
unsigned
char
buffer
[
8
];
memset
(
buffer
,
0
,
8
);
gost_imit_update
(
ctx
,
buffer
,
8
);
}
if
(
c
->
bytes_left
)
{
int
i
;
...
...
engines/ccgost/gost_lcl.h
浏览文件 @
947e1292
...
...
@@ -136,7 +136,7 @@ extern EVP_MD imit_gost_cpa;
/* Cipher context used for EVP_CIPHER operation */
struct
ossl_gost_cipher_ctx
{
int
paramNID
;
off_
t
count
;
unsigned
in
t
count
;
int
key_meshing
;
gost_ctx
cctx
;
};
...
...
@@ -151,7 +151,7 @@ struct ossl_gost_imit_ctx {
gost_ctx
cctx
;
unsigned
char
buffer
[
8
];
unsigned
char
partial_block
[
8
];
off_
t
count
;
unsigned
in
t
count
;
int
key_meshing
;
int
bytes_left
;
int
key_set
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录