Skip to content

fix: declare Digest dependency and zero XS digest buffer - #71

Draft
toddr-bot wants to merge 2 commits into
cpan-authors:mainfrom
toddr-bot:koan.toddr.bot/fix-digest-dep-and-xs-zeroing
Draft

fix: declare Digest dependency and zero XS digest buffer#71
toddr-bot wants to merge 2 commits into
cpan-authors:mainfrom
toddr-bot:koan.toddr.bot/fix-digest-dep-and-xs-zeroing

Conversation

@toddr-bot

@toddr-bot toddr-bot commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

What

Declare Digest as a runtime prerequisite and zero the digest extraction
buffer in the XS layer.

Why

Digest dependency: The Digest::base integration (PR #58) added
use base 'Digest::base' but never declared Digest in PREREQ_PM or
cpanfile. On minimal Perl installations where core modules are packaged
separately, this causes a confusing "Can't locate Digest/base.pm" error
at load time.

d_str zeroing: The stack-local d_str[20] buffer in rmd160_digest
holds the final digest bytes and was the last unzeroed crypto buffer in
the call chain. While the security impact is minimal (the caller receives
the same data via the returned SV), this closes the last gap in the
memory-zeroing arc (struct: #39, MDfinish: #44, secure_memzero: #50,
update X[]: #52, update/final: #67, compress: #68).

How

  • Added 'Digest' => 0 to PREREQ_PM in Makefile.PL
  • Added requires 'Digest' => 0 to cpanfile
  • Added secure_memzero(d_str, sizeof(d_str)) after newSVpvn in
    rmd160_digest

Testing

Full test suite passes. Verified Digest appears in generated MYMETA.json
runtime requires.


Quality Report

Changes: 3 files changed, 3 insertions(+)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan

Add Digest to PREREQ_PM and cpanfile — the Digest::base
integration (PR cpan-authors#58) introduced a runtime dependency that was
never declared. On minimal Perl installations where core modules
are split into packages, this causes "Can't locate Digest/base.pm"
at load time.

Zero d_str[20] in rmd160_digest after copying bytes into the SV.
This stack-local buffer held the final digest and was the last
unzeroed crypto buffer in the call chain (struct: cpan-authors#39, MDfinish: cpan-authors#44,
secure_memzero: cpan-authors#50, update X[]: cpan-authors#52, update/final: cpan-authors#67,
compress: cpan-authors#68).
The cpm dependency manager now requires Perl 5.24+, breaking the
Install Dependencies step on all older Perl containers (5.8-5.22).

Fix by removing the Install Dependencies step from the matrix job
entirely — all runtime and test dependencies (XSLoader, Carp,
Test::More) are core Perl modules. Also remove AUTHOR_TESTING and
RELEASE_TESTING env vars since author tests (Test::Pod,
Test::Pod::Coverage) are already covered by the ubuntu and disttest
jobs.
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