Skip to content

Commit

Permalink
Update depend folder to latest master
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibo-lg committed Sep 15, 2020
1 parent b2e315f commit a20447c
Show file tree
Hide file tree
Showing 87 changed files with 7,257 additions and 4,642 deletions.
2 changes: 1 addition & 1 deletion secp256k1-sys/depend/scratch_impl.h.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
13,37d12
< static secp256k1_scratch* secp256k1_scratch_create(const secp256k1_callback* error_callback, size_t size) {
< const size_t base_alloc = ((sizeof(secp256k1_scratch) + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT;
< const size_t base_alloc = ROUND_TO_ALIGN(sizeof(secp256k1_scratch));
< void *alloc = checked_malloc(error_callback, base_alloc + size);
< secp256k1_scratch* ret = (secp256k1_scratch *)alloc;
< if (ret != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion secp256k1-sys/depend/secp256k1-HEAD-revision.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This file was automatically created by ./vendor-libsecp.sh
670cdd3f8be25f81472b2d16dcd228b0d24a5c45
a0e99fc121cd7ef1793581effa0651f80abce1a5
4 changes: 3 additions & 1 deletion secp256k1-sys/depend/secp256k1/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
bench_inv
bench_ecdh
bench_ecmult
bench_schnorrsig
bench_sign
bench_verify
bench_schnorr_verify
bench_recover
bench_internal
tests
Expand Down Expand Up @@ -31,6 +31,8 @@ libtool
*.lo
*.o
*~
*.log
*.trs
src/libsecp256k1-config.h
src/libsecp256k1-config.h.in
src/ecmult_static_context.h
Expand Down
10 changes: 5 additions & 5 deletions secp256k1-sys/depend/secp256k1/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ compiler:
- gcc
env:
global:
- WIDEMUL=auto BIGNUM=auto ENDOMORPHISM=no STATICPRECOMPUTATION=yes ECMULTGENPRECISION=auto ASM=no BUILD=check EXTRAFLAGS= HOST= ECDH=no RECOVERY=no EXPERIMENTAL=no CTIMETEST=yes BENCH=yes ITERS=2
- WIDEMUL=auto BIGNUM=auto ENDOMORPHISM=no STATICPRECOMPUTATION=yes ECMULTGENPRECISION=auto ASM=no BUILD=check EXTRAFLAGS= HOST= ECDH=no RECOVERY=no SCHNORRSIG=no EXPERIMENTAL=no CTIMETEST=yes BENCH=yes ITERS=2
matrix:
- WIDEMUL=int64 RECOVERY=yes
- WIDEMUL=int64 ECDH=yes EXPERIMENTAL=yes
- WIDEMUL=int64 ECDH=yes EXPERIMENTAL=yes SCHNORRSIG=yes
- WIDEMUL=int64 ENDOMORPHISM=yes
- WIDEMUL=int128
- WIDEMUL=int128 RECOVERY=yes
- WIDEMUL=int128 RECOVERY=yes EXPERIMENTAL=yes SCHNORRSIG=yes
- WIDEMUL=int128 ENDOMORPHISM=yes
- WIDEMUL=int128 ENDOMORPHISM=yes ECDH=yes EXPERIMENTAL=yes
- WIDEMUL=int128 ENDOMORPHISM=yes ECDH=yes EXPERIMENTAL=yes SCHNORRSIG=yes
- WIDEMUL=int128 ASM=x86_64
- WIDEMUL=int128 ENDOMORPHISM=yes ASM=x86_64
- BIGNUM=no
- BIGNUM=no ENDOMORPHISM=yes RECOVERY=yes EXPERIMENTAL=yes
- BIGNUM=no ENDOMORPHISM=yes RECOVERY=yes EXPERIMENTAL=yes SCHNORRSIG=yes
- BIGNUM=no STATICPRECOMPUTATION=no
- BUILD=distcheck CTIMETEST= BENCH=
- CPPFLAGS=-DDETERMINISTIC
Expand Down
25 changes: 17 additions & 8 deletions secp256k1-sys/depend/secp256k1/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I build-aux/m4

lib_LTLIBRARIES = libsecp256k1.la
include_HEADERS = include/secp256k1.h
include_HEADERS += include/rustsecp256k1_v0_2_0_preallocated.h
include_HEADERS += include/rustsecp256k1_v0_2_1_preallocated.h
noinst_HEADERS =
noinst_HEADERS += src/scalar.h
noinst_HEADERS += src/scalar_4x64.h
Expand Down Expand Up @@ -38,6 +38,7 @@ noinst_HEADERS += src/assumptions.h
noinst_HEADERS += src/util.h
noinst_HEADERS += src/scratch.h
noinst_HEADERS += src/scratch_impl.h
noinst_HEADERS += src/selftest.h
noinst_HEADERS += src/testrand.h
noinst_HEADERS += src/testrand_impl.h
noinst_HEADERS += src/hash.h
Expand All @@ -51,7 +52,7 @@ noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c

if USE_EXTERNAL_ASM
COMMON_LIB = librustsecp256k1_v0_2_0_common.la
COMMON_LIB = librustsecp256k1_v0_2_1_common.la
noinst_LTLIBRARIES = $(COMMON_LIB)
else
COMMON_LIB =
Expand All @@ -62,16 +63,16 @@ pkgconfig_DATA = libsecp256k1.pc

if USE_EXTERNAL_ASM
if USE_ASM_ARM
librustsecp256k1_v0_2_0_common_la_SOURCES = src/asm/field_10x26_arm.s
librustsecp256k1_v0_2_1_common_la_SOURCES = src/asm/field_10x26_arm.s
endif
endif

librustsecp256k1_v0_2_0_la_SOURCES = src/secp256k1.c
librustsecp256k1_v0_2_0_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
librustsecp256k1_v0_2_0_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB)
librustsecp256k1_v0_2_1_la_SOURCES = src/secp256k1.c
librustsecp256k1_v0_2_1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
librustsecp256k1_v0_2_1_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB)

if VALGRIND_ENABLED
librustsecp256k1_v0_2_0_la_CPPFLAGS += -DVALGRIND
librustsecp256k1_v0_2_1_la_CPPFLAGS += -DVALGRIND
endif

noinst_PROGRAMS =
Expand Down Expand Up @@ -133,7 +134,7 @@ gen_%.o: src/gen_%.c src/libsecp256k1-config.h
$(gen_context_BIN): $(gen_context_OBJECTS)
$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $^ -o $@

$(librustsecp256k1_v0_2_0_la_OBJECTS): src/ecmult_static_context.h
$(librustsecp256k1_v0_2_1_la_OBJECTS): src/ecmult_static_context.h
$(tests_OBJECTS): src/ecmult_static_context.h
$(bench_internal_OBJECTS): src/ecmult_static_context.h
$(bench_ecmult_OBJECTS): src/ecmult_static_context.h
Expand All @@ -153,3 +154,11 @@ endif
if ENABLE_MODULE_RECOVERY
include src/modules/recovery/Makefile.am.include
endif

if ENABLE_MODULE_EXTRAKEYS
include src/modules/extrakeys/Makefile.am.include
endif

if ENABLE_MODULE_SCHNORRSIG
include src/modules/schnorrsig/Makefile.am.include
endif
3 changes: 0 additions & 3 deletions secp256k1-sys/depend/secp256k1/TODO

This file was deleted.

33 changes: 33 additions & 0 deletions secp256k1-sys/depend/secp256k1/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ AC_ARG_ENABLE(module_recovery,
[enable_module_recovery=$enableval],
[enable_module_recovery=no])

AC_ARG_ENABLE(module_extrakeys,
AS_HELP_STRING([--enable-module-extrakeys],[enable extrakeys module (experimental)]),
[enable_module_extrakeys=$enableval],
[enable_module_extrakeys=no])

AC_ARG_ENABLE(module_schnorrsig,
AS_HELP_STRING([--enable-module-schnorrsig],[enable schnorrsig module (experimental)]),
[enable_module_schnorrsig=$enableval],
[enable_module_schnorrsig=no])

AC_ARG_ENABLE(external_default_callbacks,
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]),
[use_external_default_callbacks=$enableval],
Expand Down Expand Up @@ -421,6 +431,17 @@ if test x"$enable_module_recovery" = x"yes"; then
AC_DEFINE(ENABLE_MODULE_RECOVERY, 1, [Define this symbol to enable the ECDSA pubkey recovery module])
fi

if test x"$enable_module_schnorrsig" = x"yes"; then
AC_DEFINE(ENABLE_MODULE_SCHNORRSIG, 1, [Define this symbol to enable the schnorrsig module])
enable_module_extrakeys=yes
fi

# Test if extrakeys is set after the schnorrsig module to allow the schnorrsig
# module to set enable_module_extrakeys=yes
if test x"$enable_module_extrakeys" = x"yes"; then
AC_DEFINE(ENABLE_MODULE_EXTRAKEYS, 1, [Define this symbol to enable the extrakeys module])
fi

if test x"$use_external_asm" = x"yes"; then
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
fi
Expand All @@ -434,11 +455,19 @@ if test x"$enable_experimental" = x"yes"; then
AC_MSG_NOTICE([WARNING: experimental build])
AC_MSG_NOTICE([Experimental features do not have stable APIs or properties, and may not be safe for production use.])
AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh])
AC_MSG_NOTICE([Building extrakeys module: $enable_module_extrakeys])
AC_MSG_NOTICE([Building schnorrsig module: $enable_module_schnorrsig])
AC_MSG_NOTICE([******])
else
if test x"$enable_module_ecdh" = x"yes"; then
AC_MSG_ERROR([ECDH module is experimental. Use --enable-experimental to allow.])
fi
if test x"$enable_module_extrakeys" = x"yes"; then
AC_MSG_ERROR([extrakeys module is experimental. Use --enable-experimental to allow.])
fi
if test x"$enable_module_schnorrsig" = x"yes"; then
AC_MSG_ERROR([schnorrsig module is experimental. Use --enable-experimental to allow.])
fi
if test x"$set_asm" = x"arm"; then
AC_MSG_ERROR([ARM assembly optimization is experimental. Use --enable-experimental to allow.])
fi
Expand All @@ -457,6 +486,8 @@ AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
AM_CONDITIONAL([USE_ECMULT_STATIC_PRECOMPUTATION], [test x"$set_precomp" = x"yes"])
AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$use_external_asm" = x"yes"])
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm"])

Expand All @@ -476,6 +507,8 @@ echo " with benchmarks = $use_benchmark"
echo " with coverage = $enable_coverage"
echo " module ecdh = $enable_module_ecdh"
echo " module recovery = $enable_module_recovery"
echo " module extrakeys = $enable_module_extrakeys"
echo " module schnorrsig = $enable_module_schnorrsig"
echo
echo " asm = $set_asm"
echo " bignum = $set_bignum"
Expand Down
8 changes: 4 additions & 4 deletions secp256k1-sys/depend/secp256k1/contrib/lax_der_parsing.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

#include "lax_der_parsing.h"

int rustsecp256k1_v0_2_0_ecdsa_signature_parse_der_lax(const rustsecp256k1_v0_2_0_context* ctx, rustsecp256k1_v0_2_0_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) {
int rustsecp256k1_v0_2_1_ecdsa_signature_parse_der_lax(const rustsecp256k1_v0_2_1_context* ctx, rustsecp256k1_v0_2_1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) {
size_t rpos, rlen, spos, slen;
size_t pos = 0;
size_t lenbyte;
unsigned char tmpsig[64] = {0};
int overflow = 0;

/* Hack to initialize sig with a correctly-parsed but invalid signature. */
rustsecp256k1_v0_2_0_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
rustsecp256k1_v0_2_1_ecdsa_signature_parse_compact(ctx, sig, tmpsig);

/* Sequence tag byte */
if (pos == inputlen || input[pos] != 0x30) {
Expand Down Expand Up @@ -138,11 +138,11 @@ int rustsecp256k1_v0_2_0_ecdsa_signature_parse_der_lax(const rustsecp256k1_v0_2_
}

if (!overflow) {
overflow = !rustsecp256k1_v0_2_0_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
overflow = !rustsecp256k1_v0_2_1_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
}
if (overflow) {
memset(tmpsig, 0, 64);
rustsecp256k1_v0_2_0_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
rustsecp256k1_v0_2_1_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
}
return 1;
}
Expand Down
10 changes: 5 additions & 5 deletions secp256k1-sys/depend/secp256k1/contrib/lax_der_parsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* certain violations are easily supported. You may need to adapt it.
*
* Do not use this for new systems. Use well-defined DER or compact signatures
* instead if you have the choice (see rustsecp256k1_v0_2_0_ecdsa_signature_parse_der and
* rustsecp256k1_v0_2_0_ecdsa_signature_parse_compact).
* instead if you have the choice (see rustsecp256k1_v0_2_1_ecdsa_signature_parse_der and
* rustsecp256k1_v0_2_1_ecdsa_signature_parse_compact).
*
* The supported violations are:
* - All numbers are parsed as nonnegative integers, even though X.609-0207
Expand Down Expand Up @@ -77,9 +77,9 @@ extern "C" {
* encoded numbers are out of range, signature validation with it is
* guaranteed to fail for every message and public key.
*/
int rustsecp256k1_v0_2_0_ecdsa_signature_parse_der_lax(
const rustsecp256k1_v0_2_0_context* ctx,
rustsecp256k1_v0_2_0_ecdsa_signature* sig,
int rustsecp256k1_v0_2_1_ecdsa_signature_parse_der_lax(
const rustsecp256k1_v0_2_1_context* ctx,
rustsecp256k1_v0_2_1_ecdsa_signature* sig,
const unsigned char *input,
size_t inputlen
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "lax_der_privatekey_parsing.h"

int ec_privkey_import_der(const rustsecp256k1_v0_2_0_context* ctx, unsigned char *out32, const unsigned char *privkey, size_t privkeylen) {
int ec_privkey_import_der(const rustsecp256k1_v0_2_1_context* ctx, unsigned char *out32, const unsigned char *privkey, size_t privkeylen) {
const unsigned char *end = privkey + privkeylen;
int lenb = 0;
int len = 0;
Expand Down Expand Up @@ -46,17 +46,17 @@ int ec_privkey_import_der(const rustsecp256k1_v0_2_0_context* ctx, unsigned char
return 0;
}
memcpy(out32 + 32 - privkey[1], privkey + 2, privkey[1]);
if (!rustsecp256k1_v0_2_0_ec_seckey_verify(ctx, out32)) {
if (!rustsecp256k1_v0_2_1_ec_seckey_verify(ctx, out32)) {
memset(out32, 0, 32);
return 0;
}
return 1;
}

int ec_privkey_export_der(const rustsecp256k1_v0_2_0_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) {
rustsecp256k1_v0_2_0_pubkey pubkey;
int ec_privkey_export_der(const rustsecp256k1_v0_2_1_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) {
rustsecp256k1_v0_2_1_pubkey pubkey;
size_t pubkeylen = 0;
if (!rustsecp256k1_v0_2_0_ec_pubkey_create(ctx, &pubkey, key32)) {
if (!rustsecp256k1_v0_2_1_ec_pubkey_create(ctx, &pubkey, key32)) {
*privkeylen = 0;
return 0;
}
Expand All @@ -80,7 +80,7 @@ int ec_privkey_export_der(const rustsecp256k1_v0_2_0_context *ctx, unsigned char
memcpy(ptr, key32, 32); ptr += 32;
memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle);
pubkeylen = 33;
rustsecp256k1_v0_2_0_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED);
rustsecp256k1_v0_2_1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED);
ptr += pubkeylen;
*privkeylen = ptr - privkey;
} else {
Expand All @@ -105,7 +105,7 @@ int ec_privkey_export_der(const rustsecp256k1_v0_2_0_context *ctx, unsigned char
memcpy(ptr, key32, 32); ptr += 32;
memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle);
pubkeylen = 65;
rustsecp256k1_v0_2_0_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_UNCOMPRESSED);
rustsecp256k1_v0_2_1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_UNCOMPRESSED);
ptr += pubkeylen;
*privkeylen = ptr - privkey;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ extern "C" {
* simple 32-byte private keys are sufficient.
*
* Note that this function does not guarantee correct DER output. It is
* guaranteed to be parsable by rustsecp256k1_v0_2_0_ec_privkey_import_der
* guaranteed to be parsable by rustsecp256k1_v0_2_1_ec_privkey_import_der
*/
SECP256K1_WARN_UNUSED_RESULT int ec_privkey_export_der(
const rustsecp256k1_v0_2_0_context* ctx,
const rustsecp256k1_v0_2_1_context* ctx,
unsigned char *privkey,
size_t *privkeylen,
const unsigned char *seckey,
Expand All @@ -77,7 +77,7 @@ SECP256K1_WARN_UNUSED_RESULT int ec_privkey_export_der(
* key.
*/
SECP256K1_WARN_UNUSED_RESULT int ec_privkey_import_der(
const rustsecp256k1_v0_2_0_context* ctx,
const rustsecp256k1_v0_2_1_context* ctx,
unsigned char *seckey,
const unsigned char *privkey,
size_t privkeylen
Expand Down
5 changes: 5 additions & 0 deletions secp256k1-sys/depend/secp256k1/contrib/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fi
--with-test-override-wide-multiply="$WIDEMUL" --with-bignum="$BIGNUM" --with-asm="$ASM" \
--enable-ecmult-static-precomputation="$STATICPRECOMPUTATION" --with-ecmult-gen-precision="$ECMULTGENPRECISION" \
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
--enable-module-schnorrsig="$SCHNORRSIG" \
--host="$HOST" $EXTRAFLAGS

if [ -n "$BUILD" ]
Expand Down Expand Up @@ -55,6 +56,10 @@ then
then
$EXEC ./bench_ecdh >> bench.log 2>&1
fi
if [ "$SCHNORRSIG" = "yes" ]
then
$EXEC ./bench_schnorrsig >> bench.log 2>&1
fi
fi
if [ -n "$CTIMETEST" ]
then
Expand Down

0 comments on commit a20447c

Please sign in to comment.