Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
bd3602eb
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
10
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看板
提交
bd3602eb
编写于
10月 27, 2015
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move and adapt ECDSA sign and verify functions.
Reviewed-by:
N
Richard Levitte
<
levitte@openssl.org
>
上级
cf70b8f5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
71 addition
and
98 deletion
+71
-98
crypto/ec/Makefile
crypto/ec/Makefile
+2
-2
crypto/ec/ec_pmeth.c
crypto/ec/ec_pmeth.c
+0
-1
crypto/ec/ecdsa_sign.c
crypto/ec/ecdsa_sign.c
+9
-10
crypto/ec/ecdsa_vrf.c
crypto/ec/ecdsa_vrf.c
+5
-5
crypto/ecdsa/Makefile
crypto/ecdsa/Makefile
+2
-27
include/openssl/ec.h
include/openssl/ec.h
+53
-0
include/openssl/ecdsa.h
include/openssl/ecdsa.h
+0
-53
未找到文件。
crypto/ec/Makefile
浏览文件 @
bd3602eb
...
...
@@ -22,14 +22,14 @@ LIBSRC= ec_lib.c ecp_smpl.c ecp_mont.c ecp_nist.c ec_cvt.c ec_mult.c\
ec2_smpl.c ec2_mult.c ec_ameth.c ec_pmeth.c eck_prn.c
\
ecp_nistp224.c ecp_nistp256.c ecp_nistp521.c ecp_nistputil.c
\
ecp_oct.c ec2_oct.c ec_oct.c ec_kmeth.c ecdh_ossl.c ecdh_kdf.c
\
ecdsa_ossl.c
ecdsa_ossl.c
ecdsa_sign.c ecdsa_vrf.c
LIBOBJ
=
ec_lib.o ecp_smpl.o ecp_mont.o ecp_nist.o ec_cvt.o ec_mult.o
\
ec_err.o ec_curve.o ec_check.o ec_print.o ec_asn1.o ec_key.o
\
ec2_smpl.o ec2_mult.o ec_ameth.o ec_pmeth.o eck_prn.o
\
ecp_nistp224.o ecp_nistp256.o ecp_nistp521.o ecp_nistputil.o
\
ecp_oct.o ec2_oct.o ec_oct.o ec_kmeth.o ecdh_ossl.o ecdh_kdf.o
\
ecdsa_ossl.o
$(EC_ASM)
ecdsa_ossl.o
ecdsa_sign.o ecdsa_vrf.o
$(EC_ASM)
SRC
=
$(LIBSRC)
...
...
crypto/ec/ec_pmeth.c
浏览文件 @
bd3602eb
...
...
@@ -62,7 +62,6 @@
#include <openssl/x509.h>
#include <openssl/ec.h>
#include "ec_lcl.h"
#include <openssl/ecdsa.h>
#include <openssl/evp.h>
#include "internal/evp_int.h"
...
...
crypto/ec
dsa/ecs
_sign.c
→
crypto/ec
/ecdsa
_sign.c
浏览文件 @
bd3602eb
/* crypto/ec
dsa
/ecdsa_sign.c */
/* crypto/ec/ecdsa_sign.c */
/* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
*
...
...
@@ -53,7 +53,8 @@
*
*/
#include "ecs_locl.h"
# include <openssl/ec.h>
#include "ec_lcl.h"
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
...
...
@@ -68,10 +69,9 @@ ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dlen,
const
BIGNUM
*
kinv
,
const
BIGNUM
*
rp
,
EC_KEY
*
eckey
)
{
ECDSA_DATA
*
ecdsa
=
ecdsa_check
(
eckey
);
if
(
ecdsa
==
NULL
)
return
NULL
;
return
ecdsa
->
meth
->
ecdsa_do_sign
(
dgst
,
dlen
,
kinv
,
rp
,
eckey
);
if
(
eckey
->
meth
->
sign_sig
)
return
eckey
->
meth
->
sign_sig
(
dgst
,
dlen
,
kinv
,
rp
,
eckey
);
return
NULL
;
}
int
ECDSA_sign
(
int
type
,
const
unsigned
char
*
dgst
,
int
dlen
,
unsigned
char
...
...
@@ -99,8 +99,7 @@ int ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char
int
ECDSA_sign_setup
(
EC_KEY
*
eckey
,
BN_CTX
*
ctx_in
,
BIGNUM
**
kinvp
,
BIGNUM
**
rp
)
{
ECDSA_DATA
*
ecdsa
=
ecdsa_check
(
eckey
);
if
(
ecdsa
==
NULL
)
return
0
;
return
ecdsa
->
meth
->
ecdsa_sign_setup
(
eckey
,
ctx_in
,
kinvp
,
rp
);
if
(
eckey
->
meth
->
sign_setup
)
return
eckey
->
meth
->
sign_setup
(
eckey
,
ctx_in
,
kinvp
,
rp
);
return
0
;
}
crypto/ec
dsa/ecs
_vrf.c
→
crypto/ec
/ecdsa
_vrf.c
浏览文件 @
bd3602eb
...
...
@@ -56,7 +56,8 @@
*
*/
#include "ecs_locl.h"
#include <openssl/ec.h>
#include "ec_lcl.h"
#include <string.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
...
...
@@ -71,10 +72,9 @@
int
ECDSA_do_verify
(
const
unsigned
char
*
dgst
,
int
dgst_len
,
const
ECDSA_SIG
*
sig
,
EC_KEY
*
eckey
)
{
ECDSA_DATA
*
ecdsa
=
ecdsa_check
(
eckey
);
if
(
ecdsa
==
NULL
)
return
0
;
return
ecdsa
->
meth
->
ecdsa_do_verify
(
dgst
,
dgst_len
,
sig
,
eckey
);
if
(
eckey
->
meth
->
verify_sig
)
return
eckey
->
meth
->
verify_sig
(
dgst
,
dgst_len
,
sig
,
eckey
);
return
0
;
}
/*-
...
...
crypto/ecdsa/Makefile
浏览文件 @
bd3602eb
...
...
@@ -15,9 +15,9 @@ CFLAGS= $(INCLUDES) $(CFLAG)
GENERAL
=
Makefile
LIB
=
$(TOP)
/libcrypto.a
LIBSRC
=
ecs_lib.c ecs_
sign.c ecs_vrf.c ecs_
err.c
LIBSRC
=
ecs_lib.c ecs_err.c
LIBOBJ
=
ecs_lib.o ecs_
sign.o ecs_vrf.o ecs_
err.o
LIBOBJ
=
ecs_lib.o ecs_err.o
SRC
=
$(LIBSRC)
...
...
@@ -100,28 +100,3 @@ ecs_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
ecs_ossl.o
:
../../include/openssl/rand.h ../../include/openssl/safestack.h
ecs_ossl.o
:
../../include/openssl/stack.h ../../include/openssl/symhacks.h
ecs_ossl.o
:
ecs_locl.h ecs_ossl.c
ecs_sign.o
:
../../include/openssl/asn1.h ../../include/openssl/bio.h
ecs_sign.o
:
../../include/openssl/buffer.h ../../include/openssl/crypto.h
ecs_sign.o
:
../../include/openssl/e_os2.h ../../include/openssl/ec.h
ecs_sign.o
:
../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ecs_sign.o
:
../../include/openssl/engine.h ../../include/openssl/evp.h
ecs_sign.o
:
../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
ecs_sign.o
:
../../include/openssl/objects.h ../../include/openssl/opensslconf.h
ecs_sign.o
:
../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
ecs_sign.o
:
../../include/openssl/pkcs7.h ../../include/openssl/rand.h
ecs_sign.o
:
../../include/openssl/safestack.h ../../include/openssl/sha.h
ecs_sign.o
:
../../include/openssl/stack.h ../../include/openssl/symhacks.h
ecs_sign.o
:
../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
ecs_sign.o
:
ecs_locl.h ecs_sign.c
ecs_vrf.o
:
../../include/openssl/asn1.h ../../include/openssl/bio.h
ecs_vrf.o
:
../../include/openssl/buffer.h ../../include/openssl/crypto.h
ecs_vrf.o
:
../../include/openssl/e_os2.h ../../include/openssl/ec.h
ecs_vrf.o
:
../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
ecs_vrf.o
:
../../include/openssl/engine.h ../../include/openssl/evp.h
ecs_vrf.o
:
../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
ecs_vrf.o
:
../../include/openssl/objects.h ../../include/openssl/opensslconf.h
ecs_vrf.o
:
../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
ecs_vrf.o
:
../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
ecs_vrf.o
:
../../include/openssl/sha.h ../../include/openssl/stack.h
ecs_vrf.o
:
../../include/openssl/symhacks.h ../../include/openssl/x509.h
ecs_vrf.o
:
../../include/openssl/x509_vfy.h ecs_locl.h ecs_vrf.c
include/openssl/ec.h
浏览文件 @
bd3602eb
/* crypto/ec/ec.h */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
...
...
@@ -1035,6 +1036,58 @@ ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);
*/
void
ECDSA_SIG_get0
(
BIGNUM
**
pr
,
BIGNUM
**
ps
,
ECDSA_SIG
*
sig
);
/** Precompute parts of the signing operation
* \param eckey EC_KEY object containing a private EC key
* \param ctx BN_CTX object (optional)
* \param kinv BIGNUM pointer for the inverse of k
* \param rp BIGNUM pointer for x coordinate of k * generator
* \return 1 on success and 0 otherwise
*/
int
ECDSA_sign_setup
(
EC_KEY
*
eckey
,
BN_CTX
*
ctx
,
BIGNUM
**
kinv
,
BIGNUM
**
rp
);
/** Computes ECDSA signature of a given hash value using the supplied
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
* \param type this parameter is ignored
* \param dgst pointer to the hash value to sign
* \param dgstlen length of the hash value
* \param sig memory for the DER encoded created signature
* \param siglen pointer to the length of the returned signature
* \param eckey EC_KEY object containing a private EC key
* \return 1 on success and 0 otherwise
*/
int
ECDSA_sign
(
int
type
,
const
unsigned
char
*
dgst
,
int
dgstlen
,
unsigned
char
*
sig
,
unsigned
int
*
siglen
,
EC_KEY
*
eckey
);
/** Computes ECDSA signature of a given hash value using the supplied
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
* \param type this parameter is ignored
* \param dgst pointer to the hash value to sign
* \param dgstlen length of the hash value
* \param sig buffer to hold the DER encoded signature
* \param siglen pointer to the length of the returned signature
* \param kinv BIGNUM with a pre-computed inverse k (optional)
* \param rp BIGNUM with a pre-computed rp value (optioanl),
* see ECDSA_sign_setup
* \param eckey EC_KEY object containing a private EC key
* \return 1 on success and 0 otherwise
*/
int
ECDSA_sign_ex
(
int
type
,
const
unsigned
char
*
dgst
,
int
dgstlen
,
unsigned
char
*
sig
,
unsigned
int
*
siglen
,
const
BIGNUM
*
kinv
,
const
BIGNUM
*
rp
,
EC_KEY
*
eckey
);
/** Verifies that the given signature is valid ECDSA signature
* of the supplied hash value using the specified public key.
* \param type this parameter is ignored
* \param dgst pointer to the hash value
* \param dgstlen length of the hash value
* \param sig pointer to the DER encoded signature
* \param siglen length of the DER encoded signature
* \param eckey EC_KEY object containing a public EC key
* \return 1 if the signature is valid, 0 if the signature is invalid
* and -1 on error
*/
int
ECDSA_verify
(
int
type
,
const
unsigned
char
*
dgst
,
int
dgstlen
,
const
unsigned
char
*
sig
,
int
siglen
,
EC_KEY
*
eckey
);
# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)
...
...
include/openssl/ecdsa.h
浏览文件 @
bd3602eb
...
...
@@ -136,59 +136,6 @@ int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
*/
int
ECDSA_size
(
const
EC_KEY
*
eckey
);
/** Precompute parts of the signing operation
* \param eckey EC_KEY object containing a private EC key
* \param ctx BN_CTX object (optional)
* \param kinv BIGNUM pointer for the inverse of k
* \param rp BIGNUM pointer for x coordinate of k * generator
* \return 1 on success and 0 otherwise
*/
int
ECDSA_sign_setup
(
EC_KEY
*
eckey
,
BN_CTX
*
ctx
,
BIGNUM
**
kinv
,
BIGNUM
**
rp
);
/** Computes ECDSA signature of a given hash value using the supplied
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
* \param type this parameter is ignored
* \param dgst pointer to the hash value to sign
* \param dgstlen length of the hash value
* \param sig memory for the DER encoded created signature
* \param siglen pointer to the length of the returned signature
* \param eckey EC_KEY object containing a private EC key
* \return 1 on success and 0 otherwise
*/
int
ECDSA_sign
(
int
type
,
const
unsigned
char
*
dgst
,
int
dgstlen
,
unsigned
char
*
sig
,
unsigned
int
*
siglen
,
EC_KEY
*
eckey
);
/** Computes ECDSA signature of a given hash value using the supplied
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
* \param type this parameter is ignored
* \param dgst pointer to the hash value to sign
* \param dgstlen length of the hash value
* \param sig buffer to hold the DER encoded signature
* \param siglen pointer to the length of the returned signature
* \param kinv BIGNUM with a pre-computed inverse k (optional)
* \param rp BIGNUM with a pre-computed rp value (optioanl),
* see ECDSA_sign_setup
* \param eckey EC_KEY object containing a private EC key
* \return 1 on success and 0 otherwise
*/
int
ECDSA_sign_ex
(
int
type
,
const
unsigned
char
*
dgst
,
int
dgstlen
,
unsigned
char
*
sig
,
unsigned
int
*
siglen
,
const
BIGNUM
*
kinv
,
const
BIGNUM
*
rp
,
EC_KEY
*
eckey
);
/** Verifies that the given signature is valid ECDSA signature
* of the supplied hash value using the specified public key.
* \param type this parameter is ignored
* \param dgst pointer to the hash value
* \param dgstlen length of the hash value
* \param sig pointer to the DER encoded signature
* \param siglen length of the DER encoded signature
* \param eckey EC_KEY object containing a public EC key
* \return 1 if the signature is valid, 0 if the signature is invalid
* and -1 on error
*/
int
ECDSA_verify
(
int
type
,
const
unsigned
char
*
dgst
,
int
dgstlen
,
const
unsigned
char
*
sig
,
int
siglen
,
EC_KEY
*
eckey
);
/* the standard ex_data functions */
#define ECDSA_get_ex_new_index(l, p, newf, dupf, freef) \
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ECDSA, l, p, newf, dupf, freef)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录