test(coverage): exercise the encryption path (sec001+sec002) in the subset - #84
Merged
Conversation
crypto/ and hmac/ were the coldest reachable surface in the bounded coverage subset because no other subset test opens an encrypted env or db -- AES page/log encryption, the HMAC-SHA1 password/checksum path, and the mt19937 IV generator only run under DB_ENV->set_encrypt(DB_ENCRYPT_AES) + DB->set_flags(DB_ENCRYPT). Add the already-registered sec001 (encryption interface + wrong/empty password + algorithm-mismatch error branches) and sec002 (page-encryption round-trip + meta/root-page checksum-error -> DB_RUNRECOVERY paths) to the default COV_TESTS. No new Tcl written. Measured lift (subset baseline -> with sec001+sec002): crypto/mersenne/mt19937db.c 0.0 -> 95.6 line / 56.2 br hmac/hmac.c 10.4 -> 91.0 line / 80.0 br crypto/rijndael/rijndael-alg-fst.c 18.8 -> 83.5 line / 55.0 br crypto/crypto.c 50.7 -> 77.9 line / 60.5 br crypto/aes_method.c 27.8 -> 44.3 line / 36.6 br crypto/rijndael/rijndael-api-fst.c 6.3 -> 29.8 line / 21.9 br hmac/sha1.c 97.4 -> 98.7 line / 72.7 br rijndael-api-fst.c caps at ~30% by design: aes_method.c only ever uses AES MODE_CBC, so the ECB/CFB1 branches and the entire padEncrypt/padDecrypt/ cipherUpdateRounds halves are dead code from BDB's point of view. aes_method.c's remaining cold lines are the HAVE_CRYPTO_IPP alternate backend (not this build) and the __aes_err table / EAGAIN branches, which need an internal cipher error (bad key length / bad state) not reachable through the public API without fault injection.
Coccinelle convention checksNo new violations. ✅ Resolved since baseline (2) -- update dist/cocci/baseline.txt to lock these in. |
ABI diff vs
|
This was referenced Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Raises coverage of the cold crypto/hmac surface by running an encrypted workload in the bounded coverage subset.
Why it was cold
crypto/+hmac/sat cold inrun_coverage.sh's subset because no subset test opened an encrypted env or db. AES page/log encryption, the HMAC-SHA1 password/checksum path, and the mt19937 IV generator (__db_generate_iv) only run underDB_ENV->set_encrypt(passwd, DB_ENCRYPT_AES)+DB->set_flags(DB_ENCRYPT).What changed
Added the two already-registered encryption Tcl tests to the default
COV_TESTS(sec001: sec002:). No new Tcl written.DB_ENCRYPT_ANY, and every failure branch (empty password, algorithm-not-supplied, join-mismatch, wrong-length password, wrong password, open-encrypted-with-no-key). Drives cipher setup + auth-failure branches incrypto.cand key derivation inaes_method.c.metadata page checksum error→DB_RUNRECOVERY).run_secmethod/run_secenv(full access-method test twice under encryption) add only ~1–2 pp over sec001+sec002 for ~double the runtime, so they are deliberately left out.Coverage before → after (bounded subset)
crypto/mersenne/mt19937db.chmac/hmac.ccrypto/rijndael/rijndael-alg-fst.ccrypto/crypto.ccrypto/aes_method.ccrypto/rijndael/rijndael-api-fst.chmac/sha1.cCeilings (not bugs)
rijndael-api-fst.ccaps at ~30% by design:aes_method.conly ever calls__db_blockEncrypt/__db_blockDecryptwithMODE_CBC, so the ECB/CFB1 branches and the entire__db_padEncrypt/__db_padDecrypt/__db_cipherUpdateRoundshalves are dead code from BDB's point of view — unreachable by any Tcl workload.aes_method.c's remaining cold lines are theHAVE_CRYPTO_IPPalternate-backend blocks (this build is not IPP) and the__aes_errmessage table +EAGAINbranches, which fire only on an internal cipher error (bad key length / bad state) not reachable through the public API without fault injection.Validation
Built + ran in the nix dev shell (
--enable-debug --enable-test,HAVE_CRYPTO 1, non-IPP).has_crypto=1in the harness. Both tests PASS through the exacttest:argloop mechanismrun_coverage.shuses. No real encryption/decryption or wrong-password bug surfaced — every error branch behaved as the tests assert.No engine code touched; docs + coverage wiring only.