Skip to content

Commit

Permalink
docs: minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jgriffiths committed Sep 20, 2023
1 parent 06ce5e7 commit 7446283
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $ brew install swig
### configure options

- `--enable-debug`. Enables debugging information and disables compiler
optimisations (default: no).
optimizations (default: no).
- `--enable-minimal`. Minimises library size and memory requirements to target
embedded or resource-constrained environments (default: no).
- `--enable-asm`. Enables fast assembly language implementations where available.
Expand Down
18 changes: 10 additions & 8 deletions include/wally_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ WALLY_CORE_API int wally_scrypt(
/**
* Get the length of encrypted/decrypted data using AES (ECB mode, no padding).
*
* :param key: Key material for initialisation.
* :param key: Encryption/decryption key.
* :param key_len: Length of ``key`` in bytes. Must be one of the :ref:`aes-key-length`.
* :param bytes: Bytes to encrypt/decrypt.
* :param bytes_len: Length of ``bytes`` in bytes. Must be a multiple of `AES_BLOCK_LEN`.
Expand All @@ -69,7 +69,7 @@ WALLY_CORE_API int wally_aes_len(
/**
* Encrypt/decrypt data using AES (ECB mode, no padding).
*
* :param key: Key material for initialisation.
* :param key: Encryption/decryption key.
* :param key_len: Length of ``key`` in bytes. Must be one of the :ref:`aes-key-length`.
* :param bytes: Bytes to encrypt/decrypt.
* :param bytes_len: Length of ``bytes`` in bytes. Must be a multiple of `AES_BLOCK_LEN`.
Expand All @@ -89,9 +89,10 @@ WALLY_CORE_API int wally_aes(
/**
* Get the maximum length of encrypted/decrypted data using AES (CBC mode, PKCS#7 padding).
*
* :param key: Key material for initialisation.
* :param key: Encryption/decryption key.
* :param key_len: Length of ``key`` in bytes. Must be one of the :ref:`aes-key-length`.
* :param iv: Initialisation vector.
* :param iv: Initialization vector. For encryption this should be secure entropy. For
*| decryption the bytes used when encrypting must be given.
* :param iv_len: Length of ``iv`` in bytes. Must be `AES_BLOCK_LEN`.
* :param bytes: Bytes to encrypt/decrypt.
* :param bytes_len: Length of ``bytes`` in bytes. Can be of any length for encryption, must be a multiple of `AES_BLOCK_LEN` for decryption.
Expand All @@ -111,9 +112,10 @@ WALLY_CORE_API int wally_aes_cbc_get_maximum_length(
/**
* Encrypt/decrypt data using AES (CBC mode, PKCS#7 padding).
*
* :param key: Key material for initialisation.
* :param key: Encryption/decryption key.
* :param key_len: Length of ``key`` in bytes. Must be one of the :ref:`aes-key-length`.
* :param iv: Initialisation vector.
* :param iv: Initialization vector. For encryption this should be secure entropy. For
*| decryption the bytes used when encrypting must be given.
* :param iv_len: Length of ``iv`` in bytes. Must be `AES_BLOCK_LEN`.
* :param bytes: Bytes to encrypt/decrypt.
* :param bytes_len: Length of ``bytes`` in bytes. Can be of any length for encryption, must be a multiple of `AES_BLOCK_LEN` for decryption.
Expand Down Expand Up @@ -896,7 +898,7 @@ WALLY_CORE_API int wally_s2c_commitment_verify(
*
* :param priv_key: The callers private key used for Diffie-Helman exchange.
* :param priv_key_len: The length of ``priv_key`` in bytes. Must be `EC_PRIVATE_KEY_LEN`.
* :param iv: Initialisation vector. Only required when encrypting, otherwise pass NULL.
* :param iv: Initialization vector. Only required when encrypting, otherwise pass NULL.
* :param iv_len: Length of ``iv`` in bytes. Must be `AES_BLOCK_LEN`.
* :param bytes: Bytes to encrypt/decrypt.
* :param bytes_len: Length of ``bytes`` in bytes.
Expand Down Expand Up @@ -927,7 +929,7 @@ WALLY_CORE_API int wally_aes_cbc_with_ecdh_key_get_maximum_length(
*
* :param priv_key: The callers private key used for Diffie-Helman exchange.
* :param priv_key_len: The length of ``priv_key`` in bytes. Must be `EC_PRIVATE_KEY_LEN`.
* :param iv: Initialisation vector. Only required when encrypting, otherwise pass NULL.
* :param iv: Initialization vector. Only required when encrypting, otherwise pass NULL.
* :param iv_len: Length of ``iv`` in bytes. Must be `AES_BLOCK_LEN` if encrypting otherwise 0.
* :param bytes: Bytes to encrypt/decrypt.
* :param bytes_len: Length of ``bytes`` in bytes.
Expand Down
2 changes: 1 addition & 1 deletion include/wally_transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern "C" {
#define WALLY_TX_FLAG_ALLOW_PARTIAL 0x4 /* Allow partially complete transactions */
/* Note: This flag encodes/parses transactions that are ambiguous to decode.
Unless you have a good reason to do so you will most likely not need it */
#define WALLY_TX_FLAG_PRE_BIP144 0x8 /* Encode/Decode using pre-BIP 144 serialisation */
#define WALLY_TX_FLAG_PRE_BIP144 0x8 /* Encode/Decode using pre-BIP 144 serialization */

#define WALLY_TX_FLAG_BLINDED_INITIAL_ISSUANCE 0x1

Expand Down
4 changes: 2 additions & 2 deletions src/coins.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ typedef struct value_remaining {
* the io_ratio passed in, which increases the search space and prefers to
* use more inputs if a changeless solution is found.
*
* We implement the core optimisations:
* We implement the core optimizations:
* - Cut the search branch when it cannot reach the target
* - Cut the search branch when it exceeds the target (after scoring it)
* - Do not test equivalent combinations
*
* We add two additional optimisations. First, we return immediately if we find
* We add two additional optimizations. First, we return immediately if we find
* a single input exact match, since that represents the best match possible.
* Second, we cut the search branch when the number of selected inputs
* is enough that even an exact match would not score better than the current
Expand Down
2 changes: 1 addition & 1 deletion src/ctest/test_clear.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extern void __asan_unpoison_memory_region(void const volatile *addr, size_t size
* determine that the memory is not read afterwards. There are reports
* that tricks designed to work around this including making data volatile,
* calling through function pointers, dummy asm contraints etc are
* not always effective as optimisation continues to improve.
* not always effective as optimization continues to improve.
*
* Here we try to ensure that the wally_clear/wally_clear_n() functions work as advertised
* by:
Expand Down
2 changes: 1 addition & 1 deletion src/swig_java/src/com/blockstream/test/test_bip32.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void test() {
final byte[] initSerialized = Wally.bip32_key_serialize(initKey, BIP32_FLAG_KEY_PRIVATE);

if (!h(initSerialized).equals(h(derivedSerialized)))
throw new RuntimeException("BIP32 initialisation by member failed");
throw new RuntimeException("BIP32 initialization by member failed");

final byte[] message = Wally.bip32_key_get_chain_code(derivedKey);
final byte[] signature = Wally.ec_sig_from_bytes(Wally.bip32_key_get_priv_key(derivedKey),
Expand Down
2 changes: 1 addition & 1 deletion src/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -2794,7 +2794,7 @@ static int analyze_tx(const unsigned char *bytes, size_t bytes_len,

if (is_elements) {
if (flags & WALLY_TX_FLAG_PRE_BIP144)
return WALLY_EINVAL; /* No pre-BIP 144 serialisation for elements */
return WALLY_EINVAL; /* No pre-BIP 144 serialization for elements */
*expect_witnesses = *p++ != 0;
} else {
if (!(flags & WALLY_TX_FLAG_PRE_BIP144) && *p == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/wasm_package/src/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export const WALLY_TX_DUMMY_SIG = 0x2; /* A dummy signature */
export const WALLY_TX_DUMMY_SIG_LOW_R = 0x4; /* A dummy signature created with EC_FLAG_GRIND_R */
export const WALLY_TX_FLAG_ALLOW_PARTIAL = 0x4; /* Allow partially complete transactions */
export const WALLY_TX_FLAG_BLINDED_INITIAL_ISSUANCE = 0x1;
export const WALLY_TX_FLAG_PRE_BIP144 = 0x8; /* Encode/Decode using pre-BIP 144 serialisation */
export const WALLY_TX_FLAG_PRE_BIP144 = 0x8; /* Encode/Decode using pre-BIP 144 serialization */
export const WALLY_TX_FLAG_USE_ELEMENTS = 0x2; /* Encode/Decode as an elements transaction */
export const WALLY_TX_FLAG_USE_WITNESS = 0x1; /* Encode witness data if present */
export const WALLY_TX_INDEX_MASK = 0x3fffffff;
Expand Down
2 changes: 1 addition & 1 deletion src/wasm_package/test/bip32.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ test('BIP32 derivation', () => {
const derivedSerialized = wally.bip32_key_serialize(derivedKey, wally.BIP32_FLAG_KEY_PRIVATE)
const initSerialized = wally.bip32_key_serialize(initKey, wally.BIP32_FLAG_KEY_PRIVATE)

assert.deepEqual(initSerialized, derivedSerialized, 'BIP32 initialisation by member failed')
assert.deepEqual(initSerialized, derivedSerialized, 'BIP32 initialization by member failed')

wally.bip32_key_free(seedKey)
wally.bip32_key_free(derivedKey)
Expand Down

0 comments on commit 7446283

Please sign in to comment.