Update readme with build details, license clarifications, reorder macros
This commit is contained in:
parent
b5ec633650
commit
fe6b2c3cfd
29
README.md
29
README.md
@ -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
|
A code-generated single file header for
|
||||||
C library for ECDSA signatures and secret/public key operations on curve
|
[bitcoin-core/secp256k1](https://github.com/bitcoin-core/secp256k1), an
|
||||||
secp256k1.
|
optimized C library for ECDSA signatures and secret/public key operations on
|
||||||
|
curve secp256k1.
|
||||||
|
|
||||||
## Using bt\_secp256k1
|
## Using bt\_secp256k1
|
||||||
|
|
||||||
@ -24,8 +25,6 @@ definitive explanations).
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#define BT_SECP256K1_IMPLEMENTATION
|
#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_GEN_PREC_BITS 4
|
||||||
#define ECMULT_WINDOW_SIZE 15
|
#define ECMULT_WINDOW_SIZE 15
|
||||||
#include "bt_secp256k1_i64.h"
|
#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
|
The code generated header files vendored in the repository correspond to the
|
||||||
current commit hash checked out from the secp256k1 submodule.
|
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
|
An example program `bt_secp256k1_example.c` is provided that implements a basic
|
||||||
secp256k1 keypair generator for reference and testing the single header file
|
secp256k1 keypair generator for reference and testing the single header file
|
||||||
compilation.
|
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
|
## 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.
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
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,
|
software, either in source code form or as a compiled binary, for any purpose,
|
||||||
commercial or non-commercial, and by any means.
|
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.
|
||||||
|
@ -59,11 +59,16 @@ THE SOFTWARE.
|
|||||||
// NOTE: Example
|
// NOTE: Example
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
#if 0
|
#if 0
|
||||||
#define BT_SECP256K1_IMPLEMENTATION
|
|
||||||
// NOTE: The 2 following defines are optional! We provide a default value if
|
// NOTE: The 2 following defines are optional! We provide a default value if
|
||||||
// these are not defined before the implementation
|
// these are not defined before the implementation
|
||||||
#define ECMULT_GEN_PREC_BITS 4
|
#define ECMULT_GEN_PREC_BITS 4
|
||||||
#define ECMULT_WINDOW_SIZE 15
|
#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 "bt_secp256k1_i128.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -59,11 +59,16 @@ THE SOFTWARE.
|
|||||||
// NOTE: Example
|
// NOTE: Example
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
#if 0
|
#if 0
|
||||||
#define BT_SECP256K1_IMPLEMENTATION
|
|
||||||
// NOTE: The 2 following defines are optional! We provide a default value if
|
// NOTE: The 2 following defines are optional! We provide a default value if
|
||||||
// these are not defined before the implementation
|
// these are not defined before the implementation
|
||||||
#define ECMULT_GEN_PREC_BITS 4
|
#define ECMULT_GEN_PREC_BITS 4
|
||||||
#define ECMULT_WINDOW_SIZE 15
|
#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 "bt_secp256k1_i128_x86_64_asm.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -59,11 +59,16 @@ THE SOFTWARE.
|
|||||||
// NOTE: Example
|
// NOTE: Example
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
#if 0
|
#if 0
|
||||||
#define BT_SECP256K1_IMPLEMENTATION
|
|
||||||
// NOTE: The 2 following defines are optional! We provide a default value if
|
// NOTE: The 2 following defines are optional! We provide a default value if
|
||||||
// these are not defined before the implementation
|
// these are not defined before the implementation
|
||||||
#define ECMULT_GEN_PREC_BITS 4
|
#define ECMULT_GEN_PREC_BITS 4
|
||||||
#define ECMULT_WINDOW_SIZE 15
|
#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 "bt_secp256k1_i64.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -465,11 +465,16 @@ int main(int argc, char *argv[])
|
|||||||
"// NOTE: Example\n"
|
"// NOTE: Example\n"
|
||||||
"// -----------------------------------------------------------------------------\n"
|
"// -----------------------------------------------------------------------------\n"
|
||||||
"#if 0\n"
|
"#if 0\n"
|
||||||
"#define BT_SECP256K1_IMPLEMENTATION\n"
|
|
||||||
"// NOTE: The 2 following defines are optional! We provide a default value if\n"
|
"// NOTE: The 2 following defines are optional! We provide a default value if\n"
|
||||||
"// these are not defined before the implementation\n"
|
"// these are not defined before the implementation\n"
|
||||||
"#define ECMULT_GEN_PREC_BITS 4\n"
|
"#define ECMULT_GEN_PREC_BITS 4\n"
|
||||||
"#define ECMULT_WINDOW_SIZE 15\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 \""
|
"#include \""
|
||||||
));
|
));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user