From 65e8167079b9d7d3195436a78d6520ff47cf6780 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Mon, 5 Mar 2001 20:13:37 +0000 Subject: [PATCH] Move ec.h to ec2.h because it is not compatible with what we will use. Add EC vaporware: change relevant Makefiles and add some empty source files. "make update". --- Makefile.org | 2 +- apps/Makefile.ssl | 2 +- crypto/Makefile.ssl | 2 +- crypto/ec/.cvsignore | 2 + crypto/ec/Makefile.ssl | 101 +++++++++++++++++++++++++++++++++ crypto/ec/ec.c | 2 +- crypto/ec/ec.h | 126 ++++++++++++++++++++--------------------- crypto/ec/ec2.h | 85 +++++++++++++++++++++++++++ crypto/ec/ec_cvt.c | 59 +++++++++++++++++++ crypto/ec/ec_err.c | 92 ++++++++++++++++++++++++++++++ crypto/ec/ec_lcl.h | 55 ++++++++++++++++++ crypto/ec/ec_lib.c | 59 +++++++++++++++++++ crypto/ec/ec_mult.c | 59 +++++++++++++++++++ crypto/ec/ec_point.c | 2 +- crypto/err/err.c | 1 + crypto/err/err.h | 4 ++ crypto/err/openssl.ec | 1 + crypto/rand/rand.h | 7 +-- ssl/ssl.h | 2 +- ssl/ssl_err.c | 2 +- 20 files changed, 591 insertions(+), 74 deletions(-) create mode 100644 crypto/ec/.cvsignore create mode 100644 crypto/ec/Makefile.ssl create mode 100644 crypto/ec/ec2.h create mode 100644 crypto/ec/ec_cvt.c create mode 100644 crypto/ec/ec_err.c create mode 100644 crypto/ec/ec_lcl.h create mode 100644 crypto/ec/ec_lib.c create mode 100644 crypto/ec/ec_mult.c diff --git a/Makefile.org b/Makefile.org index 6a7af9d7f3..e638725df5 100644 --- a/Makefile.org +++ b/Makefile.org @@ -165,7 +165,7 @@ SHLIBDIRS= crypto ssl SDIRS= \ md2 md4 md5 sha mdc2 hmac ripemd \ des rc2 rc4 rc5 idea bf cast \ - bn rsa dsa dh dso engine rijndael \ + bn ec rsa dsa dh dso engine rijndael \ buffer bio stack lhash rand err objects \ evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp diff --git a/apps/Makefile.ssl b/apps/Makefile.ssl index 8a9c1c0626..22b529516c 100644 --- a/apps/Makefile.ssl +++ b/apps/Makefile.ssl @@ -955,7 +955,7 @@ speed.o: ../include/openssl/rijndael.h ../include/openssl/ripemd.h speed.o: ../include/openssl/rsa.h ../include/openssl/safestack.h speed.o: ../include/openssl/sha.h ../include/openssl/stack.h speed.o: ../include/openssl/symhacks.h ../include/openssl/x509.h -speed.o: ../include/openssl/x509_vfy.h apps.h speed.c testdsa.h testrsa.h +speed.o: ../include/openssl/x509_vfy.h ./testdsa.h ./testrsa.h apps.h speed.c spkac.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h spkac.o: ../include/openssl/blowfish.h ../include/openssl/bn.h spkac.o: ../include/openssl/buffer.h ../include/openssl/cast.h diff --git a/crypto/Makefile.ssl b/crypto/Makefile.ssl index 0097bdd28f..b034581970 100644 --- a/crypto/Makefile.ssl +++ b/crypto/Makefile.ssl @@ -28,7 +28,7 @@ LIBS= SDIRS= md2 md5 sha mdc2 hmac ripemd \ des rc2 rc4 rc5 idea bf cast \ - bn rsa dsa dh dso engine rijndael \ + bn ec rsa dsa dh dso engine rijndael \ buffer bio stack lhash rand err objects \ evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp diff --git a/crypto/ec/.cvsignore b/crypto/ec/.cvsignore new file mode 100644 index 0000000000..c6d03a9dbc --- /dev/null +++ b/crypto/ec/.cvsignore @@ -0,0 +1,2 @@ +lib +Makefile.save diff --git a/crypto/ec/Makefile.ssl b/crypto/ec/Makefile.ssl new file mode 100644 index 0000000000..f3af851250 --- /dev/null +++ b/crypto/ec/Makefile.ssl @@ -0,0 +1,101 @@ +# +# crypto/ec/Makefile +# + +DIR= ec +TOP= ../.. +CC= cc +INCLUDES= -I.. -I$(TOP) -I../../include +CFLAG=-g +INSTALL_PREFIX= +OPENSSLDIR= /usr/local/ssl +INSTALLTOP=/usr/local/ssl +MAKE= make -f Makefile.ssl +MAKEDEPPROG= makedepend +MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) +MAKEFILE= Makefile.ssl +AR= ar r + +CFLAGS= $(INCLUDES) $(CFLAG) + +GENERAL=Makefile +TEST=ectest.c +APPS= + +LIB=$(TOP)/libcrypto.a +LIBSRC= ec_lib.c ecp_smpl.c ecp_mont.c ecp_recp.c ec_cvt.c ec_mult.c + +LIBOBJ= ec_lib.o ecp_smpl.o ecp_mont.o ecp_recp.o ec_cvt.o ec_mult.o + +SRC= $(LIBSRC) + +EXHEADER= ec.h +HEADER= ec_lcl.h $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +top: + (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) + +all: lib + +lib: $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) + @echo You may get an error following this line. Please ignore. + - $(RANLIB) $(LIB) + @touch lib + +files: + $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO + +links: + @$(TOP)/util/point.sh Makefile.ssl Makefile + @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) + @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) + @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) + +install: + @for i in $(EXHEADER) ; \ + do \ + (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ + chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ + done; + +tags: + ctags $(SRC) + +tests: + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) + +dclean: + $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + +# DO NOT DELETE THIS LINE -- make depend depends on it. + +ec_cvt.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h +ec_cvt.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h +ec_cvt.o: ec_cvt.c ec_lcl.h +ec_lib.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h +ec_lib.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h +ec_lib.o: ec_lcl.h ec_lib.c +ec_mult.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h +ec_mult.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h +ec_mult.o: ec_lcl.h ec_mult.c +ecp_mont.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h +ecp_mont.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h +ecp_mont.o: ec_lcl.h ecp_mont.c +ecp_recp.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h +ecp_recp.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h +ecp_recp.o: ec_lcl.h ecp_recp.c +ecp_smpl.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h +ecp_smpl.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h +ecp_smpl.o: ec_lcl.h ecp_smpl.c diff --git a/crypto/ec/ec.c b/crypto/ec/ec.c index c7a1bb013c..faf7c75b06 100644 --- a/crypto/ec/ec.c +++ b/crypto/ec/ec.c @@ -14,7 +14,7 @@ #include #include -#include "ec.h" +#include "ec2.h" diff --git a/crypto/ec/ec.h b/crypto/ec/ec.h index eb1ce0c494..a1e7e57460 100644 --- a/crypto/ec/ec.h +++ b/crypto/ec/ec.h @@ -1,85 +1,85 @@ -/* +/* TODO */ +/* crypto/ec/ec.h */ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. * - * ec.h + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: * - * Elliptic Curve Arithmetic Functions + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. * - * Copyright (C) Lenka Fibikova 2000 + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). * */ - #ifndef HEADER_EC_H #define HEADER_EC_H - #include -#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)) +#ifdef __cplusplus +extern "C" { +#endif -#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); +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ -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); +/* Error codes for the EC functions. */ -#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 */ +/* Function codes. */ -#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 */ +/* Reason codes. */ +#ifdef __cplusplus +} +#endif #endif + diff --git a/crypto/ec/ec2.h b/crypto/ec/ec2.h new file mode 100644 index 0000000000..eb1ce0c494 --- /dev/null +++ b/crypto/ec/ec2.h @@ -0,0 +1,85 @@ +/* + * + * ec.h + * + * Elliptic Curve Arithmetic Functions + * + * Copyright (C) Lenka Fibikova 2000 + * + * + */ + + +#ifndef HEADER_EC_H +#define HEADER_EC_H + + +#include +#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 diff --git a/crypto/ec/ec_cvt.c b/crypto/ec/ec_cvt.c new file mode 100644 index 0000000000..989f366053 --- /dev/null +++ b/crypto/ec/ec_cvt.c @@ -0,0 +1,59 @@ +/* TODO */ +/* crypto/ec/ec_cvt.c */ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include + +#include "ec_lcl.h" diff --git a/crypto/ec/ec_err.c b/crypto/ec/ec_err.c new file mode 100644 index 0000000000..6c2af969d1 --- /dev/null +++ b/crypto/ec/ec_err.c @@ -0,0 +1,92 @@ +/* crypto/ec/ec_err.c */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +/* NOTE: this file was auto generated by the mkerr.pl script: any changes + * made to it will be overwritten when the script next updates this file, + * only reason strings will be preserved. + */ + +#include +#include +#include + +/* BEGIN ERROR CODES */ +#ifndef OPENSSL_NO_ERR +static ERR_STRING_DATA EC_str_functs[]= + { +{0,NULL} + }; + +static ERR_STRING_DATA EC_str_reasons[]= + { +{0,NULL} + }; + +#endif + +void ERR_load_EC_strings(void) + { + static int init=1; + + if (init) + { + init=0; +#ifndef OPENSSL_NO_ERR + ERR_load_strings(ERR_LIB_EC,EC_str_functs); + ERR_load_strings(ERR_LIB_EC,EC_str_reasons); +#endif + + } + } diff --git a/crypto/ec/ec_lcl.h b/crypto/ec/ec_lcl.h new file mode 100644 index 0000000000..99809fb0e3 --- /dev/null +++ b/crypto/ec/ec_lcl.h @@ -0,0 +1,55 @@ +/* TODO */ +/* crypto/ec/ec_lcl.h */ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c new file mode 100644 index 0000000000..de6c8ab661 --- /dev/null +++ b/crypto/ec/ec_lib.c @@ -0,0 +1,59 @@ +/* TODO */ +/* crypto/ec/ec_lib.c */ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include + +#include "ec_lcl.h" diff --git a/crypto/ec/ec_mult.c b/crypto/ec/ec_mult.c new file mode 100644 index 0000000000..88bd22ca31 --- /dev/null +++ b/crypto/ec/ec_mult.c @@ -0,0 +1,59 @@ +/* TODO */ +/* crypto/ec/ec_mult.c */ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include + +#include "ec_lcl.h" diff --git a/crypto/ec/ec_point.c b/crypto/ec/ec_point.c index 11c4aac332..8bab20a01e 100644 --- a/crypto/ec/ec_point.c +++ b/crypto/ec/ec_point.c @@ -17,7 +17,7 @@ #include #include "../bn/bn_mont2.h" /* XXX */ -#include "ec.h" +#include "ec2.h" EC_POINT *ECP_new() diff --git a/crypto/err/err.c b/crypto/err/err.c index 4f7a2ce4ac..2d8b5f62af 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -164,6 +164,7 @@ static ERR_STRING_DATA ERR_str_libraries[]= {ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"}, {ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"}, {ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"}, +{ERR_PACK(ERR_LIB_EC,0,0) ,"EC routines"}, {0,NULL}, }; diff --git a/crypto/err/err.h b/crypto/err/err.h index 96a91c356b..2ca6b1b9f9 100644 --- a/crypto/err/err.h +++ b/crypto/err/err.h @@ -134,6 +134,7 @@ typedef struct err_state_st #define ERR_LIB_DSO 37 #define ERR_LIB_ENGINE 38 #define ERR_LIB_OCSP 39 +#define ERR_LIB_EC 40 #define ERR_LIB_USER 128 @@ -165,6 +166,7 @@ typedef struct err_state_st #define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),ERR_file_name,__LINE__) #define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),ERR_file_name,__LINE__) #define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),ERR_file_name,__LINE__) +#define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),ERR_file_name,__LINE__) /* Borland C seems too stupid to be able to shift and do longs in * the pre-processor :-( */ @@ -215,6 +217,8 @@ typedef struct err_state_st #define ERR_R_PKCS12_LIB ERR_LIB_PKCS12 #define ERR_R_DSO_LIB ERR_LIB_DSO #define ERR_R_ENGINE_LIB ERR_LIB_ENGINE +#define ERR_R_OCSP_LIB ERR_LIB_OCSP +#define ERR_R_EC_LIB ERR_LIB_EC /* fatal error */ #define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) diff --git a/crypto/err/openssl.ec b/crypto/err/openssl.ec index 717c6eeba1..dd4d832f61 100644 --- a/crypto/err/openssl.ec +++ b/crypto/err/openssl.ec @@ -1,6 +1,7 @@ L ERR NONE NONE L CRYPTO crypto/crypto.h crypto/cpt_err.c L BN crypto/bn/bn.h crypto/bn/bn_err.c +L EC crypto/ec/ec.h crypto/ec/ec_err.c L RSA crypto/rsa/rsa.h crypto/rsa/rsa_err.c L DSA crypto/dsa/dsa.h crypto/dsa/dsa_err.c L DSO crypto/dso/dso.h crypto/dso/dso_err.c diff --git a/crypto/rand/rand.h b/crypto/rand/rand.h index d4d8fbe910..fd090ea084 100644 --- a/crypto/rand/rand.h +++ b/crypto/rand/rand.h @@ -112,10 +112,6 @@ int RAND_event(UINT, WPARAM, LPARAM); #endif -#ifdef __cplusplus -} -#endif - /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. @@ -129,5 +125,8 @@ int RAND_event(UINT, WPARAM, LPARAM); /* Reason codes. */ #define RAND_R_PRNG_NOT_SEEDED 100 +#ifdef __cplusplus +} +#endif #endif diff --git a/ssl/ssl.h b/ssl/ssl.h index d3750f359b..d16b16cd0d 100644 --- a/ssl/ssl.h +++ b/ssl/ssl.h @@ -1551,10 +1551,10 @@ int SSL_COMP_add_compression_method(int id,char *cm); #define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 #define SSL_R_SSL_HANDSHAKE_FAILURE 229 #define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 -#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 1101 #define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 1102 #define SSL_R_SSL_SESSION_ID_CONFLICT 1103 #define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 +#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 1101 #define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231 #define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 #define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 diff --git a/ssl/ssl_err.c b/ssl/ssl_err.c index 133b6193cf..82b1b80446 100644 --- a/ssl/ssl_err.c +++ b/ssl/ssl_err.c @@ -366,10 +366,10 @@ static ERR_STRING_DATA SSL_str_reasons[]= {SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION,"ssl ctx has no default ssl version"}, {SSL_R_SSL_HANDSHAKE_FAILURE ,"ssl handshake failure"}, {SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS ,"ssl library has no ciphers"}, -{SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH ,"ssl session id has bad length"}, {SSL_R_SSL_SESSION_ID_CALLBACK_FAILED ,"ssl session id callback failed"}, {SSL_R_SSL_SESSION_ID_CONFLICT ,"ssl session id conflict"}, {SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG ,"ssl session id context too long"}, +{SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH ,"ssl session id has bad length"}, {SSL_R_SSL_SESSION_ID_IS_DIFFERENT ,"ssl session id is different"}, {SSL_R_TLSV1_ALERT_ACCESS_DENIED ,"tlsv1 alert access denied"}, {SSL_R_TLSV1_ALERT_DECODE_ERROR ,"tlsv1 alert decode error"}, -- 2.25.1