Skip to content

Commit

Permalink
chore: merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
blake-regalia committed Apr 12, 2024
1 parent 75844af commit 4e80ac0
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
8 changes: 6 additions & 2 deletions docs/assets/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/index.js.map

Large diffs are not rendered by default.

Binary file modified docs/out/secp256k1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/api/emsimp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {ImportMapper} from 'src/types';
import type {ImportMapper} from '../types';

export const emsimp = (f_map_imports: ImportMapper, s_tag: string) => {
s_tag += ': ';
Expand Down
5 changes: 2 additions & 3 deletions src/api/secp256k1.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type {PointerNonceFn, PointerPubkey, PointerSeed, PointerSig, Secp256k1WasmCore, Secp256k1WasmEcdh, Secp256k1WasmEcdsaRaw} from './secp256k1-types.js';
import type {ByteSize, Pointer} from '../types.js';

import type {Promisable} from '@blake.regalia/belt';

import {bytes} from '@blake.regalia/belt';

import {emsimp} from './emsimp.js';
import {BinaryResult, ByteLens, Flags} from './secp256k1-types.js';
import {map_wasm_exports, map_wasm_imports} from '../gen/wasm.js';
Expand All @@ -14,8 +15,6 @@ const S_TAG_ECDSA_VERIFY = 'ECDSA verify: ';
const S_REASON_INVALID_SK = 'Invalid private key';
const S_REASON_INVALID_PK = 'Invalid public key';

const bytes = (nb_len: number) => new Uint8Array(nb_len);

const random_32 = () => crypto.getRandomValues(bytes(32));

/**
Expand Down
8 changes: 7 additions & 1 deletion src/gen/wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ export interface WasmExportsExtension extends WasmExports {
ec_pubkey_create: Function;
context_randomize: Function;
ecdh: Function;
_emscripten_stack_restore: Function;
_emscripten_stack_alloc: Function;
emscripten_stack_get_current: Function;
}

export const map_wasm_imports = (g_imports: WasmImportsExtension) => ({
a: {
a: g_imports.abort,
f: g_imports.memcpy,
a: g_imports.abort,
d: g_imports.resize,
e: () => 52, // _fd_close,
c: () => 70, // _fd_seek,
Expand All @@ -65,6 +68,9 @@ export const map_wasm_exports = <
context_randomize: g_exports['u'],
ecdh: g_exports['v'],
sbrk: g_exports['sbrk'],
_emscripten_stack_restore: g_exports['_emscripten_stack_restore'],
_emscripten_stack_alloc: g_exports['_emscripten_stack_alloc'],
emscripten_stack_get_current: g_exports['emscripten_stack_get_current'],
memory: g_exports['g'],

init: () => (g_exports['h'] as VoidFunction)(),
Expand Down
4 changes: 2 additions & 2 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const h_exports: Dict<string> = {};

const H_TYPES: Dict = {
_abort: `() => void`,
_emscripten_memcpy_js: `(ip_dst: Pointer, ip_src: Pointer, nb_size: ByteSize) => Uint8Array`,
__emscripten_memcpy_js: `(ip_dst: Pointer, ip_src: Pointer, nb_size: ByteSize) => Uint8Array`,
_emscripten_resize_heap: `(nb_size: ByteSize) => void`,
_fd_close: `() => FileDescriptor`,
_fd_seek: `(i_fd: FileDescriptor, ib_off_lo: ByteOffset, ib_off_hi: ByteOffset, xc_whence: SeekWhence, ib_off_new: ByteOffset) => FileDescriptor`,
Expand All @@ -45,7 +45,7 @@ const H_TYPES: Dict = {

const H_RENAME_IMPORTS: Dict = {
_abort: 'abort',
_emscripten_memcpy_js: 'memcpy',
__emscripten_memcpy_js: 'memcpy',
_emscripten_resize_heap: 'resize',
_fd_write: 'write',
};
Expand Down
2 changes: 1 addition & 1 deletion submodules/libsecp256k1
Submodule libsecp256k1 updated 50 files
+1 −1 .github/actions/install-homebrew-valgrind/action.yml
+5 −0 .github/actions/run-in-docker-action/action.yml
+11 −1 CHANGELOG.md
+37 −18 CMakeLists.txt
+107 −0 CONTRIBUTING.md
+0 −1 Makefile.am
+10 −27 README.md
+17 −2 ci/ci.sh
+12 −0 cmake/AllTargetsCompileOptions.cmake
+25 −22 configure.ac
+2 −2 contrib/lax_der_parsing.h
+36 −31 doc/release-process.md
+33 −33 include/secp256k1.h
+1 −1 include/secp256k1_ecdh.h
+2 −2 include/secp256k1_ellswift.h
+5 −5 include/secp256k1_extrakeys.h
+7 −7 include/secp256k1_preallocated.h
+10 −10 include/secp256k1_recovery.h
+2 −2 include/secp256k1_schnorrsig.h
+1 −0 src/asm/field_10x26_arm.s
+52 −48 src/assumptions.h
+44 −15 src/bench_internal.c
+7 −0 src/checkmem.h
+4 −3 src/ecdsa_impl.h
+215 −170 src/ecmult_const_impl.h
+6 −3 src/field.h
+0 −4 src/field_10x26_impl.h
+0 −504 src/field_5x52_asm_impl.h
+0 −4 src/field_5x52_impl.h
+4 −9 src/field_5x52_int128_impl.h
+99 −61 src/field_impl.h
+8 −0 src/group.h
+110 −90 src/group_impl.h
+11 −22 src/modinv32_impl.h
+16 −28 src/modinv64_impl.h
+11 −10 src/modules/ellswift/main_impl.h
+1 −1 src/modules/ellswift/tests_exhaustive_impl.h
+7 −7 src/modules/ellswift/tests_impl.h
+5 −5 src/scalar.h
+119 −79 src/scalar_4x64_impl.h
+86 −64 src/scalar_8x32_impl.h
+9 −11 src/scalar_impl.h
+9 −2 src/scalar_low.h
+40 −47 src/scalar_low_impl.h
+14 −25 src/secp256k1.c
+176 −162 src/tests.c
+12 −13 src/tests_exhaustive.c
+0 −26 src/testutil.h
+18 −9 src/util.h
+67 −0 tools/check-abi.sh

0 comments on commit 4e80ac0

Please sign in to comment.