mirror of
https://github.com/jb55/nostril.git
synced 2024-12-24 11:15:51 -05:00
embed libsecp256k1 build
don't rely on external deps Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
parent
098f639f46
commit
e8fd862590
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "deps/secp256k1"]
|
||||
path = deps/secp256k1
|
||||
url = https://github.com/bitcoin-core/secp256k1
|
36
Makefile
36
Makefile
|
@ -1,17 +1,40 @@
|
|||
|
||||
CFLAGS = -Wall -Og
|
||||
CFLAGS = -Wall -Og -Ideps/secp256k1/include
|
||||
OBJS = sha256.o nostril.o aes.o base64.o
|
||||
HEADERS = hex.h random.h config.h sha256.h
|
||||
HEADERS = hex.h random.h config.h sha256.h deps/secp256k1/include/secp256k1.h
|
||||
PREFIX ?= /usr/local
|
||||
ARS = libsecp256k1.a
|
||||
|
||||
SUBMODULES = deps/secp256k1
|
||||
|
||||
all: nostril
|
||||
|
||||
%.o: %.c config.h
|
||||
deps/secp256k1/.git:
|
||||
@devtools/refresh-submodules.sh $(SUBMODULES)
|
||||
|
||||
deps/secp256k1/include/secp256k1.h: deps/secp256k1/.git
|
||||
|
||||
deps/secp256k1/configure: deps/secp256k1/.git
|
||||
cd deps/secp256k1; \
|
||||
./autogen.sh
|
||||
|
||||
deps/secp256k1/config.log: deps/secp256k1/configure
|
||||
cd deps/secp256k1; \
|
||||
./configure --disable-shared --enable-module-ecdh --enable-module-schnorrsig --enable-module-extrakeys
|
||||
|
||||
deps/secp256k1/.libs/libsecp256k1.a: deps/secp256k1/config.log
|
||||
cd deps/secp256k1; \
|
||||
make -j libsecp256k1.la
|
||||
|
||||
libsecp256k1.a: deps/secp256k1/.libs/libsecp256k1.a
|
||||
cp $< $@
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
@echo "cc $<"
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
nostril: $(HEADERS) $(OBJS)
|
||||
$(CC) $(CFLAGS) $(OBJS) -lsecp256k1 -o $@
|
||||
nostril: $(HEADERS) $(OBJS) $(ARS)
|
||||
$(CC) $(CFLAGS) $(OBJS) $(ARS) -o $@
|
||||
|
||||
install: nostril
|
||||
mkdir -p $(PREFIX)/bin
|
||||
|
@ -24,7 +47,8 @@ configurator: configurator.c
|
|||
$(CC) $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f nostril *.o
|
||||
rm -f nostril *.o *.a
|
||||
rm -rf deps/secp256k1
|
||||
|
||||
tags: fake
|
||||
ctags *.c *.h
|
||||
|
|
1
deps/secp256k1
vendored
Submodule
1
deps/secp256k1
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 694ce8fb2d1fd8a3d641d7c33705691d41a2a860
|
|
@ -6,9 +6,9 @@
|
|||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <secp256k1.h>
|
||||
#include <secp256k1_ecdh.h>
|
||||
#include <secp256k1_schnorrsig.h>
|
||||
#include "secp256k1.h"
|
||||
#include "secp256k1_ecdh.h"
|
||||
#include "secp256k1_schnorrsig.h"
|
||||
|
||||
#include "cursor.h"
|
||||
#include "hex.h"
|
||||
|
@ -209,7 +209,7 @@ static int make_sig(secp256k1_context *ctx, struct key *key,
|
|||
return 0;
|
||||
}
|
||||
|
||||
return secp256k1_schnorrsig_sign(ctx, sig, id, &key->pair, aux);
|
||||
return secp256k1_schnorrsig_sign32(ctx, sig, id, &key->pair, aux);
|
||||
}
|
||||
|
||||
static int create_key(secp256k1_context *ctx, struct key *key)
|
||||
|
@ -603,7 +603,6 @@ static int make_encrypted_dm(secp256k1_context *ctx, struct key *key,
|
|||
if (enclen == 0) {
|
||||
fprintf(stderr, "make_encrypted_dm: aes_encrypt failed\n");
|
||||
free(buf);
|
||||
free(encbuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user