Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
d18af3f3
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
9 个月 前同步成功
通知
8
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,体验更适合开发者的 AI 搜索 >>
提交
d18af3f3
编写于
3月 10, 2001
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove files from Lenka's EC implementation.
上级
48fe4d62
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
0 addition
and
1662 deletion
+0
-1662
crypto/ec/ec.c
crypto/ec/ec.c
+0
-99
crypto/ec/ec2.h
crypto/ec/ec2.h
+0
-85
crypto/ec/ec_point.c
crypto/ec/ec_point.c
+0
-1478
未找到文件。
crypto/ec/ec.c
已删除
100644 → 0
浏览文件 @
48fe4d62
/*
*
* ec.c
*
* Elliptic Curve Arithmetic Functions
*
* Copyright (C) Lenka Fibikova 2000
*
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "ec2.h"
EC
*
EC_new
()
{
EC
*
ret
;
ret
=
(
EC
*
)
malloc
(
sizeof
(
EC
));
if
(
ret
==
NULL
)
return
NULL
;
ret
->
A
=
BN_new
();
ret
->
B
=
BN_new
();
ret
->
p
=
BN_new
();
ret
->
is_in_mont
=
0
;
if
(
ret
->
A
==
NULL
||
ret
->
B
==
NULL
||
ret
->
p
==
NULL
)
{
if
(
ret
->
A
!=
NULL
)
BN_free
(
ret
->
A
);
if
(
ret
->
B
!=
NULL
)
BN_free
(
ret
->
B
);
if
(
ret
->
p
!=
NULL
)
BN_free
(
ret
->
p
);
free
(
ret
);
return
(
NULL
);
}
return
(
ret
);
}
void
EC_clear_free
(
EC
*
E
)
{
if
(
E
==
NULL
)
return
;
if
(
E
->
A
!=
NULL
)
BN_clear_free
(
E
->
A
);
if
(
E
->
B
!=
NULL
)
BN_clear_free
(
E
->
B
);
if
(
E
->
p
!=
NULL
)
BN_clear_free
(
E
->
p
);
E
->
is_in_mont
=
0
;
free
(
E
);
}
#ifdef MONTGOMERY
int
EC_to_montgomery
(
EC
*
E
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
)
{
assert
(
E
!=
NULL
);
assert
(
E
->
A
!=
NULL
&&
E
->
B
!=
NULL
&&
E
->
p
!=
NULL
);
assert
(
mont
!=
NULL
);
assert
(
mont
->
p
!=
NULL
);
assert
(
ctx
!=
NULL
);
if
(
E
->
is_in_mont
)
return
1
;
if
(
!
BN_lshift
(
E
->
A
,
E
->
A
,
mont
->
R_num_bits
))
return
0
;
if
(
!
BN_mod
(
E
->
A
,
E
->
A
,
mont
->
p
,
ctx
))
return
0
;
if
(
!
BN_lshift
(
E
->
B
,
E
->
B
,
mont
->
R_num_bits
))
return
0
;
if
(
!
BN_mod
(
E
->
B
,
E
->
B
,
mont
->
p
,
ctx
))
return
0
;
E
->
is_in_mont
=
1
;
return
1
;
}
int
EC_from_montgomery
(
EC
*
E
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
)
{
assert
(
E
!=
NULL
);
assert
(
E
->
A
!=
NULL
&&
E
->
B
!=
NULL
&&
E
->
p
!=
NULL
);
assert
(
mont
!=
NULL
);
assert
(
mont
->
p
!=
NULL
);
assert
(
ctx
!=
NULL
);
if
(
!
E
->
is_in_mont
)
return
1
;
if
(
!
BN_mont_red
(
E
->
A
,
mont
))
return
0
;
if
(
!
BN_mont_red
(
E
->
B
,
mont
))
return
0
;
E
->
is_in_mont
=
0
;
return
1
;
}
#endif
/* MONTGOMERY */
crypto/ec/ec2.h
已删除
100644 → 0
浏览文件 @
48fe4d62
/*
*
* ec.h
*
* Elliptic Curve Arithmetic Functions
*
* Copyright (C) Lenka Fibikova 2000
*
*
*/
#ifndef HEADER_EC_H
#define HEADER_EC_H
#include <openssl/bn.h>
#include "../bn/bn_mont2.h"
/* XXX */
typedef
struct
bn_ec_struct
/* E: y^2 = x^3 + Ax + B (mod p) */
{
BIGNUM
*
A
,
*
B
,
*
p
;
int
is_in_mont
;
}
EC
;
typedef
struct
bn_ec_point_struct
/* P = [X, Y, Z] */
{
BIGNUM
*
X
,
*
Y
,
*
Z
;
int
is_in_mont
;
}
EC_POINT
;
typedef
struct
bn_ecp_precompute_struct
/* Pi[i] = [2i + 1]P i = 0..2^{r-1} - 1 */
{
int
r
;
EC_POINT
**
Pi
;
}
ECP_PRECOMPUTE
;
#define ECP_is_infty(P) (BN_is_zero(P->Z))
#define ECP_is_norm(P) (BN_is_one(P->Z))
#define ECP_mont_minus(P, mont) (ECP_minus((P), (mont)->p))
EC
*
EC_new
();
void
EC_clear_free
(
EC
*
E
);
#ifdef MONTGOMERY
int
EC_to_montgomery
(
EC
*
E
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
int
EC_from_montgomery
(
EC
*
E
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
#endif
/* MONTGOMERY */
EC_POINT
*
ECP_new
();
void
ECP_clear_free
(
EC_POINT
*
P
);
void
ECP_clear_free_precompute
(
ECP_PRECOMPUTE
*
prec
);
EC_POINT
*
ECP_generate
(
BIGNUM
*
x
,
BIGNUM
*
z
,
EC
*
E
,
BN_CTX
*
ctx
);
EC_POINT
*
ECP_dup
(
EC_POINT
*
P
);
int
ECP_copy
(
EC_POINT
*
R
,
EC_POINT
*
P
);
int
ECP_normalize
(
EC_POINT
*
P
,
EC
*
E
,
BN_CTX
*
ctx
);
EC_POINT
*
ECP_minus
(
EC_POINT
*
P
,
BIGNUM
*
p
);
int
ECP_is_on_ec
(
EC_POINT
*
P
,
EC
*
E
,
BN_CTX
*
ctx
);
int
ECP_ecp2bin
(
EC_POINT
*
P
,
unsigned
char
*
to
,
int
form
);
/* form(ANSI 9.62): 1-compressed; 2-uncompressed; 3-hybrid */
int
ECP_bin2ecp
(
unsigned
char
*
from
,
int
len
,
EC_POINT
*
P
,
EC
*
E
,
BN_CTX
*
ctx
);
#ifdef SIMPLE
int
ECP_cmp
(
EC_POINT
*
P
,
EC_POINT
*
Q
,
BIGNUM
*
p
,
BN_CTX
*
ctx
);
int
ECP_double
(
EC_POINT
*
R
,
EC_POINT
*
P
,
EC
*
E
,
BN_CTX
*
ctx
);
int
ECP_add
(
EC_POINT
*
R
,
EC_POINT
*
P
,
EC_POINT
*
Q
,
EC
*
E
,
BN_CTX
*
ctx
);
ECP_PRECOMPUTE
*
ECP_precompute
(
int
r
,
EC_POINT
*
P
,
EC
*
E
,
BN_CTX
*
ctx
);
int
ECP_multiply
(
EC_POINT
*
R
,
BIGNUM
*
k
,
ECP_PRECOMPUTE
*
prec
,
EC
*
E
,
BN_CTX
*
ctx
);
#endif
/* SIMPLE */
#ifdef MONTGOMERY
int
ECP_to_montgomery
(
EC_POINT
*
P
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
int
ECP_from_montgomery
(
EC_POINT
*
P
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
int
ECP_mont_cmp
(
EC_POINT
*
P
,
EC_POINT
*
Q
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
int
ECP_mont_double
(
EC_POINT
*
R
,
EC_POINT
*
P
,
EC
*
E
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
int
ECP_mont_add
(
EC_POINT
*
R
,
EC_POINT
*
P
,
EC_POINT
*
Q
,
EC
*
E
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
ECP_PRECOMPUTE
*
ECP_mont_precompute
(
int
r
,
EC_POINT
*
P
,
EC
*
E
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
int
ECP_mont_multiply
(
EC_POINT
*
R
,
BIGNUM
*
k
,
ECP_PRECOMPUTE
*
prec
,
EC
*
E
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
int
ECP_mont_multiply2
(
EC_POINT
*
R
,
BIGNUM
*
k
,
EC_POINT
*
P
,
EC
*
E
,
BN_MONTGOMERY
*
mont
,
BN_CTX
*
ctx
);
#endif
/* MONTGOMERY */
#endif
crypto/ec/ec_point.c
已删除
100644 → 0
浏览文件 @
48fe4d62
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录