Skip to content

crypto: P-256 on BearSSL, key pairs from a raw scalar, ECDSA with RFC 6979 and low S, raw ECDH, SPKI and PKCS#8 - #13

Merged
pinhopro merged 30 commits into
mainfrom
crypto/p256
Nov 22, 2026
Merged

pinhopro merged 30 commits into
mainfrom
crypto/p256

Conversation

@pinhopro

Copy link
Copy Markdown
Contributor

The foundation's increment 3, P-256 on BearSSL (stream 3a, Tasks 3.1 to 3.6), for webcpp::trystero's port to Trystero 0.27.0.

  • curves::p256: basic_keypair (make from a raw scalar, generate, public_key, secret_scalar, sign_ecdsa, ecdh_x), basic_public_key (make from the 65-byte uncompressed point or from x and y, uncompressed), verify_ecdsa, to_der, from_der, normalize_ecdsa, check_low_s; curves/p256/formats.hpp: strict encode_spki/decode_spki, encode_pkcs8/decode_pkcs8, PEM through pem.
  • The engine on BearSSL (m62 natively where available, m31 on WebAssembly), every public function under detail::timing_guard, nothing allocated.
  • Tests: RFC 6979, Wycheproof (ECDSA P1363 and DER, ECDH, ecpoint), OpenSSL natively and node's WebCrypto on Emscripten as outside oracles with corrupted twins, timing coverage, allocation, messages; examples p256_keys, p256_sign, p256_ecdh, p256_key_formats; the page doc/p256.adoc.
  • Constant time: dudect natively and on wasip2; memcheck and MemorySanitizer in an arm64 Linux container found upstream BearSSL's ECDSA signing branching on the RFC 6979 nonce's bit length; the superproject's BearSSL pin carries the one-commit fix (webcpporg/bearssl webcpp branch, 32381d6), and the checkers then find nothing.
  • Sizes and throughput measured in release, marked provisional for the final measurement pass.

Verified locally on the merged heads: native clang and gcc-15, wasip2, wasip3 and Emscripten, debug and release; the tools tests; the macOS full lint; the Linux lint (changed mode); MSVC 14.3 and 14.5 (593 passed each, no new failure). CI deferred to the coordinator's final run.

R added 30 commits November 20, 2026 23:28
…n BearSSL, with the family p256 and its default
…nd choice, and its pages fix the wording the review found
…d low S as two primitives, against RFC 6979 and Wycheproof
…and each Doc Comment's brief is one sentence
…r a moved-from signer and replay their seed, and its pages state what BearSSL leaves on its stack
…nate as WebCrypto's deriveBits does, against Wycheproof
… Wycheproof test requires invalid_public_key and bounds its draws, and its page cites what BearSSL's multiplication leaves on its stack
…layouts, strict, with BearSSL's encoder as their oracle
…, their constants and the Wycheproof reasons take the lint's trailing commas, and the changelog's BearSSL line stays within thirty words
…sizes and PEM around them, decode_spki passes a backend failure through, and the formats' pages read more plainly
…e keys, deriveBits with ECDH into HKDF-SHA-256, at its commit, file and lines
… Asciidoctor renders inside the span, and the Jamfile's comment fits its eighty columns
…g, BearSSL's DER decoder offsets its iterators by a signed difference, and OpenSSL's oracle reads keys through const pointers, as clang-tidy asks
… our PKCS#8, the public key's row names both oracles, the page says the corrupted twin disagrees, and OpenSSL's ECDSA page is a source
… without a literal ++ and the resources of std::pmr without a possessive after inline code, as the doc build's checks ask
…efore printing it, as the lint's fluent-chain rule asks, and build.jam's first comment fits its eighty columns
…d ECDH on every target, provisional, from release builds
…DH on BearSSL on every target, from the release lane sizes
… are, the BearSSL suppression says what a moved pin re-reads and why MemorySanitizer needs none, the ECDH verdict's comment names both curve implementations, and the handshake section cites WebCrypto and Trystero's low-S refusals
… webcpp branch, upstream 7bea48e with the fix to ECDSA's nonce decoding
…nd MemorySanitizer in an arm64 Linux container on 2026-11-21, the leak of the ECDSA nonce's bit length they found in upstream BearSSL and the one-commit fix webcpp's BearSSL carries
…e changelog names curves::p256, the sodium refusal, the key pair moves enter no guard, the Wycheproof breakdown is asserted, decode_spki's errors, overview lists P-256
… a function of their own, within clang-tidy's cognitive complexity
…defaults and secp256k1 generate, into P-256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant