Skip to content

Commit

Permalink
Port fixes from bitcoin (#9)
Browse files Browse the repository at this point in the history
* Port some fixes from bitcoin:
Mark more assembly outputs as early clobber #1307
Use more volatile in temporarties #1303
save normalize_weak calls in secp256k1_gej_eq_x_var #1344
remove random_field_element_test and use random_fe_test instead
upgrade CI to ubuntu22

* revert a change in secp256k1_gej_neg which generated incorrect signature
fix compiler warnings in tests

* upgrade CI to ubuntu22

* review feedback - fix documentation
remove secp256k1_fe_normalize_weak from secp256k1_ge_is_valid_var
port random_fe_non_zero_test and its usage

* review feedback - refactor random_fe_test usage. prefer using random_fe_non_zero_test instead of loop
  • Loading branch information
Naviabheeman authored Jul 16, 2024
1 parent 782265f commit ab8bcb7
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 565 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on: [push, pull_request]
jobs:
linux:
name: "Linux"
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Build and test
run: |
./autogen.sh
Expand Down
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ noinst_HEADERS += src/field_10x26_impl.h
noinst_HEADERS += src/field_5x52.h
noinst_HEADERS += src/field_5x52_impl.h
noinst_HEADERS += src/field_5x52_int128_impl.h
noinst_HEADERS += src/field_5x52_asm_impl.h
noinst_HEADERS += src/java/org_bitcoin_NativeSecp256k1.h
noinst_HEADERS += src/java/org_bitcoin_Secp256k1Context.h
noinst_HEADERS += src/util.h
Expand Down
20 changes: 10 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_PREREQ([2.60])
AC_PREREQ([2.71])
AC_INIT([libsecp256k1],[0.1])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux/m4])
Expand All @@ -25,7 +25,7 @@ fi

AM_PROG_CC_C_O

AC_PROG_CC_C89
AC_PROG_CC
if test x"$ac_cv_prog_cc_c89" = x"no"; then
AC_MSG_ERROR([c89 compiler support required])
fi
Expand Down Expand Up @@ -149,7 +149,7 @@ AC_ARG_WITH([scalar], [AS_HELP_STRING([--with-scalar=64bit|32bit|auto],
[Specify scalar implementation. Default is auto])],[req_scalar=$withval], [req_scalar=auto])

AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto]
[Specify assembly optimizations to use. Default is auto (experimental: arm)])],[req_asm=$withval], [req_asm=auto])
[Specify assembly to use. Default is auto (experimental: arm)])],[req_asm=$withval], [req_asm=auto])

AC_CHECK_TYPES([__int128])

Expand Down Expand Up @@ -209,15 +209,15 @@ else
x86_64)
SECP_64BIT_ASM_CHECK
if test x"$has_64bit_asm" != x"yes"; then
AC_MSG_ERROR([x86_64 assembly optimization requested but not available])
AC_MSG_ERROR([x86_64 assembly requested but not available])
fi
;;
arm)
;;
no)
;;
*)
AC_MSG_ERROR([invalid assembly optimization selection])
AC_MSG_ERROR([invalid assembly selection])
;;
esac
fi
Expand Down Expand Up @@ -305,20 +305,20 @@ else
esac
fi

# select assembly optimization
# select assembly
use_external_asm=no

case $set_asm in
x86_64)
AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly optimizations])
AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly])
;;
arm)
use_external_asm=yes
;;
no)
;;
*)
AC_MSG_ERROR([invalid assembly optimizations])
AC_MSG_ERROR([invalid assembly selection])
;;
esac

Expand Down Expand Up @@ -442,7 +442,7 @@ if test x"$use_external_asm" = x"yes"; then
fi

AC_MSG_NOTICE([Using static precomputation: $set_precomp])
AC_MSG_NOTICE([Using assembly optimizations: $set_asm])
AC_MSG_NOTICE([Using assembly: $set_asm])
AC_MSG_NOTICE([Using field implementation: $set_field])
AC_MSG_NOTICE([Using bignum implementation: $set_bignum])
AC_MSG_NOTICE([Using scalar implementation: $set_scalar])
Expand All @@ -463,7 +463,7 @@ else
AC_MSG_ERROR([ECDH 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.])
AC_MSG_ERROR([ARM assembly is experimental. Use --enable-experimental to allow.])
fi
fi

Expand Down
Loading

0 comments on commit ab8bcb7

Please sign in to comment.