mirror of
https://github.com/openssl/openssl.git
synced 2026-05-07 20:12:39 +00:00
80b7e49c27
When using openssl pkeyutl -rawin or openssl dgst for one-shot sign/verify (e.g. Ed25519, Ed448), file input is now read via mmap() on Unix where supported, avoiding a full buffer allocation and copy. Large files are supported without doubling memory use; on failure of the mmap path we do not fall back to the buffer path. - Add app_mmap_file() in apps/lib/apps.c: stat/open/mmap/close, tri-state return (1 mapped, 0 size zero, -1 error). Parameter err_bio avoids shadowing global bio_err (-Wshadow). - apps/pkeyutl.c and apps/dgst.c: use app_mmap_file(); single exit for mmap path in pkeyutl; dgst includes apps.h first for _FILE_OFFSET_BITS; do_fp_oneshot_sign returns EXIT_SUCCESS/EXIT_FAILURE like do_fp(); no fallback when mmap attempted but fails. - pkeyutl mmap/buffer path: pass filesize to EVP_DigestVerify and EVP_DigestSign (review suggestion, avoids casting buf_len). - Error messages: per-file messages for stat/size (dgst, pkeyutl); CHANGES.md "Unix-like" and "16 MB" (documentation style). - Centralize _FILE_OFFSET_BITS and mmap includes in apps/include/apps.h. - Tests: pkeyutl/dgst oneshot from file, no-fallback regression tests; use srctop_dir for test paths; stderr patterns for mmap errors. - Docs: man pages and CHANGES.md. CI fixes: return failure from dgst one-shot sign when mmap fails; treat non-regular paths as mmap errors in app_mmap_file() and pkeyutl; reject directories before mmap. Addresses review feedback from DDvO, npajkovsky, and vdukhovni (PR #30429). Fixes #11677 Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org> Co-authored-by: David von Oheimb <DDvO@users.noreply.github.com> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> MergeDate: Fri Mar 27 16:25:33 2026 (Merged from https://github.com/openssl/openssl/pull/30429)