Commit bd3602eb authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Move and adapt ECDSA sign and verify functions.

parent cf70b8f5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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)

+0 −1
Original line number Diff line number Diff line
@@ -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"

+9 −10
Original line number Diff line number Diff line
/* crypto/ecdsa/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)
    if (eckey->meth->sign_sig)
        return eckey->meth->sign_sig(dgst, dlen, kinv, rp, eckey);
    return NULL;
    return ecdsa->meth->ecdsa_do_sign(dgst, dlen, kinv, rp, eckey);
}

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)
    if (eckey->meth->sign_setup)
        return eckey->meth->sign_setup(eckey, ctx_in, kinvp, rp);
    return 0;
    return ecdsa->meth->ecdsa_sign_setup(eckey, ctx_in, kinvp, rp);
}
+5 −5
Original line number Diff line number Diff line
@@ -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)
    if (eckey->meth->verify_sig)
        return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey);
    return 0;
    return ecdsa->meth->ecdsa_do_verify(dgst, dgst_len, sig, eckey);
}

/*-
+2 −27
Original line number Diff line number Diff line
@@ -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
Loading