libSceLibreSsl3 forwards EC_KEY_new, EC_KEY_new_by_curve_name and
EC_KEY_free here, while its EC_KEY_up_ref increments the counter at
offset 48 of LibreSSL 4.0.0's 64-byte EC_KEY. On the 8-byte keys of the
previous commit, that write lands past the end of the key.
Keys now have that layout and LibreSSL 2.5.4 EC_KEY_new's defaults:
version 1, uncompressed conversion form, the group in its group slot
and the reference count, starting at one, at offset 48. EC_KEY_free
decrements it atomically and frees the key at zero or below, as
LibreSSL does.
libSceLibreSsl3's interface and code are unchanged.
Co-authored-by: Ahmad Mujahid <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
BIO_up_ref adds one to the reference count of a caller-owned BIO through
the shared retain in Reference.hpp and returns 1 when the new count is
above 1, as CRYPTO_add(...) > 1 does. LibreSsl3Bio in Key.hpp is the
112-byte BIO with its counter at offset 80.
Behaviour and layout follow LibreSSL 4.0.0 (ce488b78e0bd): bio_lib.c
L198-L202 and bio_local.h. No upstream source is copied.