Update readme with build details, license clarifications, reorder macros

This commit is contained in:
doyle 2022-01-24 23:07:43 +11:00
parent b5ec633650
commit fe6b2c3cfd
5 changed files with 44 additions and 13 deletions

View File

@ -1,8 +1,9 @@
# Blockchain Tools - secp256k1 (bt\_secp256k1)
# bt\_secp256k1 (Blockchain Tools - secp256k1)
A code-generated single file header for bitcoin-core/secp256k1, an optimized
C library for ECDSA signatures and secret/public key operations on curve
secp256k1.
A code-generated single file header for
[bitcoin-core/secp256k1](https://github.com/bitcoin-core/secp256k1), an
optimized C library for ECDSA signatures and secret/public key operations on
curve secp256k1.
## Using bt\_secp256k1
@ -24,8 +25,6 @@ definitive explanations).
```cpp
#define BT_SECP256K1_IMPLEMENTATION
// NOTE: The 2 following defines are optional! We provide a default value if
// these are not defined before the implementation
#define ECMULT_GEN_PREC_BITS 4
#define ECMULT_WINDOW_SIZE 15
#include "bt_secp256k1_i64.h"
@ -40,17 +39,29 @@ combined into a single header file, generating the output files.
The code generated header files vendored in the repository correspond to the
current commit hash checked out from the secp256k1 submodule.
The single file header code-generator metaprogram is provided under the
Unlicense license.
An example program `bt_secp256k1_example.c` is provided that implements a basic
secp256k1 keypair generator for reference and testing the single header file
compilation.
## Build
The build is currently tested on Windows Visual Studio 2019's `cl` via
`build.bat` which will build the metaprogram and generate the single header
files.
Examples are built using `build_examples.bat` and optionally invoke `clang-cl`
if it's available on the path.
## License
The single file header code-generator metaprogram is provided under the
Unlicense license.
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
bitcoin-core/secp256k1 is provided under its original license and is embedded in
the single-file-header.

View File

@ -59,11 +59,16 @@ THE SOFTWARE.
// NOTE: Example
// -----------------------------------------------------------------------------
#if 0
#define BT_SECP256K1_IMPLEMENTATION
// NOTE: The 2 following defines are optional! We provide a default value if
// these are not defined before the implementation
#define ECMULT_GEN_PREC_BITS 4
#define ECMULT_WINDOW_SIZE 15
// NOTE: The module defines are optional! They expose optional secp256k1 modules API
#define ENABLE_MODULE_ECDH
#define ENABLE_MODULE_RECOVERY
#define ENABLE_MODULE_EXTRAKEYS
#define ENABLE_MODULE_SCHNORRSIG
#define BT_SECP256K1_IMPLEMENTATION
#include "bt_secp256k1_i128.h"
#include <stdio.h>

View File

@ -59,11 +59,16 @@ THE SOFTWARE.
// NOTE: Example
// -----------------------------------------------------------------------------
#if 0
#define BT_SECP256K1_IMPLEMENTATION
// NOTE: The 2 following defines are optional! We provide a default value if
// these are not defined before the implementation
#define ECMULT_GEN_PREC_BITS 4
#define ECMULT_WINDOW_SIZE 15
// NOTE: The module defines are optional! They expose optional secp256k1 modules API
#define ENABLE_MODULE_ECDH
#define ENABLE_MODULE_RECOVERY
#define ENABLE_MODULE_EXTRAKEYS
#define ENABLE_MODULE_SCHNORRSIG
#define BT_SECP256K1_IMPLEMENTATION
#include "bt_secp256k1_i128_x86_64_asm.h"
#include <stdio.h>

View File

@ -59,11 +59,16 @@ THE SOFTWARE.
// NOTE: Example
// -----------------------------------------------------------------------------
#if 0
#define BT_SECP256K1_IMPLEMENTATION
// NOTE: The 2 following defines are optional! We provide a default value if
// these are not defined before the implementation
#define ECMULT_GEN_PREC_BITS 4
#define ECMULT_WINDOW_SIZE 15
// NOTE: The module defines are optional! They expose optional secp256k1 modules API
#define ENABLE_MODULE_ECDH
#define ENABLE_MODULE_RECOVERY
#define ENABLE_MODULE_EXTRAKEYS
#define ENABLE_MODULE_SCHNORRSIG
#define BT_SECP256K1_IMPLEMENTATION
#include "bt_secp256k1_i64.h"
#include <stdio.h>

View File

@ -465,11 +465,16 @@ int main(int argc, char *argv[])
"// NOTE: Example\n"
"// -----------------------------------------------------------------------------\n"
"#if 0\n"
"#define BT_SECP256K1_IMPLEMENTATION\n"
"// NOTE: The 2 following defines are optional! We provide a default value if\n"
"// these are not defined before the implementation\n"
"#define ECMULT_GEN_PREC_BITS 4\n"
"#define ECMULT_WINDOW_SIZE 15\n"
"// NOTE: The module defines are optional! They expose optional secp256k1 modules API\n"
"#define ENABLE_MODULE_ECDH\n"
"#define ENABLE_MODULE_RECOVERY\n"
"#define ENABLE_MODULE_EXTRAKEYS\n"
"#define ENABLE_MODULE_SCHNORRSIG\n"
"#define BT_SECP256K1_IMPLEMENTATION\n"
"#include \""
));