@@ -486,6 +486,13 @@ BOMSH_SPDX_OUT = omnibor.wolfssl-$(PACKAGE_VERSION).spdx.json
486486# the on-disk gitoid disagrees, so the install-time relink remains
487487# visible.
488488BOMSH_ARTEFACT_MANIFEST = $(abs_builddir ) /_bomsh.artefact
489+ # Byte-identical copy of the traced library, captured BEFORE `make sbom`
490+ # runs `make install` (during which libtool relinks src/.libs/lib*.so*
491+ # in place to fix RPATH). bomsh_sbom.py hashes the file at -f at call
492+ # time rather than reading the ADG, so pointing -f at this snapshot keeps
493+ # the SPDX externalRef pinned to the bomsh-traced gitoid -- otherwise it
494+ # would hash the post-relink bytes and disagree with the manifest.
495+ BOMSH_ARTEFACT_SNAPSHOT = $(abs_builddir ) /_bomsh.snapshot
489496bomshdir = $(datadir ) /doc/$(PACKAGE )
490497
491498.PHONY : bomsh install-bomsh uninstall-bomsh
@@ -514,15 +521,10 @@ bomsh:
514521 @printf ' raw_logfile=%s\n' ' $(BOMSH_RAWLOG_BASE)' > ' $(BOMSH_CONF)'
515522 $(BOMTRACE3 ) -c ' $(BOMSH_CONF)' $(MAKE )
516523 $(BOMSH_CREATE_BOM ) -r ' $(BOMSH_RAWLOG)' -b ' $(BOMSH_OMNIBORDIR)'
517- @# Capture the gitoid of the bomtrace3-traced library BEFORE the
518- @# `make sbom` below, which calls `make install DESTDIR=...` --
519- @# libtool's --mode=install relinks src/.libs/lib*.so* in place
520- @# to fix RPATH, mutating the bytes that bomsh recorded in the
521- @# ADG via bomsh_create_bom above. Capturing here pins the
522- @# verifier's check (C) to the bomsh-traced gitoid (so SPDX <->
523- @# manifest agree even though the on-disk bytes diverge after
524- @# install). The on-disk divergence is surfaced as a verifier
525- @# warning, not a failure.
524+ @# Snapshot the traced library before `make sbom`'s install-time
525+ @# libtool relink rewrites it (RPATH fix). -f points at the snapshot
526+ @# so bomsh_sbom.py emits the bomsh-traced gitoid; the manifest's path
527+ @# field stays on the live library so the verifier's NOTE keeps firing.
526528 @bomsh_artifact=" " ; \
527529 for lib in \
528530 $(addprefix "$(abs_builddir ) /src/.libs"/,$(WOLFSSL_LIB_DSO_BASENAMES ) ) \
@@ -531,7 +533,8 @@ bomsh:
531533 if test -f " $$ lib" ; then bomsh_artifact=" $$ lib" ; break ; fi ; \
532534 done ; \
533535 if test -n " $$ bomsh_artifact" ; then \
534- bomsh_artifact_gid=` $( PYTHON3) -c ' import hashlib,sys;d=open(sys.argv[1],"rb").read();h=hashlib.sha1();h.update(("blob %d\0"%len(d)).encode());h.update(d);print(h.hexdigest())' " $$ bomsh_artifact" ` ; \
536+ cp " $$ bomsh_artifact" ' $(BOMSH_ARTEFACT_SNAPSHOT)' ; \
537+ bomsh_artifact_gid=` $( PYTHON3) -c ' import hashlib,sys;d=open(sys.argv[1],"rb").read();h=hashlib.sha1();h.update(("blob %d\0"%len(d)).encode());h.update(d);print(h.hexdigest())' ' $(BOMSH_ARTEFACT_SNAPSHOT)' ` ; \
535538 printf ' %s\t%s\n' " $$ bomsh_artifact" " $$ bomsh_artifact_gid" \
536539 > ' $(BOMSH_ARTEFACT_MANIFEST)' ; \
537540 fi
@@ -541,17 +544,18 @@ bomsh:
541544 echo " The OmniBOR graph in $( BOMSH_OMNIBORDIR) is still produced." ; \
542545 exit 0; \
543546 fi ; \
544- if test ! -f ' $(BOMSH_ARTEFACT_MANIFEST)' ; then \
547+ if test ! -f ' $(BOMSH_ARTEFACT_MANIFEST)' \
548+ || test ! -f ' $(BOMSH_ARTEFACT_SNAPSHOT)' ; then \
545549 echo " NOTE: no built libwolfssl artifact found in $( abs_builddir) /src/.libs/" ; \
546550 echo " OmniBOR graph produced; SPDX enrichment skipped." ; \
547551 exit 0; \
548552 fi ; \
549553 bomsh_artifact=` awk ' NR==1 {print $$1}' ' $(BOMSH_ARTEFACT_MANIFEST)' ` ; \
550- echo " Enriching SPDX with OmniBOR ExternalRefs (artifact: $$ bomsh_artifact)..." ; \
554+ echo " Enriching SPDX with OmniBOR ExternalRefs (artifact: $$ bomsh_artifact, snapshot: $( BOMSH_ARTEFACT_SNAPSHOT ) )..." ; \
551555 $(BOMSH_SBOM ) \
552556 -b ' $(BOMSH_OMNIBORDIR)' \
553557 -i ' $(abs_builddir)/$(SBOM_SPDX)' \
554- -f " $$ bomsh_artifact " \
558+ -f ' $(BOMSH_ARTEFACT_SNAPSHOT) ' \
555559 -s spdx-json \
556560 -O ' $(abs_builddir)'
557561
@@ -568,7 +572,7 @@ uninstall-bomsh:
568572 -rm -rf ' $(DESTDIR)$(bomshdir)/omnibor'
569573 -rm -f ' $(DESTDIR)$(bomshdir)/$(BOMSH_SPDX_OUT)'
570574
571- CLEANFILES += $(BOMSH_RAWLOG ) $(BOMSH_RAWLOG_BASE ) .sha256 $(BOMSH_CONF ) $(BOMSH_SPDX_OUT ) $(BOMSH_ARTEFACT_MANIFEST )
575+ CLEANFILES += $(BOMSH_RAWLOG ) $(BOMSH_RAWLOG_BASE ) .sha256 $(BOMSH_CONF ) $(BOMSH_SPDX_OUT ) $(BOMSH_ARTEFACT_MANIFEST ) $( BOMSH_ARTEFACT_SNAPSHOT )
572576
573577# Hook SBOM/Bomsh cleanup into `make uninstall` so packagers don't leave
574578# stale artefacts behind after install-sbom/install-bomsh. uninstall-sbom
0 commit comments