commit e79659ba3e1387fa2cb5c73d819a2a9625a4efe8
parent d8f52a71f12f7e9c641d20d223c49901065531ad
Author: Jared Tobin <jared@jtobin.io>
Date: Sat, 24 Feb 2024 17:02:42 +0400
Remove patch to vendored code.
Following the last commit, I still observe some compiling/linking
strangeness.
Previously I'd preserved part of the patch used in rust-secp256k1 as
I'd encountered duplicate symbol errors in linking without it. However,
wiping the build (dist-newstyle) directory and building with unpatched
source works fine.
I then encountered the same problem "resolved" in the last commit
when using the ECDH module again, but it seemed to go away. Possibly
nondeterministic.
Diffstat:
4 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/secp256k1-sys/depend/secp256k1.h.patch b/secp256k1-sys/depend/secp256k1.h.patch
@@ -1,9 +0,0 @@
-236d235
-< SECP256K1_API const secp256k1_context *secp256k1_context_static;
-239,240d237
-< SECP256K1_API const secp256k1_context *secp256k1_context_no_precomp
-< SECP256K1_DEPRECATED("Use secp256k1_context_static instead");
-636d610
-< SECP256K1_API const secp256k1_nonce_function secp256k1_nonce_function_rfc6979;
-639d612
-< SECP256K1_API const secp256k1_nonce_function secp256k1_nonce_function_default;
diff --git a/secp256k1-sys/depend/secp256k1/include/secp256k1.h b/secp256k1-sys/depend/secp256k1/include/secp256k1.h
@@ -233,8 +233,11 @@ typedef int (*haskellsecp256k1_v0_1_0_nonce_function)(
*
* It is highly recommended to call haskellsecp256k1_v0_1_0_selftest before using this context.
*/
+SECP256K1_API const haskellsecp256k1_v0_1_0_context *haskellsecp256k1_v0_1_0_context_static;
/** Deprecated alias for haskellsecp256k1_v0_1_0_context_static. */
+SECP256K1_API const haskellsecp256k1_v0_1_0_context *haskellsecp256k1_v0_1_0_context_no_precomp
+SECP256K1_DEPRECATED("Use haskellsecp256k1_v0_1_0_context_static instead");
/** Perform basic self tests (to be used in conjunction with haskellsecp256k1_v0_1_0_context_static)
*
@@ -630,8 +633,10 @@ SECP256K1_API int haskellsecp256k1_v0_1_0_ecdsa_signature_normalize(
* If a data pointer is passed, it is assumed to be a pointer to 32 bytes of
* extra entropy.
*/
+SECP256K1_API const haskellsecp256k1_v0_1_0_nonce_function haskellsecp256k1_v0_1_0_nonce_function_rfc6979;
/** A default safe nonce generation function (currently equal to haskellsecp256k1_v0_1_0_nonce_function_rfc6979). */
+SECP256K1_API const haskellsecp256k1_v0_1_0_nonce_function haskellsecp256k1_v0_1_0_nonce_function_default;
/** Create an ECDSA signature.
*
diff --git a/secp256k1-sys/test/Main.hs b/secp256k1-sys/test/Main.hs
@@ -62,7 +62,7 @@ units = testGroup "unit tests" [
, ecdsa_sign
, ecdsa_verify_compressed
, ecdsa_verify_uncompressed
- -- , ecdh_test
+ , ecdh_test
]
wcontext :: (Ptr Context -> IO a) -> IO a
@@ -161,14 +161,12 @@ ecdsa_verify_uncompressed =
-- ecdh
--- XX getting dyld error when trying to run
---
--- ecdh_test :: TestTree
--- ecdh_test = testCase "secp256k1_ecdh (success)" $
--- wcontext $ \tex -> do
--- -- throws on failure, so any return implies success
--- _ <- ecdh tex _PUB_COMPRESSED _SEC
--- assertBool "success" True
+ecdh_test :: TestTree
+ecdh_test = testCase "secp256k1_ecdh (success)" $
+ wcontext $ \tex -> do
+ -- throws on failure, so any return implies success
+ _ <- ecdh tex _PUB_COMPRESSED _SEC
+ assertBool "success" True
-- wrappers
diff --git a/secp256k1-sys/vendor-libsecp.sh b/secp256k1-sys/vendor-libsecp.sh
@@ -92,10 +92,6 @@ popd
echo "# This file was automatically created by $(basename "$0")" > ./secp256k1-HEAD-revision.txt
echo "$SOURCE_REV" >> ./secp256k1-HEAD-revision.txt
-# Patch out unused stuff that leads to duplicate object linking errors
-
-patch "$DIR/include/secp256k1.h" "./secp256k1.h.patch"
-
# Prefix all methods with haskellsecp and a version prefix
find "$DIR" \
-not -path '*/\.*' \