The secp256k1 Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The secp256k1 Reference Manual

This is the secp256k1 Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:01:48 2022 GMT+0.

Table of Contents


1 Introduction

cl-secp256k1

Common Lisp CFFI bindings to bitcoin-core/secp256k1 library that provides public-key cryptography over secp256k1 curve. secp256k1 signatures are used in Bitcoin, Ethereum and other blockchains.

Usage

Install secp256k1 library

See your package manager for installation instructions.

Note that basic build of secp256k1 supports only simple signing and verification and some features might not work such as recoverable signatures, public key comparisons, etc. For example, libsecp256k1 from ubuntu does not have functions for public key comparisons. Its always possible to build library from source to have all required features.

Example:

# Arch Linux
pacman -S libsecp256k1

# Ubuntu 
apt install libsecp256k1-dev 

# macos
brew tap cuber/homebrew-libsecp256k1
brew install libsecp256k1

Install CL bindings

This library is not on quicklisp.

  1. Clone this library to somewhere where asdf or quicklisp could find it (e.g. ~/common-lisp/)
  2. Load it to your image. (e.g. (ql:quickload "secp256k1"))

Use

Public and secret keys.

;; create secret key from 32 byte array
(secp256k1:make-secret-key #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1))

;; create public key from secret key
(secp256k1:public-key-create sec-key)

;; parse public key from bytes (see `public-key-serialize` for creating this byte array)
(secp256k1:public-key-parse 
	#(4 121 190 102 126 249 220 187 172 85 160 98 149 206 135 11 7 2 155 252 219 45
		206 40 217 89 242 129 91 22 248 23 152 72 58 218 119 38 163 196 101 93 164
		251 252 14 17 8 168 253 23 180 72 166 133 84 25 156 71 208 143 251 16 212 184))

Signatures and recoverable signatures.

There are 2 types of signatures and methods associated with them: signature* and recov-signature*. They both are created using secret key. Signature contains only R and S value and verification assumes knowledge of the public key. Recoverable signature contains R, S and V (recovery id which is 0-3) and recovery procedure returns public key that was used for signature creation.

;; signature
(secp256k1:signature-sign message-hash32 secret-key) ; => signature
(secp256k1:signature-verify signature message-hash32 public-key) ; => nil or t

;; recoverable signature
(secp256k1:recov-signature-sign message-hash32 secret-key) ; => recov-signature
(secp256k1:recov-signature-recover recov-signature message-hash32) ; => nil or public key

Serialization and parsing

public-key, signature, recov-signature has data field with internal byte field representation that should not be used for persistance, hashing, etc.

Instead each structure has *-parse, *-serialize methods for working with portable byte representations and *-destructure, *-from-components for creating more structured representations.

For example:

(secp256k1:public-key-destructure public-key)
;; =>
;; (:X
;;  #(121 190 102 126 249 220 187 172 85 160 98 149 206 135 11 7 2 155 252 219 45
;;    206 40 217 89 242 129 91 22 248 23 152)
;;  :Y
;;  #(72 58 218 119 38 163 196 101 93 164 251 252 14 17 8 168 253 23 180 72 166
;;    133 84 25 156 71 208 143 251 16 212 184))

Conditions

Library raises specific error conditions if signing and parsing fails.

Conditions:

incorrect-secret-key-error

public-key-parse-error

signature-parse-error
signature-failure-error

recov-signature-parse-error
recov-signature-failure-error

Misc.

secp256k1 and secp256k1-ffi

Library has two packages secp256k1-ffi with raw CFFI bindings and secp256k1 with lispy wrapper that takes care of low-level details of CFFI bindings, secp256k1-context managment.

Benchmarks vs Ironclad

Message signing is ~30 times faster than Ironclad out of the box. AFAIC ironclad does not use deterministic nonce generation so its numbers could be inflated because of RNG.

CL-USER> (secp256k1-test:benchmark-report-compare-ironclad)
secp256k1 signing:
-                SAMPLES  TOTAL     MINIMUM   MAXIMUM   MEDIAN    AVERAGE   DEVIATION  
REAL-TIME        100      0.007999  0         0.001     0         0.00008   0.000271   
RUN-TIME         100      0.00734   0.000072  0.000132  0.000073  0.000073  0.000006   
USER-RUN-TIME    100      0.007338  0.000072  0.000125  0.000073  0.000073  0.000005   
SYSTEM-RUN-TIME  100      0.000006  0         0.000003  0         0.0       0.0        
PAGE-FAULTS      100      0         0         0         0         0         0.0        
GC-RUN-TIME      100      0         0         0         0         0         0.0        
BYTES-CONSED     100      260384    0         32768     0         2603.84   8830.112   
EVAL-CALLS       100      0         0         0         0         0         0.0        

ironclad signing:
-                SAMPLES  TOTAL      MINIMUM   MAXIMUM   MEDIAN    AVERAGE    DEVIATION  
REAL-TIME        100      0.238002   0.002     0.008     0.002     0.00238    0.000892   
RUN-TIME         100      0.236695   0.001912  0.008223  0.002017  0.002367   0.000881   
USER-RUN-TIME    100      0.236744   0.001913  0.008224  0.002018  0.002367   0.000881   
SYSTEM-RUN-TIME  100      0.000011   0         0.000005  0         0.0        0.000001   
PAGE-FAULTS      100      0          0         0         0         0          0.0        
GC-RUN-TIME      100      14.443     0         4.154     0         0.14443    0.603128   
BYTES-CONSED     100      271772736  2586672   2750592   2717440   2717727.3  24254.49   
EVAL-CALLS       100      0          0         0         0         0          0.0        

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 secp256k1

FFI findings for secp256k1 library

Author

Vitaly Drogan <vitaly@dvush.net>

License

MIT

Version

0.1.0

Dependency

cffi (system).

Source

secp256k1.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 secp256k1/src

Source

secp256k1.asd.

Parent Component

secp256k1 (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

4.1.1 secp256k1/secp256k1.asd

Source

secp256k1.asd.

Parent Component

secp256k1 (system).

ASDF Systems

secp256k1.


4.1.2 secp256k1/src/package.lisp

Source

secp256k1.asd.

Parent Component

src (module).

Packages

4.1.3 secp256k1/src/secp256k1-ffi.lisp

Source

secp256k1.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.4 secp256k1/src/utils.lisp

Source

secp256k1.asd.

Parent Component

src (module).

Internals

4.1.5 secp256k1/src/secp256k1.lisp

Source

secp256k1.asd.

Parent Component

src (module).

Public Interface
Internals

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 secp256k1-ffi

Source

package.lisp.

Use List
  • cffi.
  • common-lisp.
Used By List

secp256k1.

Public Interface
Internals

Previous: , Up: Packages   [Contents][Index]

5.2 secp256k1

Source

package.lisp.

Use List
Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Public Interface


6.1.1 Constants

Constant: +secp256k1-context-declassify+

Flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and secp256k1_context_preallocated_create.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-context-none+

Flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and secp256k1_context_preallocated_create.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-context-sign+

Flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and secp256k1_context_preallocated_create.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-context-verify+

Flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and secp256k1_context_preallocated_create.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-ec-compressed+

Flag to pass to secp256k1_ec_pubkey_serialize.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-ec-uncompressed+

Flag to pass to secp256k1_ec_pubkey_serialize.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-flags-bit-compression+

The higher bits contain the actual data. Do not use directly.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-flags-bit-context-declassify+

The higher bits contain the actual data. Do not use directly.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-flags-bit-context-sign+

The higher bits contain the actual data. Do not use directly.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-flags-bit-context-verify+

The higher bits contain the actual data. Do not use directly.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-flags-type-compression+

All flags’ lower 8 bits indicate what they’re for. Do not use directly.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-flags-type-context+

All flags’ lower 8 bits indicate what they’re for. Do not use directly.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-flags-type-mask+

All flags’ lower 8 bits indicate what they’re for. Do not use directly.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-tag-pubkey-even+

Prefix byte used to tag various encoded curvepoints for specific purposes

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-tag-pubkey-hybrid-even+

Prefix byte used to tag various encoded curvepoints for specific purposes

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-tag-pubkey-hybrid-odd+

Prefix byte used to tag various encoded curvepoints for specific purposes

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-tag-pubkey-odd+

Prefix byte used to tag various encoded curvepoints for specific purposes

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Constant: +secp256k1-tag-pubkey-uncompressed+

Prefix byte used to tag various encoded curvepoints for specific purposes

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.


6.1.2 Symbol macros

Symbol Macro: *secp256k1-context-no-precomp*
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Symbol Macro: *secp256k1-ecdh-hash-function-default*
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Symbol Macro: *secp256k1-ecdh-hash-function-sha256*
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Symbol Macro: *secp256k1-nonce-function-default*
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Symbol Macro: *secp256k1-nonce-function-rfc6979*
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.


6.1.3 Ordinary functions

Function: make-secret-key (array &key verify)

Creates secret key from 32 byte array, if verify is true key will be checked for validity

Package

secp256k1.

Source

secp256k1.lisp.

Function: public-key-from-components (&key x y)

Create public key from X and Y components. Components are 32 byte arrays.

Package

secp256k1.

Source

secp256k1.lisp.

Function: public-key-parse (octets)

Parse Public Key from octet array, raises ‘public-key-parse-error’ if parsing is impossible. Input should be 32 bytes for compressed representation or 65 for uncompressed one.
see ‘public-key-serialize’ for reverse function.
Uncompressed format is (0x04 ++ x ++ y)

Package

secp256k1.

Source

secp256k1.lisp.

Function: recov-signature-from-components (&key r s v)

Creates recoverable signature from components :r (32 bytes) :s (32 bytes) :v (0-3)

Package

secp256k1.

Source

secp256k1.lisp.

Function: recov-signature-parse (octets recovery-id)

Parse recoverable signature from portable octet representation and recovery id (0, 1, 2, 3). raises ‘recov-signature-parse-error’ if signature can’t be parsed

Package

secp256k1.

Source

secp256k1.lisp.

Function: secp256k1-context-clone (ctx)

Copy a secp256k1 context object (into dynamically allocated memory).

This function uses malloc to allocate memory. It is guaranteed that malloc is called at most once for every call of this function. If you need to avoid dynamic memory allocation entirely, see the functions in secp256k1_preallocated.h.

Returns: a newly created context object.
Args: ctx: an existing context to copy

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-create (flags)

Create a secp256k1 context object (in dynamically allocated memory).

This function uses malloc to allocate memory. It is guaranteed that malloc is called at most once for every call of this function. If you need to avoid dynamic memory allocation entirely, see the functions in secp256k1_preallocated.h.

Returns: a newly created context object.
In: flags: which parts of the context to initialize.

See also secp256k1_context_randomize.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-destroy (ctx)

Destroy a secp256k1 context object (created in dynamically allocated memory).

The context pointer may not be used afterwards.

The context to destroy must have been created using secp256k1_context_create or secp256k1_context_clone. If the context has instead been created using secp256k1_context_preallocated_create or secp256k1_context_preallocated_clone, the behaviour is undefined. In that case, secp256k1_context_preallocated_destroy must be used instead.

Args: ctx: an existing context to destroy, constructed using secp256k1_context_create or secp256k1_context_clone

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-preallocated-clone (ctx prealloc)

Copy a secp256k1 context object into caller-provided memory.

The caller must provide a pointer to a rewritable contiguous block of memory of size at least secp256k1_context_preallocated_size(flags) bytes, suitably aligned to hold an object of any type.

The block of memory is exclusively owned by the created context object during the lifetime of this context object, see the description of secp256k1_context_preallocated_create for details.

Returns: a newly created context object.
Args: ctx: an existing context to copy.
In: prealloc: a pointer to a rewritable contiguous block of memory of size at least secp256k1_context_preallocated_size(flags) bytes, as detailed above.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-preallocated-clone-size (ctx)

Determine the memory size of a secp256k1 context object to be copied into caller-provided memory.

Returns: the required size of the caller-provided memory block.
In: ctx: an existing context to copy.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-preallocated-create (prealloc flags)

Create a secp256k1 context object in caller-provided memory.

The caller must provide a pointer to a rewritable contiguous block of memory of size at least secp256k1_context_preallocated_size(flags) bytes, suitably aligned to hold an object of any type.

The block of memory is exclusively owned by the created context object during the lifetime of this context object, which begins with the call to this function and ends when a call to secp256k1_context_preallocated_destroy (which destroys the context object again) returns. During the lifetime of the context object, the caller is obligated not to access this block of memory, i.e., the caller may not read or write the memory, e.g., by copying the memory contents to a different location or trying to create a second context object in the memory. In simpler words, the prealloc pointer (or any pointer derived from it) should not be used during the lifetime of the context object.

Returns: a newly created context object.
In: prealloc: a pointer to a rewritable contiguous block of memory of size at least secp256k1_context_preallocated_size(flags) bytes, as detailed above.
flags: which parts of the context to initialize.

See also secp256k1_context_randomize (in secp256k1.h)
and secp256k1_context_preallocated_destroy.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-preallocated-destroy (ctx)

Destroy a secp256k1 context object that has been created in caller-provided memory.

The context pointer may not be used afterwards.

The context to destroy must have been created using secp256k1_context_preallocated_create or secp256k1_context_preallocated_clone. If the context has instead been created using secp256k1_context_create or secp256k1_context_clone, the behaviour is undefined. In that case, secp256k1_context_destroy must be used instead.

If required, it is the responsibility of the caller to deallocate the block of memory properly after this function returns, e.g., by calling free on the preallocated pointer given to secp256k1_context_preallocated_create or secp256k1_context_preallocated_clone.

Args: ctx: an existing context to destroy, constructed using secp256k1_context_preallocated_create or secp256k1_context_preallocated_clone.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-preallocated-size (flags)

Determine the memory size of a secp256k1 context object to be created in caller-provided memory.

The purpose of this function is to determine how much memory must be provided to secp256k1_context_preallocated_create.

Returns: the required size of the caller-provided memory block
In: flags: which parts of the context to initialize.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-randomize (ctx seed32)

Updates the context randomization to protect against side-channel leakage. Returns: 1: randomization successfully updated or nothing to randomize
0: error
Args: ctx: pointer to a context object.
In: seed32: pointer to a 32-byte random seed (NULL resets to initial state)

While secp256k1 code is written to be constant-time no matter what secret values are, it’s possible that a future compiler may output code which isn’t, and also that the CPU may not emit the same radio frequencies or draw the same amount power for all values.

This function provides a seed which is combined into the blinding value: that blinding value is added before each multiplication (and removed afterwards) so that it does not affect function results, but shields against attacks which rely on any input-dependent behaviour.

This function has currently an effect only on contexts initialized for signing because randomization is currently used only for signing. However, this is not guaranteed and may change in the future. It is safe to call this function on contexts not initialized for signing; then it will have no effect and return 1.

You should call this after secp256k1_context_create or
secp256k1_context_clone (and secp256k1_context_preallocated_create or secp256k1_context_clone, resp.), and you may call this repeatedly afterwards.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-set-error-callback (ctx fun data)

Set a callback function to be called when an internal consistency check
fails. The default is crashing.

This can only trigger in case of a hardware failure, miscompilation,
memory corruption, serious bug in the library, or other error would can
otherwise result in undefined behaviour. It will not trigger due to mere
incorrect usage of the API (see secp256k1_context_set_illegal_callback
for that). After this callback returns, anything may happen, including
crashing.

Args: ctx: an existing context object.
In: fun: a pointer to a function to call when an internal error occurs,
taking a message and an opaque pointer (NULL restores the
default handler, see secp256k1_context_set_illegal_callback
for details).
data: the opaque pointer to pass to fun above, must be NULL for the default handler.

See also secp256k1_context_set_illegal_callback.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-context-set-illegal-callback (ctx fun data)

Set a callback function to be called when an illegal argument is passed to
an API call. It will only trigger for violations that are mentioned
explicitly in the header.

The philosophy is that these shouldn’t be dealt with through a
specific return value, as calling code should not have branches to deal with
the case that this code itself is broken.

On the other hand, during debug stage, one would want to be informed about
such mistakes, and the default (crashing) may be inadvisable.
When this callback is triggered, the API function called is guaranteed not
to cause a crash, though its return value and output arguments are
undefined.

When this function has not been called (or called with fn==NULL), then the
default handler will be used. The library provides a default handler which
writes the message to stderr and calls abort. This default handler can be
replaced at link time if the preprocessor macro
USE_EXTERNAL_DEFAULT_CALLBACKS is defined, which is the case if the build
has been configured with –enable-external-default-callbacks. Then the
following two symbols must be provided to link against:
- void secp256k1_default_illegal_callback_fn(const char* message, void* data);
- void secp256k1_default_error_callback_fn(const char* message, void* data);
The library can call these default handlers even before a proper callback data
pointer could have been set using secp256k1_context_set_illegal_callback or secp256k1_context_set_error_callback, e.g., when the creation of a context
fails. In this case, the corresponding default handler will be called with
the data pointer argument set to NULL.

Args: ctx: an existing context object.
In: fun: a pointer to a function to call when an illegal argument is
passed to the API, taking a message and an opaque pointer.
(NULL restores the default handler.)
data: the opaque pointer to pass to fun above, must be NULL for the default handler.

See also secp256k1_context_set_error_callback.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-pubkey-cmp (ctx pubkey1 pubkey2)

Compare two public keys using lexicographic (of compressed serialization) order

Returns: <0 if the first public key is less than the second
>0 if the first public key is greater than the second
0 if the two public keys are equal
Args: ctx: a secp256k1 context object.
In: pubkey1: first public key to compare
pubkey2: second public key to compare

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-pubkey-combine (ctx out ins n)

Add a number of public keys together.

Returns: 1: the sum of the public keys is valid.
0: the sum of the public keys is not valid.
Args: ctx: pointer to a context object.
Out: out: pointer to a public key object for placing the resulting public key. In: ins: pointer to array of pointers to public keys.
n: the number of public keys to add together (must be at least 1).

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-pubkey-create (ctx pubkey seckey)

Compute the public key for a secret key.

Returns: 1: secret was valid, public key stores.
0: secret was invalid, try again.
Args: ctx: pointer to a context object, initialized for signing. Out: pubkey: pointer to the created public key.
In: seckey: pointer to a 32-byte secret key.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-pubkey-negate (ctx pubkey)

Negates a public key in place.

Returns: 1 always
Args: ctx: pointer to a context object
In/Out: pubkey: pointer to the public key to be negated.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-pubkey-parse (ctx pubkey input input-len)

Parse a variable-length public key into the pubkey object.

Returns: 1 if the public key was fully valid.
0 if the public key could not be parsed or is invalid.
Args: ctx: a secp256k1 context object.
Out: pubkey: pointer to a pubkey object. If 1 is returned, it is set to a parsed version of input. If not, its value is undefined. In: input: pointer to a serialized public key
inputlen: length of the array pointed to by input

This function supports parsing compressed (33 bytes, header byte 0x02 or 0x03), uncompressed (65 bytes, header byte 0x04), or hybrid (65 bytes, header byte 0x06 or 0x07) format public keys.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-pubkey-serialize (ctx output output-len pubkey flags)

Serialize a pubkey object into a serialized byte sequence.

Returns: 1 always.
Args: ctx: a secp256k1 context object.
Out: output: a pointer to a 65-byte (if compressed==0) or 33-byte (if compressed==1) byte array to place the serialized key in.
In/Out: outputlen: a pointer to an integer which is initially set to the size of output, and is overwritten with the written size.
In: pubkey: a pointer to a secp256k1_pubkey containing an initialized public key.
flags: SECP256K1_EC_COMPRESSED if serialization should be in compressed format, otherwise SECP256K1_EC_UNCOMPRESSED.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-pubkey-tweak-add (ctx pubkey tweak32)

Tweak a public key by adding tweak times the generator to it.

Returns: 0 if the arguments are invalid or the resulting public key would be invalid (only when the tweak is the negation of the corresponding secret key). 1 otherwise.
Args: ctx: pointer to a context object initialized for validation. In/Out: pubkey: pointer to a public key object. pubkey will be set to an invalid value if this function returns 0.
In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to secp256k1_ec_seckey_verify, this function returns 0. For uniformly random 32-byte arrays the chance of being invalid is negligible (around 1 in 2^128).

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-pubkey-tweak-mul (ctx pubkey tweak32)

Tweak a public key by multiplying it by a tweak value.

Returns: 0 if the arguments are invalid. 1 otherwise.
Args: ctx: pointer to a context object initialized for validation. In/Out: pubkey: pointer to a public key object. pubkey will be set to an invalid value if this function returns 0.
In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to secp256k1_ec_seckey_verify, this function returns 0. For uniformly random 32-byte arrays the chance of being invalid is negligible (around 1 in 2^128).

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-seckey-negate (ctx seckey)

Negates a secret key in place.

Returns: 0 if the given secret key is invalid according to secp256k1_ec_seckey_verify. 1 otherwise
Args: ctx: pointer to a context object
In/Out: seckey: pointer to the 32-byte secret key to be negated. If the secret key is invalid according to secp256k1_ec_seckey_verify, this function returns 0 and seckey will be set to some unspecified value.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-seckey-tweak-add (ctx seckey tweak32)

Tweak a secret key by adding tweak to it.

Returns: 0 if the arguments are invalid or the resulting secret key would be invalid (only when the tweak is the negation of the secret key). 1 otherwise.
Args: ctx: pointer to a context object.
In/Out: seckey: pointer to a 32-byte secret key. If the secret key is invalid according to secp256k1_ec_seckey_verify, this function returns 0. seckey will be set to some unspecified value if this function returns 0.
In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to secp256k1_ec_seckey_verify, this function returns 0. For uniformly random 32-byte arrays the chance of being invalid is negligible (around 1 in 2^128).

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-seckey-tweak-mul (ctx seckey tweak32)

Tweak a secret key by multiplying it by a tweak.

Returns: 0 if the arguments are invalid. 1 otherwise.
Args: ctx: pointer to a context object.
In/Out: seckey: pointer to a 32-byte secret key. If the secret key is invalid according to secp256k1_ec_seckey_verify, this function returns 0. seckey will be set to some unspecified value if this function returns 0.
In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to secp256k1_ec_seckey_verify, this function returns 0. For uniformly random 32-byte arrays the chance of being invalid is negligible (around 1 in 2^128).

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ec-seckey-verify (ctx seckey)

Verify an ECDSA secret key.

A secret key is valid if it is not 0 and less than the secp256k1 curve order when interpreted as an integer (most significant byte first). The probability of choosing a 32-byte string uniformly at random which is an invalid secret key is negligible.

Returns: 1: secret key is valid
0: secret key is invalid
Args: ctx: pointer to a context object.
In: seckey: pointer to a 32-byte secret key.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdh (ctx output pubkey seckey hashfp data)

Compute an EC Diffie-Hellman secret in constant time

Returns: 1: exponentiation was successful
0: scalar was invalid (zero or overflow) or hashfp returned 0
Args: ctx: pointer to a context object.
Out: output: pointer to an array to be filled by hashfp.
In: pubkey: a pointer to a secp256k1_pubkey containing an initialized public key. seckey: a 32-byte scalar with which to multiply the point.
hashfp: pointer to a hash function. If NULL, secp256k1_ecdh_hash_function_sha256 is used
(in which case, 32 bytes will be written to output).
data: arbitrary data pointer that is passed through to hashfp
(can be NULL for secp256k1_ecdh_hash_function_sha256).

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-recover (ctx pubkey sig msghash32)

Recover an ECDSA public key from a signature.

Returns: 1: public key successfully recovered (which guarantees a correct signature). 0: otherwise.
Args: ctx: pointer to a context object, initialized for verification. Out: pubkey: pointer to the recovered public key.
In: sig: pointer to initialized signature that supports pubkey recovery. msghash32: the 32-byte message hash assumed to be signed.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-recoverable-signature-convert (ctx sig sigin)

Convert a recoverable signature into a normal signature.

Returns: 1
Args: ctx: a secp256k1 context object.
Out: sig: a pointer to a normal signature.
In: sigin: a pointer to a recoverable signature.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-recoverable-signature-parse-compact (ctx sig input64 recid)

Parse a compact ECDSA signature (64 bytes + recovery id).

Returns: 1 when the signature could be parsed, 0 otherwise Args: ctx: a secp256k1 context object
Out: sig: a pointer to a signature object
In: input64: a pointer to a 64-byte compact signature recid: the recovery id (0, 1, 2 or 3)

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-recoverable-signature-serialize-compact (ctx output recid sig)

Serialize an ECDSA signature in compact format (64 bytes + recovery id).

Returns: 1
Args: ctx: a secp256k1 context object.
Out: output64: a pointer to a 64-byte array of the compact signature. recid: a pointer to an integer to hold the recovery id.
In: sig: a pointer to an initialized signature object.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-sign (ctx sig msghash32 seckey noncefp ndata)

Create an ECDSA signature.

Returns: 1: signature created
0: the nonce generation function failed, or the secret key was invalid. Args: ctx: pointer to a context object, initialized for signing.
Out: sig: pointer to an array where the signature will be placed.
In: msghash32: the 32-byte message hash being signed.
seckey: pointer to a 32-byte secret key.
noncefp: pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used.
ndata: pointer to arbitrary data used by the nonce generation function (can be NULL). If it is non-NULL and secp256k1_nonce_function_default is used, then ndata must be a pointer to 32-bytes of additional data.

The created signature is always in lower-S form. See secp256k1_ecdsa_signature_normalize for more details.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-sign-recoverable (ctx sig msghash32 seckey noncefp ndata)

Create a recoverable ECDSA signature.

Returns: 1: signature created
0: the nonce generation function failed, or the secret key was invalid. Args: ctx: pointer to a context object, initialized for signing.
Out: sig: pointer to an array where the signature will be placed.
In: msghash32: the 32-byte message hash being signed.
seckey: pointer to a 32-byte secret key.
noncefp: pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used.
ndata: pointer to arbitrary data used by the nonce generation function (can be NULL for secp256k1_nonce_function_default).

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-signature-normalize (ctx sigout sigin)

Convert a signature to a normalized lower-S form.

Returns: 1 if sigin was not normalized, 0 if it already was.
Args: ctx: a secp256k1 context object
Out: sigout: a pointer to a signature to fill with the normalized form,
or copy if the input was already normalized. (can be NULL if
you’re only interested in whether the input was already normalized).
In: sigin: a pointer to a signature to check/normalize (can be identical to sigout)

With ECDSA a third-party can forge a second distinct signature of the same message, given a single initial signature, but without knowing the key. This
is done by negating the S value modulo the order of the curve, ’flipping’
the sign of the random point R which is not included in the signature.

Forgery of the same message isn’t universally problematic, but in systems
where message malleability or uniqueness of signatures is important this can
cause issues. This forgery can be blocked by all verifiers forcing signers
to use a normalized form.

The lower-S form reduces the size of signatures slightly on average when
variable length encodings (such as DER) are used and is cheap to verify,
making it a good choice. Security of always using lower-S is assured because anyone can trivially modify a signature after the fact to enforce this
property anyway.

The lower S value is always between 0x1 and 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
inclusive.

No other forms of ECDSA malleability are known and none seem likely, but
there is no formal proof that ECDSA, even with this additional restriction,
is free of other malleability. Commonly used serialization schemes will also accept various non-unique encodings, so care should be taken when this
property is required for an application.

The secp256k1_ecdsa_sign function will by default create signatures in the
lower-S form, and secp256k1_ecdsa_verify will not accept others. In case signatures come from a system that cannot enforce this property, secp256k1_ecdsa_signature_normalize must be called before verification.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-signature-parse-compact (ctx sig input64)

Parse an ECDSA signature in compact (64 bytes) format.

Returns: 1 when the signature could be parsed, 0 otherwise.
Args: ctx: a secp256k1 context object
Out: sig: a pointer to a signature object
In: input64: a pointer to the 64-byte array to parse

The signature must consist of a 32-byte big endian R value, followed by a 32-byte big endian S value. If R or S fall outside of [0..order-1], the encoding is invalid. R and S with value 0 are allowed in the encoding.

After the call, sig will always be initialized. If parsing failed or R or S are zero, the resulting sig value is guaranteed to fail validation for any message and public key.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-signature-parse-der (ctx sig input input-len)

Parse a DER ECDSA signature.

Returns: 1 when the signature could be parsed, 0 otherwise.
Args: ctx: a secp256k1 context object
Out: sig: a pointer to a signature object
In: input: a pointer to the signature to be parsed
inputlen: the length of the array pointed to be input

This function will accept any valid DER encoded signature, even if the encoded numbers are out of range.

After the call, sig will always be initialized. If parsing failed or the encoded numbers are out of range, signature validation with it is guaranteed to fail for every message and public key.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-signature-serialize-compact (ctx output64 sig)

Serialize an ECDSA signature in compact (64 byte) format.

Returns: 1
Args: ctx: a secp256k1 context object
Out: output64: a pointer to a 64-byte array to store the compact serialization In: sig: a pointer to an initialized signature object

See secp256k1_ecdsa_signature_parse_compact for details about the encoding.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-signature-serialize-der (ctx output output-len sig)

Serialize an ECDSA signature in DER format.

Returns: 1 if enough space was available to serialize, 0 otherwise Args: ctx: a secp256k1 context object
Out: output: a pointer to an array to store the DER serialization In/Out: outputlen: a pointer to a length integer. Initially, this integer should be set to the length of output. After the call it will be set to the length of the serialization (even if 0 was returned).
In: sig: a pointer to an initialized signature object

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-ecdsa-verify (ctx sig msghash32 pubkey)

Verify an ECDSA signature.

Returns: 1: correct signature
0: incorrect or unparseable signature
Args: ctx: a secp256k1 context object, initialized for verification. In: sig: the signature being verified.
msghash32: the 32-byte message hash being verified.
The verifier must make sure to apply a cryptographic hash function to the message by itself and not accept an msghash32 value directly. Otherwise, it would be easy to create a "valid" signature without knowledge of the secret key. See also https://bitcoin.stackexchange.com/a/81116/35586 for more background on this topic.
pubkey: pointer to an initialized public key to verify with.

To avoid accepting malleable signatures, only ECDSA signatures in lower-S form are accepted.

If you need to accept ECDSA signatures from sources that do not obey this rule, apply secp256k1_ecdsa_signature_normalize to the signature prior to validation, but be aware that doing so results in malleable signatures.

For details, see the comments for that function.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-keypair-create (ctx keypair seckey)

Compute the keypair for a secret key.

Returns: 1: secret was valid, keypair is ready to use
0: secret was invalid, try again with a different secret Args: ctx: pointer to a context object, initialized for signing. Out: keypair: pointer to the created keypair.
In: seckey: pointer to a 32-byte secret key.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-keypair-pub (ctx pubkey keypair)

Get the public key from a keypair.

Returns: 0 if the arguments are invalid. 1 otherwise.
Args: ctx: pointer to a context object.
Out: pubkey: pointer to a pubkey object. If 1 is returned, it is set to the keypair public key. If not, it’s set to an invalid value. In: keypair: pointer to a keypair.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-keypair-sec (ctx seckey keypair)

Get the secret key from a keypair.

Returns: 0 if the arguments are invalid. 1 otherwise. Args: ctx: pointer to a context object.
Out: seckey: pointer to a 32-byte buffer for the secret key. In: keypair: pointer to a keypair.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-keypair-xonly-pub (ctx pubkey pk-parity keypair)

Get the x-only public key from a keypair.

This is the same as calling secp256k1_keypair_pub and then secp256k1_xonly_pubkey_from_pubkey.

Returns: 0 if the arguments are invalid. 1 otherwise.
Args: ctx: pointer to a context object.
Out: pubkey: pointer to an xonly_pubkey object. If 1 is returned, it is set
to the keypair public key after converting it to an
xonly_pubkey. If not, it’s set to an invalid value.
pk_parity: Ignored if NULL. Otherwise, pointer to an integer that will be set to the pk_parity argument of secp256k1_xonly_pubkey_from_pubkey.
In: keypair: pointer to a keypair.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-keypair-xonly-tweak-add (ctx keypair tweak32)

Tweak a keypair by adding tweak32 to the secret key and updating the public key accordingly.

Calling this function and then secp256k1_keypair_pub results in the same public key as calling secp256k1_keypair_xonly_pub and then secp256k1_xonly_pubkey_tweak_add.

Returns: 0 if the arguments are invalid or the resulting keypair would be invalid (only when the tweak is the negation of the keypair’s secret key). 1 otherwise.

Args: ctx: pointer to a context object initialized for verification. In/Out: keypair: pointer to a keypair to apply the tweak to. Will be set to an invalid value if this function returns 0.
In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to secp256k1_ec_seckey_verify, this function returns 0. For uniformly random 32-byte arrays the chance of being invalid is negligible (around 1 in 2^128).

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-schnorrsig-sign (ctx sig64 msg32 keypair aux-rand32)

Create a Schnorr signature.

Does _not_ strictly follow BIP-340 because it does not verify the resulting signature. Instead, you can manually use secp256k1_schnorrsig_verify and abort if it fails.

This function only signs 32-byte messages. If you have messages of a different size (or the same size but without a context-specific tag prefix), it is recommended to create a 32-byte message hash with secp256k1_tagged_sha256 and then sign the hash. Tagged hashing allows providing an context-specific tag for domain separation. This prevents signatures from being valid in multiple contexts by accident.

Returns 1 on success, 0 on failure.
Args: ctx: pointer to a context object, initialized for signing. Out: sig64: pointer to a 64-byte array to store the serialized signature. In: msg32: the 32-byte message being signed.
keypair: pointer to an initialized keypair.
aux_rand32: 32 bytes of fresh randomness. While recommended to provide this, it is only supplemental to security and can be NULL. A NULL argument is treated the same as an all-zero one. See BIP-340 "Default Signing" for a full explanation of this argument and for guidance if randomness is expensive.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-schnorrsig-sign-custom (ctx sig64 msg msg-len keypair extraparams)

Create a Schnorr signature with a more flexible API.

Same arguments as secp256k1_schnorrsig_sign except that it allows signing variable length messages and accepts a pointer to an extraparams object that allows customizing signing by passing additional arguments.

Creates the same signatures as schnorrsig_sign if msglen is 32 and the extraparams.ndata is the same as aux_rand32.

In: msg: the message being signed. Can only be NULL if msglen is 0. msglen: length of the message
extraparams: pointer to a extraparams object (can be NULL)

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-schnorrsig-verify (ctx sig64 msg msg-len pubkey)

Verify a Schnorr signature.

Returns: 1: correct signature
0: incorrect signature
Args: ctx: a secp256k1 context object, initialized for verification. In: sig64: pointer to the 64-byte signature to verify.
msg: the message being verified. Can only be NULL if msglen is 0. msglen: length of the message
pubkey: pointer to an x-only public key to verify with (cannot be NULL)

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-scratch-space-create (ctx size)

Create a secp256k1 scratch space object.

Returns: a newly created scratch space.
Args: ctx: an existing context object.
In: size: amount of memory to be available as scratch space. Some extra (<100 bytes) will be allocated for extra accounting.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-scratch-space-destroy (ctx scratch)

Destroy a secp256k1 scratch space.

The pointer may not be used afterwards. Args: ctx: a secp256k1 context object. scratch: space to destroy

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-tagged-sha256 (ctx hash32 tag tag-len msg msg-len)

Compute a tagged hash as defined in BIP-340.

This is useful for creating a message hash and achieving domain separation through an application-specific tag. This function returns SHA256(SHA256(tag)||SHA256(tag)||msg). Therefore, tagged hash implementations optimized for a specific tag can precompute the SHA256 state after hashing the tag hashes.

Returns 0 if the arguments are invalid and 1 otherwise.
Args: ctx: pointer to a context object
Out: hash32: pointer to a 32-byte array to store the resulting hash
In: tag: pointer to an array containing the tag
taglen: length of the tag array
msg: pointer to an array containing the message
msglen: length of the message array

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-xonly-pubkey-cmp (ctx pubkey1 pubkey2)

Compare two x-only public keys using lexicographic order

Returns: <0 if the first public key is less than the second >0 if the first public key is greater than the second 0 if the two public keys are equal
Args: ctx: a secp256k1 context object.
In: pubkey1: first public key to compare
pubkey2: second public key to compare

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-xonly-pubkey-from-pubkey (ctx xonly-pubkey pk-parity pubkey)

Converts a secp256k1_pubkey into a secp256k1_xonly_pubkey.

Returns: 1 if the public key was successfully converted
0 otherwise

Args: ctx: pointer to a context object.
Out: xonly_pubkey: pointer to an x-only public key object for placing the converted public key. pk_parity: Ignored if NULL. Otherwise, pointer to an integer that
will be set to 1 if the point encoded by xonly_pubkey is
the negation of the pubkey and set to 0 otherwise.
In: pubkey: pointer to a public key that is converted.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-xonly-pubkey-parse (ctx pubkey input32)

Parse a 32-byte sequence into a xonly_pubkey object.

Returns: 1 if the public key was fully valid.
0 if the public key could not be parsed or is invalid.

Args: ctx: a secp256k1 context object.
Out: pubkey: pointer to a pubkey object. If 1 is returned, it is set to a parsed version of input. If not, it’s set to an invalid value. In: input32: pointer to a serialized xonly_pubkey.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-xonly-pubkey-serialize (ctx output32 pubkey)

Serialize an xonly_pubkey object into a 32-byte sequence.

Returns: 1 always.

Args: ctx: a secp256k1 context object.
Out: output32: a pointer to a 32-byte array to place the serialized key in.
In: pubkey: a pointer to a secp256k1_xonly_pubkey containing an initialized public key.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-xonly-pubkey-tweak-add (ctx output-pubkey internal-pubkey tweak32)

Tweak an x-only public key by adding the generator multiplied with tweak32 to it.

Note that the resulting point can not in general be represented by an x-only pubkey because it may have an odd Y coordinate. Instead, the output_pubkey is a normal secp256k1_pubkey.

Returns: 0 if the arguments are invalid or the resulting public key would be invalid (only when the tweak is the negation of the corresponding secret key). 1 otherwise.

Args: ctx: pointer to a context object initialized for verification. Out: output_pubkey: pointer to a public key to store the result. Will be set to an invalid value if this function returns 0.
In: internal_pubkey: pointer to an x-only pubkey to apply the tweak to. tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to secp256k1_ec_seckey_verify, this function returns 0. For uniformly random 32-byte arrays the chance of being invalid is negligible (around 1 in 2^128).

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: secp256k1-xonly-pubkey-tweak-add-check (ctx tweaked-pubkey32 tweaked-pk-parity internal-pubkey tweak32)

Checks that a tweaked pubkey is the result of calling secp256k1_xonly_pubkey_tweak_add with internal_pubkey and tweak32.

The tweaked pubkey is represented by its 32-byte x-only serialization and
its pk_parity, which can both be obtained by converting the result of
tweak_add to a secp256k1_xonly_pubkey.

Note that this alone does _not_ verify that the tweaked pubkey is a
commitment. If the tweak is not chosen in a specific way, the tweaked pubkey can easily be the result of a different internal_pubkey and tweak.

Returns: 0 if the arguments are invalid or the tweaked pubkey is not the
result of tweaking the internal_pubkey with tweak32. 1 otherwise. Args: ctx: pointer to a context object initialized for verification. In: tweaked_pubkey32: pointer to a serialized xonly_pubkey.
tweaked_pk_parity: the parity of the tweaked pubkey (whose serialization
is passed in as tweaked_pubkey32). This must match the pk_parity value that is returned when calling secp256k1_xonly_pubkey with the tweaked pubkey, or
this function will fail.
internal_pubkey: pointer to an x-only public key object to apply the tweak to. tweak32: pointer to a 32-byte tweak.

Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: signature-from-components (&key r s)

Creates signature from components :r (32 bytes) :s (32 bytes)

Package

secp256k1.

Source

secp256k1.lisp.

Function: signature-parse (octets &key format)

Parse signature from portable octet representation, raises ‘signature-parse-error’ if signature cannot be parsed. Possible formats are :compact (64 bytes - r ++ s),
:der (up to 71 bytes, see DER format for details)

Package

secp256k1.

Source

secp256k1.lisp.


6.1.4 Generic functions

Generic Function: public-key-compare (public-key-1 public-key-2)
Package

secp256k1.

Methods
Method: public-key-compare ((public-key-1 public-key) (public-key-2 public-key))

Compares public key, returns one of the following: :eq (1 = 2), :lt (1 < 2), :gt (1 > 2)

Source

secp256k1.lisp.

Generic Function: public-key-create (secret-key)
Package

secp256k1.

Methods
Method: public-key-create ((secret-key secret-key))

Creates public key from corresponding secret key

Source

secp256k1.lisp.

Generic Function: public-key-destructure (public-key)
Package

secp256k1.

Methods
Method: public-key-destructure ((public-key public-key))

Returns plist wish :x and :y components of public key. Components are 32 byte arrays.

Source

secp256k1.lisp.

Generic Function: public-key-eq (public-key-1 public-key-2)
Package

secp256k1.

Methods
Method: public-key-eq ((public-key-1 public-key) (public-key-2 public-key))

Checks if two Public Keyr are equal

Source

secp256k1.lisp.

Generic Function: public-key-serialize (public-key &key compressed)
Package

secp256k1.

Methods
Method: public-key-serialize ((public-key public-key) &key compressed)

Serialize Public Key to octet array. If compressed is true output is 32 bytes otherwise its 65 see ‘public-key-parse’ for reverse function
Uncompressed format is (0x04 ++ x ++ y).

Source

secp256k1.lisp.

Generic Function: recov-signature-destructure (recov-signature)
Package

secp256k1.

Methods
Method: recov-signature-destructure ((recov-signature recov-signature))

Returns plist with :r (32 bytes) :s (32 bytes) :v (0-3)

Source

secp256k1.lisp.

Generic Function: recov-signature-destructure* (recov-signature)
Package

secp256k1.

Methods
Method: recov-signature-destructure* ((recov-signature recov-signature))

Returns r s v as multiple values

Source

secp256k1.lisp.

Generic Function: recov-signature-recover (recov-signature message-hash32)
Package

secp256k1.

Methods
Method: recov-signature-recover ((recov-signature recov-signature) message-hash32)

Returns public key used for signature of the given message hash or nil if public key can’t be recovered or signature is incorrect. Message should be hashed separatly and 32-byte octet array os hash is passed to this function.

Source

secp256k1.lisp.

Generic Function: recov-signature-serialize (recov-signature)
Package

secp256k1.

Methods
Method: recov-signature-serialize ((recov-signature recov-signature))

Serialize recoverable signature to portable octet representation. Returns 64 byte array and integer recovery id (0, 1, 2, 3)

Source

secp256k1.lisp.

Generic Function: recov-signature-sign (message-hash32 secret-key)
Package

secp256k1.

Methods
Method: recov-signature-sign (message-hash32 (secret-key secret-key))

Creates recoverable signature from message hash using secret key, raises ‘recov-signature-failure-error’ if message can’t be signed (e.g. invalid secret key). Message should be hashed separatly and 32-byte octet array os hash is passed to this function.

Source

secp256k1.lisp.

Generic Function: secret-key-verify (key)
Package

secp256k1.

Methods
Method: secret-key-verify ((key secret-key))

Checks if secret key is valid

Source

secp256k1.lisp.

Generic Function: signature-destructure (signature)
Package

secp256k1.

Methods
Method: signature-destructure ((signature signature))

Returns plist with :r (32 bytes) :s (32 bytes)

Source

secp256k1.lisp.

Generic Function: signature-normalize (signature)
Package

secp256k1.

Methods
Method: signature-normalize ((signature signature))

Returns signature normalize to cannonical lower-S form original signature is not modified.
Signatures created by this library are always normalized. Signatures that are not normalized would not be verified. Second value indicates if signature was already normalized.

Source

secp256k1.lisp.

Generic Function: signature-serialize (signature &key format)
Package

secp256k1.

Methods
Method: signature-serialize ((signature signature) &key format)

Serialize signature to portable octet representation. Possible formats are :compact (64 bytes - r ++ s), :der (up to 71 bytes, see DER format for details)

Source

secp256k1.lisp.

Generic Function: signature-sign (message-hash32 secret-key)
Package

secp256k1.

Methods
Method: signature-sign (message-hash32 (secret-key secret-key))

Signs message hash using secret key, raises ‘signature-failure-error’ if message can’t be signed (e.g. invalid secret key). Message should be hashed separatly and 32-byte octet array os hash is passed to this function.

Source

secp256k1.lisp.

Generic Function: signature-verify (signature message-hash32 public-key)
Package

secp256k1.

Methods
Method: signature-verify ((signature signature) message-hash32 (public-key public-key))

Verifies message signature of given message hash and public key.
Message should be hashed separatly and 32-byte octet array os hash is passed to this function.

Source

secp256k1.lisp.


6.1.5 Conditions

Condition: incorrect-secret-key-error
Package

secp256k1.

Source

secp256k1.lisp.

Direct superclasses

error.

Condition: public-key-parse-error
Package

secp256k1.

Source

secp256k1.lisp.

Direct superclasses

error.

Condition: recov-signature-failure-error
Package

secp256k1.

Source

secp256k1.lisp.

Direct superclasses

error.

Condition: recov-signature-parse-error
Package

secp256k1.

Source

secp256k1.lisp.

Direct superclasses

error.

Condition: signature-failure-error
Package

secp256k1.

Source

secp256k1.lisp.

Direct superclasses

error.

Condition: signature-parse-error
Package

secp256k1.

Source

secp256k1.lisp.

Direct superclasses

error.

Direct slots
Slot: format
Package

common-lisp.

Initargs

:format


6.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.1 Special variables

Special Variable: *ctx*
Package

secp256k1.

Source

secp256k1.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.2 Symbol macros

Symbol Macro: *secp256k1-nonce-function-bip340*
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.


6.2.3 Macros

Macro: with-foreign-byte-array ((var lisp-array &optional size) &body body)
Package

secp256k1.

Source

utils.lisp.

Macro: with-pointer-to-vector-data-slot ((pointer-sym slot) object-sym &body body)
Package

secp256k1.

Source

utils.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.4 Ordinary functions

Function: %var-accessor-*secp256k1-context-no-precomp* ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: (setf %var-accessor-*secp256k1-context-no-precomp*) ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: %var-accessor-*secp256k1-ecdh-hash-function-default* ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: (setf %var-accessor-*secp256k1-ecdh-hash-function-default*) ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: %var-accessor-*secp256k1-ecdh-hash-function-sha256* ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: (setf %var-accessor-*secp256k1-ecdh-hash-function-sha256*) ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: %var-accessor-*secp256k1-nonce-function-bip340* ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: (setf %var-accessor-*secp256k1-nonce-function-bip340*) ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: %var-accessor-*secp256k1-nonce-function-default* ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: (setf %var-accessor-*secp256k1-nonce-function-default*) ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: %var-accessor-*secp256k1-nonce-function-rfc6979* ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: (setf %var-accessor-*secp256k1-nonce-function-rfc6979*) ()
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Function: ensure-context ()
Package

secp256k1.

Source

secp256k1.lisp.

Function: make-public-key ()
Package

secp256k1.

Source

secp256k1.lisp.

Function: make-recov-signature ()
Package

secp256k1.

Source

secp256k1.lisp.

Function: make-signature ()
Package

secp256k1.

Source

secp256k1.lisp.

Function: sharable-byte-array-from-array (array size)
Package

secp256k1.

Source

utils.lisp.


6.2.5 Classes

Class: public-key
Package

secp256k1.

Source

secp256k1.lisp.

Direct methods
Direct slots
Slot: data

internal representation as cffi-shareable 64 byte array
Use ‘public-key-serialize’ and ‘public-key-parse’ to work with portable byte representation

Type

(vector (unsigned-byte 8))

Initargs

:data

Class: recov-signature
Package

secp256k1.

Source

secp256k1.lisp.

Direct methods
Direct slots
Slot: data

internal representation as cffi-shareable 65 byte array
Use ‘recov-signature-serialize’ and ‘recov-signature-parse’ to work with portable byte representation

Type

(vector (unsigned-byte 8))

Initargs

:data

Class: secp256k1-context-tclass
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: secp256k1-ecdsa-recoverable-signature-tclass
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: secp256k1-ecdsa-signature-tclass
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: secp256k1-keypair-tclass
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: secp256k1-pubkey-tclass
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: secp256k1-schnorrsig-extraparams-tclass
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: secp256k1-scratch-space-tclass
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: secp256k1-xonly-pubkey-tclass
Package

secp256k1-ffi.

Source

secp256k1-ffi.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: secret-key
Package

secp256k1.

Source

secp256k1.lisp.

Direct methods
Direct slots
Slot: data

cffi-shareable 32 byte array can be used as a portable representation

Type

(vector (unsigned-byte 8))

Initargs

:data

Class: signature
Package

secp256k1.

Source

secp256k1.lisp.

Direct methods
Direct slots
Slot: data

internal representation as cffi-shareable 64 byte array
Use ‘signature-serialize’ and ‘signature-parse’ to work with portable byte representation

Type

(vector (unsigned-byte 8))

Initargs

:data


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %   (  
E   F   G   M   P   R   S   W  
Index Entry  Section

%
%var-accessor-*secp256k1-context-no-precomp*: Private ordinary functions
%var-accessor-*secp256k1-ecdh-hash-function-default*: Private ordinary functions
%var-accessor-*secp256k1-ecdh-hash-function-sha256*: Private ordinary functions
%var-accessor-*secp256k1-nonce-function-bip340*: Private ordinary functions
%var-accessor-*secp256k1-nonce-function-default*: Private ordinary functions
%var-accessor-*secp256k1-nonce-function-rfc6979*: Private ordinary functions

(
(setf %var-accessor-*secp256k1-context-no-precomp*): Private ordinary functions
(setf %var-accessor-*secp256k1-ecdh-hash-function-default*): Private ordinary functions
(setf %var-accessor-*secp256k1-ecdh-hash-function-sha256*): Private ordinary functions
(setf %var-accessor-*secp256k1-nonce-function-bip340*): Private ordinary functions
(setf %var-accessor-*secp256k1-nonce-function-default*): Private ordinary functions
(setf %var-accessor-*secp256k1-nonce-function-rfc6979*): Private ordinary functions

E
ensure-context: Private ordinary functions

F
Function, %var-accessor-*secp256k1-context-no-precomp*: Private ordinary functions
Function, %var-accessor-*secp256k1-ecdh-hash-function-default*: Private ordinary functions
Function, %var-accessor-*secp256k1-ecdh-hash-function-sha256*: Private ordinary functions
Function, %var-accessor-*secp256k1-nonce-function-bip340*: Private ordinary functions
Function, %var-accessor-*secp256k1-nonce-function-default*: Private ordinary functions
Function, %var-accessor-*secp256k1-nonce-function-rfc6979*: Private ordinary functions
Function, (setf %var-accessor-*secp256k1-context-no-precomp*): Private ordinary functions
Function, (setf %var-accessor-*secp256k1-ecdh-hash-function-default*): Private ordinary functions
Function, (setf %var-accessor-*secp256k1-ecdh-hash-function-sha256*): Private ordinary functions
Function, (setf %var-accessor-*secp256k1-nonce-function-bip340*): Private ordinary functions
Function, (setf %var-accessor-*secp256k1-nonce-function-default*): Private ordinary functions
Function, (setf %var-accessor-*secp256k1-nonce-function-rfc6979*): Private ordinary functions
Function, ensure-context: Private ordinary functions
Function, make-public-key: Private ordinary functions
Function, make-recov-signature: Private ordinary functions
Function, make-secret-key: Public ordinary functions
Function, make-signature: Private ordinary functions
Function, public-key-from-components: Public ordinary functions
Function, public-key-parse: Public ordinary functions
Function, recov-signature-from-components: Public ordinary functions
Function, recov-signature-parse: Public ordinary functions
Function, secp256k1-context-clone: Public ordinary functions
Function, secp256k1-context-create: Public ordinary functions
Function, secp256k1-context-destroy: Public ordinary functions
Function, secp256k1-context-preallocated-clone: Public ordinary functions
Function, secp256k1-context-preallocated-clone-size: Public ordinary functions
Function, secp256k1-context-preallocated-create: Public ordinary functions
Function, secp256k1-context-preallocated-destroy: Public ordinary functions
Function, secp256k1-context-preallocated-size: Public ordinary functions
Function, secp256k1-context-randomize: Public ordinary functions
Function, secp256k1-context-set-error-callback: Public ordinary functions
Function, secp256k1-context-set-illegal-callback: Public ordinary functions
Function, secp256k1-ec-pubkey-cmp: Public ordinary functions
Function, secp256k1-ec-pubkey-combine: Public ordinary functions
Function, secp256k1-ec-pubkey-create: Public ordinary functions
Function, secp256k1-ec-pubkey-negate: Public ordinary functions
Function, secp256k1-ec-pubkey-parse: Public ordinary functions
Function, secp256k1-ec-pubkey-serialize: Public ordinary functions
Function, secp256k1-ec-pubkey-tweak-add: Public ordinary functions
Function, secp256k1-ec-pubkey-tweak-mul: Public ordinary functions
Function, secp256k1-ec-seckey-negate: Public ordinary functions
Function, secp256k1-ec-seckey-tweak-add: Public ordinary functions
Function, secp256k1-ec-seckey-tweak-mul: Public ordinary functions
Function, secp256k1-ec-seckey-verify: Public ordinary functions
Function, secp256k1-ecdh: Public ordinary functions
Function, secp256k1-ecdsa-recover: Public ordinary functions
Function, secp256k1-ecdsa-recoverable-signature-convert: Public ordinary functions
Function, secp256k1-ecdsa-recoverable-signature-parse-compact: Public ordinary functions
Function, secp256k1-ecdsa-recoverable-signature-serialize-compact: Public ordinary functions
Function, secp256k1-ecdsa-sign: Public ordinary functions
Function, secp256k1-ecdsa-sign-recoverable: Public ordinary functions
Function, secp256k1-ecdsa-signature-normalize: Public ordinary functions
Function, secp256k1-ecdsa-signature-parse-compact: Public ordinary functions
Function, secp256k1-ecdsa-signature-parse-der: Public ordinary functions
Function, secp256k1-ecdsa-signature-serialize-compact: Public ordinary functions
Function, secp256k1-ecdsa-signature-serialize-der: Public ordinary functions
Function, secp256k1-ecdsa-verify: Public ordinary functions
Function, secp256k1-keypair-create: Public ordinary functions
Function, secp256k1-keypair-pub: Public ordinary functions
Function, secp256k1-keypair-sec: Public ordinary functions
Function, secp256k1-keypair-xonly-pub: Public ordinary functions
Function, secp256k1-keypair-xonly-tweak-add: Public ordinary functions
Function, secp256k1-schnorrsig-sign: Public ordinary functions
Function, secp256k1-schnorrsig-sign-custom: Public ordinary functions
Function, secp256k1-schnorrsig-verify: Public ordinary functions
Function, secp256k1-scratch-space-create: Public ordinary functions
Function, secp256k1-scratch-space-destroy: Public ordinary functions
Function, secp256k1-tagged-sha256: Public ordinary functions
Function, secp256k1-xonly-pubkey-cmp: Public ordinary functions
Function, secp256k1-xonly-pubkey-from-pubkey: Public ordinary functions
Function, secp256k1-xonly-pubkey-parse: Public ordinary functions
Function, secp256k1-xonly-pubkey-serialize: Public ordinary functions
Function, secp256k1-xonly-pubkey-tweak-add: Public ordinary functions
Function, secp256k1-xonly-pubkey-tweak-add-check: Public ordinary functions
Function, sharable-byte-array-from-array: Private ordinary functions
Function, signature-from-components: Public ordinary functions
Function, signature-parse: Public ordinary functions

G
Generic Function, public-key-compare: Public generic functions
Generic Function, public-key-create: Public generic functions
Generic Function, public-key-destructure: Public generic functions
Generic Function, public-key-eq: Public generic functions
Generic Function, public-key-serialize: Public generic functions
Generic Function, recov-signature-destructure: Public generic functions
Generic Function, recov-signature-destructure*: Public generic functions
Generic Function, recov-signature-recover: Public generic functions
Generic Function, recov-signature-serialize: Public generic functions
Generic Function, recov-signature-sign: Public generic functions
Generic Function, secret-key-verify: Public generic functions
Generic Function, signature-destructure: Public generic functions
Generic Function, signature-normalize: Public generic functions
Generic Function, signature-serialize: Public generic functions
Generic Function, signature-sign: Public generic functions
Generic Function, signature-verify: Public generic functions

M
Macro, with-foreign-byte-array: Private macros
Macro, with-pointer-to-vector-data-slot: Private macros
make-public-key: Private ordinary functions
make-recov-signature: Private ordinary functions
make-secret-key: Public ordinary functions
make-signature: Private ordinary functions
Method, public-key-compare: Public generic functions
Method, public-key-create: Public generic functions
Method, public-key-destructure: Public generic functions
Method, public-key-eq: Public generic functions
Method, public-key-serialize: Public generic functions
Method, recov-signature-destructure: Public generic functions
Method, recov-signature-destructure*: Public generic functions
Method, recov-signature-recover: Public generic functions
Method, recov-signature-serialize: Public generic functions
Method, recov-signature-sign: Public generic functions
Method, secret-key-verify: Public generic functions
Method, signature-destructure: Public generic functions
Method, signature-normalize: Public generic functions
Method, signature-serialize: Public generic functions
Method, signature-sign: Public generic functions
Method, signature-verify: Public generic functions

P
public-key-compare: Public generic functions
public-key-compare: Public generic functions
public-key-create: Public generic functions
public-key-create: Public generic functions
public-key-destructure: Public generic functions
public-key-destructure: Public generic functions
public-key-eq: Public generic functions
public-key-eq: Public generic functions
public-key-from-components: Public ordinary functions
public-key-parse: Public ordinary functions
public-key-serialize: Public generic functions
public-key-serialize: Public generic functions

R
recov-signature-destructure: Public generic functions
recov-signature-destructure: Public generic functions
recov-signature-destructure*: Public generic functions
recov-signature-destructure*: Public generic functions
recov-signature-from-components: Public ordinary functions
recov-signature-parse: Public ordinary functions
recov-signature-recover: Public generic functions
recov-signature-recover: Public generic functions
recov-signature-serialize: Public generic functions
recov-signature-serialize: Public generic functions
recov-signature-sign: Public generic functions
recov-signature-sign: Public generic functions

S
secp256k1-context-clone: Public ordinary functions
secp256k1-context-create: Public ordinary functions
secp256k1-context-destroy: Public ordinary functions
secp256k1-context-preallocated-clone: Public ordinary functions
secp256k1-context-preallocated-clone-size: Public ordinary functions
secp256k1-context-preallocated-create: Public ordinary functions
secp256k1-context-preallocated-destroy: Public ordinary functions
secp256k1-context-preallocated-size: Public ordinary functions
secp256k1-context-randomize: Public ordinary functions
secp256k1-context-set-error-callback: Public ordinary functions
secp256k1-context-set-illegal-callback: Public ordinary functions
secp256k1-ec-pubkey-cmp: Public ordinary functions
secp256k1-ec-pubkey-combine: Public ordinary functions
secp256k1-ec-pubkey-create: Public ordinary functions
secp256k1-ec-pubkey-negate: Public ordinary functions
secp256k1-ec-pubkey-parse: Public ordinary functions
secp256k1-ec-pubkey-serialize: Public ordinary functions
secp256k1-ec-pubkey-tweak-add: Public ordinary functions
secp256k1-ec-pubkey-tweak-mul: Public ordinary functions
secp256k1-ec-seckey-negate: Public ordinary functions
secp256k1-ec-seckey-tweak-add: Public ordinary functions
secp256k1-ec-seckey-tweak-mul: Public ordinary functions
secp256k1-ec-seckey-verify: Public ordinary functions
secp256k1-ecdh: Public ordinary functions
secp256k1-ecdsa-recover: Public ordinary functions
secp256k1-ecdsa-recoverable-signature-convert: Public ordinary functions
secp256k1-ecdsa-recoverable-signature-parse-compact: Public ordinary functions
secp256k1-ecdsa-recoverable-signature-serialize-compact: Public ordinary functions
secp256k1-ecdsa-sign: Public ordinary functions
secp256k1-ecdsa-sign-recoverable: Public ordinary functions
secp256k1-ecdsa-signature-normalize: Public ordinary functions
secp256k1-ecdsa-signature-parse-compact: Public ordinary functions
secp256k1-ecdsa-signature-parse-der: Public ordinary functions
secp256k1-ecdsa-signature-serialize-compact: Public ordinary functions
secp256k1-ecdsa-signature-serialize-der: Public ordinary functions
secp256k1-ecdsa-verify: Public ordinary functions
secp256k1-keypair-create: Public ordinary functions
secp256k1-keypair-pub: Public ordinary functions
secp256k1-keypair-sec: Public ordinary functions
secp256k1-keypair-xonly-pub: Public ordinary functions
secp256k1-keypair-xonly-tweak-add: Public ordinary functions
secp256k1-schnorrsig-sign: Public ordinary functions
secp256k1-schnorrsig-sign-custom: Public ordinary functions
secp256k1-schnorrsig-verify: Public ordinary functions
secp256k1-scratch-space-create: Public ordinary functions
secp256k1-scratch-space-destroy: Public ordinary functions
secp256k1-tagged-sha256: Public ordinary functions
secp256k1-xonly-pubkey-cmp: Public ordinary functions
secp256k1-xonly-pubkey-from-pubkey: Public ordinary functions
secp256k1-xonly-pubkey-parse: Public ordinary functions
secp256k1-xonly-pubkey-serialize: Public ordinary functions
secp256k1-xonly-pubkey-tweak-add: Public ordinary functions
secp256k1-xonly-pubkey-tweak-add-check: Public ordinary functions
secret-key-verify: Public generic functions
secret-key-verify: Public generic functions
sharable-byte-array-from-array: Private ordinary functions
signature-destructure: Public generic functions
signature-destructure: Public generic functions
signature-from-components: Public ordinary functions
signature-normalize: Public generic functions
signature-normalize: Public generic functions
signature-parse: Public ordinary functions
signature-serialize: Public generic functions
signature-serialize: Public generic functions
signature-sign: Public generic functions
signature-sign: Public generic functions
signature-verify: Public generic functions
signature-verify: Public generic functions

W
with-foreign-byte-array: Private macros
with-pointer-to-vector-data-slot: Private macros

Jump to:   %   (  
E   F   G   M   P   R   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *   +  
C   D   F   S  
Index Entry  Section

*
*ctx*: Private special variables
*secp256k1-context-no-precomp*: Public symbol macros
*secp256k1-ecdh-hash-function-default*: Public symbol macros
*secp256k1-ecdh-hash-function-sha256*: Public symbol macros
*secp256k1-nonce-function-bip340*: Private symbol macros
*secp256k1-nonce-function-default*: Public symbol macros
*secp256k1-nonce-function-rfc6979*: Public symbol macros

+
+secp256k1-context-declassify+: Public constants
+secp256k1-context-none+: Public constants
+secp256k1-context-sign+: Public constants
+secp256k1-context-verify+: Public constants
+secp256k1-ec-compressed+: Public constants
+secp256k1-ec-uncompressed+: Public constants
+secp256k1-flags-bit-compression+: Public constants
+secp256k1-flags-bit-context-declassify+: Public constants
+secp256k1-flags-bit-context-sign+: Public constants
+secp256k1-flags-bit-context-verify+: Public constants
+secp256k1-flags-type-compression+: Public constants
+secp256k1-flags-type-context+: Public constants
+secp256k1-flags-type-mask+: Public constants
+secp256k1-tag-pubkey-even+: Public constants
+secp256k1-tag-pubkey-hybrid-even+: Public constants
+secp256k1-tag-pubkey-hybrid-odd+: Public constants
+secp256k1-tag-pubkey-odd+: Public constants
+secp256k1-tag-pubkey-uncompressed+: Public constants

C
Constant, +secp256k1-context-declassify+: Public constants
Constant, +secp256k1-context-none+: Public constants
Constant, +secp256k1-context-sign+: Public constants
Constant, +secp256k1-context-verify+: Public constants
Constant, +secp256k1-ec-compressed+: Public constants
Constant, +secp256k1-ec-uncompressed+: Public constants
Constant, +secp256k1-flags-bit-compression+: Public constants
Constant, +secp256k1-flags-bit-context-declassify+: Public constants
Constant, +secp256k1-flags-bit-context-sign+: Public constants
Constant, +secp256k1-flags-bit-context-verify+: Public constants
Constant, +secp256k1-flags-type-compression+: Public constants
Constant, +secp256k1-flags-type-context+: Public constants
Constant, +secp256k1-flags-type-mask+: Public constants
Constant, +secp256k1-tag-pubkey-even+: Public constants
Constant, +secp256k1-tag-pubkey-hybrid-even+: Public constants
Constant, +secp256k1-tag-pubkey-hybrid-odd+: Public constants
Constant, +secp256k1-tag-pubkey-odd+: Public constants
Constant, +secp256k1-tag-pubkey-uncompressed+: Public constants

D
data: Private classes
data: Private classes
data: Private classes
data: Private classes

F
format: Public conditions

S
Slot, data: Private classes
Slot, data: Private classes
Slot, data: Private classes
Slot, data: Private classes
Slot, format: Public conditions
Special Variable, *ctx*: Private special variables
Symbol Macro, *secp256k1-context-no-precomp*: Public symbol macros
Symbol Macro, *secp256k1-ecdh-hash-function-default*: Public symbol macros
Symbol Macro, *secp256k1-ecdh-hash-function-sha256*: Public symbol macros
Symbol Macro, *secp256k1-nonce-function-bip340*: Private symbol macros
Symbol Macro, *secp256k1-nonce-function-default*: Public symbol macros
Symbol Macro, *secp256k1-nonce-function-rfc6979*: Public symbol macros

Jump to:   *   +  
C   D   F   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   F   I   M   P   R   S   U  
Index Entry  Section

C
Class, public-key: Private classes
Class, recov-signature: Private classes
Class, secp256k1-context-tclass: Private classes
Class, secp256k1-ecdsa-recoverable-signature-tclass: Private classes
Class, secp256k1-ecdsa-signature-tclass: Private classes
Class, secp256k1-keypair-tclass: Private classes
Class, secp256k1-pubkey-tclass: Private classes
Class, secp256k1-schnorrsig-extraparams-tclass: Private classes
Class, secp256k1-scratch-space-tclass: Private classes
Class, secp256k1-xonly-pubkey-tclass: Private classes
Class, secret-key: Private classes
Class, signature: Private classes
Condition, incorrect-secret-key-error: Public conditions
Condition, public-key-parse-error: Public conditions
Condition, recov-signature-failure-error: Public conditions
Condition, recov-signature-parse-error: Public conditions
Condition, signature-failure-error: Public conditions
Condition, signature-parse-error: Public conditions

F
File, package.lisp: The secp256k1/src/package․lisp file
File, secp256k1-ffi.lisp: The secp256k1/src/secp256k1-ffi․lisp file
File, secp256k1.asd: The secp256k1/secp256k1․asd file
File, secp256k1.lisp: The secp256k1/src/secp256k1․lisp file
File, utils.lisp: The secp256k1/src/utils․lisp file

I
incorrect-secret-key-error: Public conditions

M
Module, src: The secp256k1/src module

P
Package, secp256k1: The secp256k1 package
Package, secp256k1-ffi: The secp256k1-ffi package
package.lisp: The secp256k1/src/package․lisp file
public-key: Private classes
public-key-parse-error: Public conditions

R
recov-signature: Private classes
recov-signature-failure-error: Public conditions
recov-signature-parse-error: Public conditions

S
secp256k1: The secp256k1 system
secp256k1: The secp256k1 package
secp256k1-context-tclass: Private classes
secp256k1-ecdsa-recoverable-signature-tclass: Private classes
secp256k1-ecdsa-signature-tclass: Private classes
secp256k1-ffi: The secp256k1-ffi package
secp256k1-ffi.lisp: The secp256k1/src/secp256k1-ffi․lisp file
secp256k1-keypair-tclass: Private classes
secp256k1-pubkey-tclass: Private classes
secp256k1-schnorrsig-extraparams-tclass: Private classes
secp256k1-scratch-space-tclass: Private classes
secp256k1-xonly-pubkey-tclass: Private classes
secp256k1.asd: The secp256k1/secp256k1․asd file
secp256k1.lisp: The secp256k1/src/secp256k1․lisp file
secret-key: Private classes
signature: Private classes
signature-failure-error: Public conditions
signature-parse-error: Public conditions
src: The secp256k1/src module
System, secp256k1: The secp256k1 system

U
utils.lisp: The secp256k1/src/utils․lisp file

Jump to:   C   F   I   M   P   R   S   U