Skip to content

feat(libSceLibreSsl): implement BN_print - #15480

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
JaceTheBlu:feat/libressl-bn-print
Nov 10, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
JaceTheBlu:feat/libressl-bn-print

Conversation

@JaceTheBlu

Copy link
Copy Markdown
Contributor

What

Implements BN_print in libSceLibreSsl. It was the last BN_ export left throwing, kept back in #9446 because there was no BIO yet; the memory BIO is on main now.

It follows LibreSSL 2.5.4 bn_print.c:

  • a - for a negative BIGNUM, then 0 when top is 0, so a negative zero prints -0;
  • otherwise the limbs from the top, in uppercase hex, without leading zeros, even when the top limbs are zero;
  • one BIO_write per character, returning 0 on the first write that does not write 1 byte, and 1 otherwise.

A null BIGNUM throws, like the other BN_ calls; LibreSSL dereferences it. A null BIO returns 0, as BIO_write does there.

The debt entry drops the sentence saying BN_print throws, and the pending count goes down by one.

Tested

  • GuestLibreSslBn: 0, -1A, 00F, a two-limb value, a 128-bit value, a non-normalized BIGNUM whose top limb is zero, a negative zero, a read-only BIO and a null BIO. The expected strings and return values come from a small program linked against the LibreSSL 2.5.4 libcrypto.a built by the oracle.
  • All 52 libressl|crypto_memcmp tests pass on Linux. Not run on Windows or macOS.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Progress report (fed64e5 → bf6d46b)

📈 System libraries: 35.75% (+0.0026%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceLibreSsl BN_print_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl 282/446 (63.23%) 283/446 (63.45%) +0.22%

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 16529 BN_print

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 11146 core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 11176 core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 11466 core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 14115 core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 14212 docs/dev/debt/libSceLibreSsl.md
PR 15737 docs/dev/debt/libSceLibreSsl.md
PR 16529 core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
core/libs/prx/libSceLibreSsl/src/Bignum.cpp
docs/dev/debt/libSceLibreSsl.md
PR 16543 core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md

@adriadam10 adriadam10 self-assigned this Nov 7, 2026
@adriadam10
adriadam10 force-pushed the feat/libressl-bn-print branch from d789a5e to a5b7874 Compare November 7, 2026 06:07
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 7, 2026
@adriadam10
adriadam10 force-pushed the feat/libressl-bn-print branch from a5b7874 to 1d91c72 Compare November 7, 2026 20:40
Write the sign, a single 0 for an empty BIGNUM, and the uppercase hex
digits of the limbs without leading zeros, one BIO_write per character
as LibreSSL 2.5.4 bn_print.c does, returning 0 on the first short write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adriadam10
adriadam10 force-pushed the feat/libressl-bn-print branch from 1d91c72 to bf6d46b Compare November 10, 2026 04:01
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 10, 2026
@adriadam10
adriadam10 merged commit b12b49a into boykopovar:main Nov 10, 2026
13 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked BN_print against LibreSSL 2.5.4 bn_print.c (sign, zero, leading-zero suppression, one BIO_write per character, early return 0), the new GuestLibreSslBn cases (each throws without the change), and the debt entry. Rebased onto current main (conflict in the libSceLibreSsl debt file, resolved); merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants