@awacloud/fw 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -0
- package/NOTICE +8 -0
- package/README.md +163 -31
- package/dist/build/fw.core.pure.meta.json +6 -6
- package/dist/build/fw.core.pure.min.js +15 -12
- package/dist/build/fw.full.pure.meta.json +13 -7
- package/dist/build/fw.full.pure.min.js +45 -42
- package/dist/build/fw.minimal.pure.meta.json +6 -6
- package/dist/build/fw.minimal.pure.min.js +16 -13
- package/dist/build/fw.pack.compress-heavy.pure.meta.json +6 -6
- package/dist/build/fw.pack.compress-heavy.pure.min.js +3 -3
- package/dist/build/fw.pack.crypto-advanced.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-advanced.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-basic.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-basic.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-identity.pure.meta.json +7 -6
- package/dist/build/fw.pack.crypto-identity.pure.min.js +4 -4
- package/dist/build/fw.pwa.pure.meta.json +7 -6
- package/dist/build/fw.pwa.pure.min.js +38 -35
- package/dist/build/fw.site-interactive.pure.meta.json +6 -6
- package/dist/build/fw.site-interactive.pure.min.js +37 -34
- package/dist/build/fw.site.pure.meta.json +6 -6
- package/dist/build/fw.site.pure.min.js +24 -21
- package/dist/build/fw.spa.pure.meta.json +8 -7
- package/dist/build/fw.spa.pure.min.js +41 -38
- package/dist/build/sanity-base-classic.min.js +1 -1
- package/dist/build/sanity.min.js +1 -1
- package/dist/types/core/internal.d.ts +29 -0
- package/dist/types/core/internal.d.ts.map +1 -0
- package/dist/types/core/logger.d.ts +23 -4
- package/dist/types/core/logger.d.ts.map +1 -1
- package/dist/types/core/modules.d.ts +374 -61
- package/dist/types/core/modules.d.ts.map +1 -1
- package/dist/types/core/runtime.d.ts +10 -6
- package/dist/types/core/runtime.d.ts.map +1 -1
- package/dist/types/core/worker-helper.d.ts +35 -0
- package/dist/types/core/worker-helper.d.ts.map +1 -1
- package/dist/types/crypto/cipher/aes.d.ts +1 -7
- package/dist/types/crypto/cipher/aes.d.ts.map +1 -1
- package/dist/types/crypto/cipher/chacha20.d.ts +0 -10
- package/dist/types/crypto/cipher/chacha20.d.ts.map +1 -1
- package/dist/types/crypto/hash/argon2.d.ts +0 -15
- package/dist/types/crypto/hash/argon2.d.ts.map +1 -1
- package/dist/types/crypto/hash/blake2b.d.ts.map +1 -1
- package/dist/types/crypto/hash/hmac.d.ts.map +1 -1
- package/dist/types/crypto/hash/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/hash/poly1305.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha224.d.ts +1 -1
- package/dist/types/crypto/hash/sha256.d.ts +4 -13
- package/dist/types/crypto/hash/sha256.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha3.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha384.d.ts +1 -1
- package/dist/types/crypto/hash/sha512.d.ts +4 -13
- package/dist/types/crypto/hash/sha512.d.ts.map +1 -1
- package/dist/types/crypto/mode/cmac.d.ts +0 -6
- package/dist/types/crypto/mode/cmac.d.ts.map +1 -1
- package/dist/types/crypto/mode/ctr.d.ts +0 -6
- package/dist/types/crypto/mode/ctr.d.ts.map +1 -1
- package/dist/types/crypto/mode/gcm.d.ts +0 -9
- package/dist/types/crypto/mode/gcm.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ecc.d.ts +0 -1
- package/dist/types/crypto/pkc/ecc.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ed25519.d.ts +4 -25
- package/dist/types/crypto/pkc/ed25519.d.ts.map +1 -1
- package/dist/types/crypto/pkc/hybridSign.d.ts +25 -5
- package/dist/types/crypto/pkc/hybridSign.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_dsa.d.ts +6 -26
- package/dist/types/crypto/pkc/ml_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_kem.d.ts +0 -43
- package/dist/types/crypto/pkc/ml_kem.d.ts.map +1 -1
- package/dist/types/crypto/pkc/rsa.d.ts +0 -24
- package/dist/types/crypto/pkc/rsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/slh_dsa.d.ts +6 -16
- package/dist/types/crypto/pkc/slh_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/x25519.d.ts +0 -6
- package/dist/types/crypto/pkc/x25519.d.ts.map +1 -1
- package/dist/types/crypto/utils/bitArray.d.ts +0 -8
- package/dist/types/crypto/utils/bitArray.d.ts.map +1 -1
- package/dist/types/crypto/utils/jws.d.ts +6 -14
- package/dist/types/crypto/utils/jws.d.ts.map +1 -1
- package/dist/types/crypto/utils/keyformat.d.ts +52 -0
- package/dist/types/crypto/utils/keyformat.d.ts.map +1 -1
- package/dist/types/crypto/utils/random.d.ts +1 -10
- package/dist/types/crypto/utils/random.d.ts.map +1 -1
- package/dist/types/crypto/utils/rsaKeygen.d.ts +0 -10
- package/dist/types/crypto/utils/rsaKeygen.d.ts.map +1 -1
- package/dist/types/crypto/utils/uuid.d.ts.map +1 -1
- package/dist/types/crypto/utils/x509.d.ts +397 -0
- package/dist/types/crypto/utils/x509.d.ts.map +1 -0
- package/dist/types/crypto/wasm/argon2.d.ts +2 -1
- package/dist/types/crypto/wasm/argon2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/pbkdf2.d.ts +2 -2
- package/dist/types/crypto/wasm/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/rsa.d.ts.map +1 -1
- package/dist/types/crypto/wasm/runtime.d.ts +13 -0
- package/dist/types/crypto/wasm/runtime.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aes.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aeskw.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/digest.d.ts +0 -4
- package/dist/types/crypto/webcrypto/digest.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/rsa.d.ts.map +1 -1
- package/dist/types/dom/fs/fileIntake.d.ts +59 -0
- package/dist/types/dom/fs/fileIntake.d.ts.map +1 -0
- package/dist/types/dom/fs/fsAccess.d.ts.map +1 -1
- package/dist/types/dom/query/dnd.d.ts.map +1 -1
- package/dist/types/dom/query/sound.d.ts +89 -0
- package/dist/types/dom/query/sound.d.ts.map +1 -0
- package/dist/types/dom/rendering/chart.d.ts.map +1 -1
- package/dist/types/dom/rendering/component.d.ts +9 -3
- package/dist/types/dom/rendering/component.d.ts.map +1 -1
- package/dist/types/dom/rendering/parser.d.ts +39 -0
- package/dist/types/dom/rendering/parser.d.ts.map +1 -1
- package/dist/types/dom/rendering/render.d.ts.map +1 -1
- package/dist/types/dom/rendering/sanitize.d.ts +4 -0
- package/dist/types/dom/rendering/sanitize.d.ts.map +1 -1
- package/dist/types/dom/rendering/secPolicy.d.ts.map +1 -1
- package/dist/types/dom/rendering/styleSheet.d.ts +74 -0
- package/dist/types/dom/rendering/styleSheet.d.ts.map +1 -0
- package/dist/types/dom/rendering/template.d.ts +9 -3
- package/dist/types/dom/rendering/template.d.ts.map +1 -1
- package/dist/types/dom/rendering/themeTokens.d.ts +9 -3
- package/dist/types/dom/rendering/themeTokens.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-core.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-core.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-list.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-list.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession.d.ts +18 -6
- package/dist/types/dom/rendering/uiSession.d.ts.map +1 -1
- package/dist/types/dom/sw/installPrompt.d.ts +89 -0
- package/dist/types/dom/sw/installPrompt.d.ts.map +1 -0
- package/dist/types/dom/sw/precache.d.ts +149 -0
- package/dist/types/dom/sw/precache.d.ts.map +1 -0
- package/dist/types/dom/sw/swUpdate.d.ts +129 -0
- package/dist/types/dom/sw/swUpdate.d.ts.map +1 -0
- package/dist/types/dom/utils/clipboard.d.ts +8 -0
- package/dist/types/dom/utils/clipboard.d.ts.map +1 -1
- package/dist/types/dom/utils/keybindings.d.ts.map +1 -1
- package/dist/types/dom/utils/route.d.ts.map +1 -1
- package/dist/types/dom/utils/ua.d.ts +2 -2
- package/dist/types/dom/utils/ua.d.ts.map +1 -1
- package/dist/types/io/calc/crc32.d.ts.map +1 -1
- package/dist/types/io/codec/b64.d.ts +24 -0
- package/dist/types/io/codec/b64.d.ts.map +1 -1
- package/dist/types/io/codec/cbor.d.ts +1 -0
- package/dist/types/io/codec/cbor.d.ts.map +1 -1
- package/dist/types/io/codec/hex.d.ts.map +1 -1
- package/dist/types/io/codec/msgpack.d.ts +1 -0
- package/dist/types/io/codec/msgpack.d.ts.map +1 -1
- package/dist/types/io/codec/url.d.ts +3 -1
- package/dist/types/io/codec/url.d.ts.map +1 -1
- package/dist/types/io/codec/utf8.d.ts.map +1 -1
- package/dist/types/io/compress/bitstream.d.ts +1 -1
- package/dist/types/io/compress/brotli.d.ts +0 -1
- package/dist/types/io/compress/brotli.d.ts.map +1 -1
- package/dist/types/io/compress/brotli_shared.d.ts +0 -4
- package/dist/types/io/compress/brotli_shared.d.ts.map +1 -1
- package/dist/types/io/compress/deflate.d.ts +14 -1
- package/dist/types/io/compress/deflate.d.ts.map +1 -1
- package/dist/types/io/compress/gzip.d.ts +4 -0
- package/dist/types/io/compress/gzip.d.ts.map +1 -1
- package/dist/types/io/compress/huffman.d.ts +7 -0
- package/dist/types/io/compress/huffman.d.ts.map +1 -1
- package/dist/types/io/compress/lz4.d.ts +4 -2
- package/dist/types/io/compress/lz4.d.ts.map +1 -1
- package/dist/types/io/compress/lz77.d.ts +17 -0
- package/dist/types/io/compress/lz77.d.ts.map +1 -1
- package/dist/types/io/compress/lzw.d.ts +2 -0
- package/dist/types/io/compress/lzw.d.ts.map +1 -1
- package/dist/types/io/compress/zip.d.ts.map +1 -1
- package/dist/types/io/compress/zlib.d.ts +9 -2
- package/dist/types/io/compress/zlib.d.ts.map +1 -1
- package/dist/types/io/math/linalg.d.ts.map +1 -1
- package/dist/types/process/rpc.d.ts.map +1 -1
- package/dist/types/process/workerPool.d.ts.map +1 -1
- package/dist/types/sanity/base.d.ts +12 -2
- package/dist/types/sanity/base.d.ts.map +1 -1
- package/dist/types/sanity/lockdown.d.ts +6 -5
- package/dist/types/sanity/lockdown.d.ts.map +1 -1
- package/dist/types/sanity/wasm-gate.d.ts +1 -1
- package/docs/README.md +17 -10
- package/docs/api/README.md +5 -5
- package/docs/api/core/logger.md +2 -1
- package/docs/api/core/modules.md +3 -3
- package/docs/api/core/runtime.md +9 -9
- package/docs/api/core/worker-helper.md +12 -2
- package/docs/api/crypto/README.md +1 -1
- package/docs/api/crypto/cipher/README.md +2 -2
- package/docs/api/crypto/cipher/aes.md +5 -10
- package/docs/api/crypto/cipher/chacha20.md +3 -8
- package/docs/api/crypto/hash/README.md +5 -5
- package/docs/api/crypto/hash/adf.md +21 -11
- package/docs/api/crypto/hash/argon2.md +3 -12
- package/docs/api/crypto/hash/blake2b.md +12 -14
- package/docs/api/crypto/hash/pbkdf2.md +1 -1
- package/docs/api/crypto/hash/sha224.md +2 -2
- package/docs/api/crypto/hash/sha256.md +4 -4
- package/docs/api/crypto/hash/sha3.md +2 -2
- package/docs/api/crypto/hash/sha384.md +1 -1
- package/docs/api/crypto/hash/sha512.md +5 -5
- package/docs/api/crypto/hash/sha512_224.md +1 -1
- package/docs/api/crypto/hash/sha512_256.md +1 -1
- package/docs/api/crypto/mode/README.md +3 -3
- package/docs/api/crypto/mode/cbc.md +2 -2
- package/docs/api/crypto/mode/chacha20poly1305.md +1 -1
- package/docs/api/crypto/mode/cmac.md +4 -4
- package/docs/api/crypto/mode/ctr.md +2 -3
- package/docs/api/crypto/mode/gcm.md +5 -5
- package/docs/api/crypto/mode/kw.md +4 -4
- package/docs/api/crypto/pkc/README.md +8 -8
- package/docs/api/crypto/pkc/ecc.md +19 -17
- package/docs/api/crypto/pkc/ed25519.md +10 -15
- package/docs/api/crypto/pkc/hybridKem.md +8 -2
- package/docs/api/crypto/pkc/hybridSign.md +34 -7
- package/docs/api/crypto/pkc/ml_dsa.md +20 -19
- package/docs/api/crypto/pkc/ml_kem.md +3 -3
- package/docs/api/crypto/pkc/rsa.md +7 -9
- package/docs/api/crypto/pkc/slh_dsa.md +12 -12
- package/docs/api/crypto/pkc/x25519.md +5 -4
- package/docs/api/crypto/utils/README.md +7 -7
- package/docs/api/crypto/utils/aes_modes.md +2 -5
- package/docs/api/crypto/utils/asn1.md +25 -16
- package/docs/api/crypto/utils/jws.md +6 -4
- package/docs/api/crypto/utils/keyformat.md +24 -15
- package/docs/api/crypto/utils/pad.md +1 -1
- package/docs/api/crypto/utils/pem.md +3 -3
- package/docs/api/crypto/utils/random.md +3 -4
- package/docs/api/crypto/utils/rsaKeygen.md +2 -2
- package/docs/api/crypto/utils/totp.md +2 -2
- package/docs/api/crypto/utils/uuid.md +5 -5
- package/docs/api/crypto/utils/x509.md +124 -0
- package/docs/api/crypto/wasm/aes.md +1 -1
- package/docs/api/crypto/wasm/argon2.md +6 -4
- package/docs/api/crypto/wasm/ml_kem.md +1 -0
- package/docs/api/crypto/wasm/pbkdf2.md +8 -8
- package/docs/api/crypto/wasm/rsa.md +1 -1
- package/docs/api/crypto/wasm/runtime.md +27 -10
- package/docs/api/crypto/webcrypto/aes.md +1 -1
- package/docs/api/crypto/webcrypto/aeskw.md +2 -2
- package/docs/api/crypto/webcrypto/digest.md +3 -5
- package/docs/api/crypto/webcrypto/ecc.md +1 -1
- package/docs/api/crypto/webcrypto/ed25519.md +1 -1
- package/docs/api/crypto/webcrypto/rsa.md +3 -2
- package/docs/api/crypto/webcrypto/x25519.md +1 -1
- package/docs/api/dom/README.md +6 -1
- package/docs/api/dom/fs/README.md +1 -0
- package/docs/api/dom/fs/fileIntake.md +120 -0
- package/docs/api/dom/fs/fsAccess.md +1 -0
- package/docs/api/dom/fs/indexedDB.md +1 -1
- package/docs/api/dom/fs/storage.md +1 -1
- package/docs/api/dom/query/README.md +2 -1
- package/docs/api/dom/query/dnd.md +4 -1
- package/docs/api/dom/query/dom.md +5 -0
- package/docs/api/dom/query/sound.md +103 -0
- package/docs/api/dom/rendering/README.md +4 -3
- package/docs/api/dom/rendering/chart.md +5 -4
- package/docs/api/dom/rendering/component.md +25 -3
- package/docs/api/dom/rendering/parser.md +5 -2
- package/docs/api/dom/rendering/reactiveBind.md +1 -1
- package/docs/api/dom/rendering/render.md +2 -2
- package/docs/api/dom/rendering/sanitize.md +10 -2
- package/docs/api/dom/rendering/secPolicy.md +4 -4
- package/docs/api/dom/rendering/styleSheet.md +85 -0
- package/docs/api/dom/rendering/template.md +20 -5
- package/docs/api/dom/rendering/themeTokens.md +6 -3
- package/docs/api/dom/rendering/uiSession.md +18 -5
- package/docs/api/dom/rendering/virtualScroll.md +2 -2
- package/docs/api/dom/sensors/geolocation.md +1 -1
- package/docs/api/dom/sw/README.md +7 -1
- package/docs/api/dom/sw/cache.md +2 -1
- package/docs/api/dom/sw/installPrompt.md +111 -0
- package/docs/api/dom/sw/precache.md +124 -0
- package/docs/api/dom/sw/serviceWorker.md +4 -2
- package/docs/api/dom/sw/swUpdate.md +112 -0
- package/docs/api/dom/utils/clipboard.md +56 -5
- package/docs/api/dom/utils/entropyCollector.md +1 -1
- package/docs/api/dom/utils/keybindings.md +17 -2
- package/docs/api/dom/utils/leaderElection.md +2 -2
- package/docs/api/dom/utils/route.md +1 -0
- package/docs/api/dom/utils/ua.md +15 -10
- package/docs/api/io/calc/crc32.md +4 -1
- package/docs/api/io/codec/README.md +2 -2
- package/docs/api/io/codec/b64.md +31 -2
- package/docs/api/io/codec/buffer.md +1 -1
- package/docs/api/io/codec/cbor.md +6 -4
- package/docs/api/io/codec/csv.md +178 -178
- package/docs/api/io/codec/hex.md +10 -2
- package/docs/api/io/codec/msgpack.md +4 -3
- package/docs/api/io/codec/url.md +4 -3
- package/docs/api/io/codec/utf8.md +3 -3
- package/docs/api/io/compress/bitstream.md +6 -3
- package/docs/api/io/compress/brotli.md +36 -4
- package/docs/api/io/compress/brotli_shared.md +1 -1
- package/docs/api/io/compress/deflate.md +42 -34
- package/docs/api/io/compress/gzip.md +26 -6
- package/docs/api/io/compress/huffman.md +2 -1
- package/docs/api/io/compress/lz4.md +5 -3
- package/docs/api/io/compress/lz77.md +26 -3
- package/docs/api/io/compress/lzw.md +13 -8
- package/docs/api/io/compress/zip.md +36 -10
- package/docs/api/io/compress/zlib.md +21 -5
- package/docs/api/io/math/linalg.md +1 -1
- package/docs/api/io/utils/valid.md +1 -1
- package/docs/api/process/rpc.md +3 -2
- package/docs/api/process/workerPool.md +1 -1
- package/docs/api/sanity/base.md +9 -5
- package/docs/api/sanity/lockdown.md +7 -6
- package/docs/api/surface.json +12311 -0
- package/docs/api/typed.md +5 -3
- package/docs/dev/README.md +2 -0
- package/docs/dev/bench.md +76 -0
- package/docs/dev/crypto-references.md +54 -0
- package/docs/dev/provenance.md +30 -7
- package/docs/dev/publishing.md +7 -7
- package/docs/dev/runtime.md +1 -1
- package/docs/dev/testing.md +13 -0
- package/docs/evidence/l4-evidence.md +86 -0
- package/docs/evidence/pqc-hybrid-evidence.md +7 -6
- package/docs/guide/README.md +1 -0
- package/docs/guide/_QUICK_REF.md +5 -5
- package/docs/guide/doc-format.md +4 -3
- package/docs/guide/integrations-hmr.md +1 -1
- package/docs/guide/module-creation-workflow.md +8 -8
- package/docs/guide/rendering-pipeline.md +11 -4
- package/docs/guide/security.md +7 -5
- package/docs/guide/stability.md +123 -0
- package/docs/guide/tutorial-todo.md +20 -8
- package/docs/guide/typescript.md +9 -0
- package/docs/guide/worker-confinement.md +30 -17
- package/docs/notes/lz77-deflate-factorization.md +3 -3
- package/docs/tools/README.md +1 -1
- package/docs/tools/bundler.md +3 -3
- package/docs/tools/codegen.md +1 -1
- package/docs/tools/standalone.md +0 -1
- package/fw.config.json +2 -2
- package/integrations/_shared/catalog.generated.json +7 -1
- package/integrations/_shared/core.js +1 -1
- package/integrations/astro/index.js +1 -1
- package/integrations/eslint/README.md +7 -1
- package/integrations/nextjs/index.js +1 -1
- package/integrations/nodejs/README.md +3 -3
- package/integrations/turbopack/index.js +2 -2
- package/integrations/typedoc/categorize.js +1 -1
- package/integrations/typedoc/typedoc.json +2 -1
- package/integrations/vite/index.js +2 -2
- package/integrations/vite/vite-env.d.ts +7 -4
- package/integrations/webpack/index.js +3 -3
- package/package.json +76 -10
- package/src/core/internal.js +31 -0
- package/src/core/logger.js +95 -23
- package/src/core/modules.js +17 -8
- package/src/core/readyState.js +1 -1
- package/src/core/runtime.js +74 -27
- package/src/core/worker-helper.js +83 -4
- package/src/crypto/NIST_CONFORMANCE.md +47 -34
- package/src/crypto/cipher/aes.acvp.md +7 -8
- package/src/crypto/cipher/aes.js +280 -229
- package/src/crypto/cipher/chacha20.acvp.md +6 -7
- package/src/crypto/cipher/chacha20.js +91 -61
- package/src/crypto/hash/adf.js +1 -1
- package/src/crypto/hash/argon2.acvp.md +11 -15
- package/src/crypto/hash/argon2.js +9 -24
- package/src/crypto/hash/blake2b.js +157 -125
- package/src/crypto/hash/hkdf.acvp.md +15 -15
- package/src/crypto/hash/hkdf.js +1 -1
- package/src/crypto/hash/hmac.acvp.md +10 -12
- package/src/crypto/hash/hmac.js +5 -1
- package/src/crypto/hash/pbkdf2.acvp.md +13 -13
- package/src/crypto/hash/pbkdf2.js +36 -8
- package/src/crypto/hash/poly1305.acvp.md +10 -6
- package/src/crypto/hash/poly1305.js +171 -50
- package/src/crypto/hash/sha224.acvp.md +3 -3
- package/src/crypto/hash/sha224.js +4 -4
- package/src/crypto/hash/sha256.acvp.md +2 -2
- package/src/crypto/hash/sha256.js +514 -50
- package/src/crypto/hash/sha3.acvp.md +9 -9
- package/src/crypto/hash/sha3.js +127 -71
- package/src/crypto/hash/sha384.acvp.md +3 -3
- package/src/crypto/hash/sha384.js +4 -4
- package/src/crypto/hash/sha512.acvp.md +7 -8
- package/src/crypto/hash/sha512.js +107 -108
- package/src/crypto/hash/sha512_224.acvp.md +6 -6
- package/src/crypto/hash/sha512_224.js +2 -2
- package/src/crypto/hash/sha512_256.acvp.md +6 -6
- package/src/crypto/hash/sha512_256.js +2 -2
- package/src/crypto/mode/cbc.acvp.md +2 -2
- package/src/crypto/mode/cbc.js +1 -1
- package/src/crypto/mode/chacha20poly1305.acvp.md +6 -6
- package/src/crypto/mode/chacha20poly1305.js +3 -3
- package/src/crypto/mode/cmac.acvp.md +5 -5
- package/src/crypto/mode/cmac.js +8 -8
- package/src/crypto/mode/ctr.acvp.md +2 -2
- package/src/crypto/mode/ctr.js +1 -3
- package/src/crypto/mode/gcm.acvp.md +6 -6
- package/src/crypto/mode/gcm.js +7 -7
- package/src/crypto/mode/kw.acvp.md +4 -4
- package/src/crypto/mode/kw.js +5 -5
- package/src/crypto/pkc/ecc.acvp.md +13 -13
- package/src/crypto/pkc/ecc.js +9 -11
- package/src/crypto/pkc/ed25519.acvp.md +30 -34
- package/src/crypto/pkc/ed25519.js +453 -94
- package/src/crypto/pkc/hybrid-kat.provenance.md +4 -4
- package/src/crypto/pkc/hybridSign.js +103 -24
- package/src/crypto/pkc/ml_dsa.acvp.md +18 -18
- package/src/crypto/pkc/ml_dsa.js +29 -32
- package/src/crypto/pkc/ml_kem.acvp.md +7 -7
- package/src/crypto/pkc/ml_kem.js +15 -21
- package/src/crypto/pkc/rsa.acvp.md +11 -15
- package/src/crypto/pkc/rsa.js +7 -44
- package/src/crypto/pkc/slh_dsa.acvp.md +16 -16
- package/src/crypto/pkc/slh_dsa.js +16 -18
- package/src/crypto/pkc/x25519.acvp.md +13 -10
- package/src/crypto/pkc/x25519.js +273 -29
- package/src/crypto/utils/aes_modes.acvp.md +1 -2
- package/src/crypto/utils/aes_modes.js +2 -2
- package/src/crypto/utils/asn1-oid.js +1 -1
- package/src/crypto/utils/asn1.js +1 -1
- package/src/crypto/utils/bitArray.js +33 -48
- package/src/crypto/utils/bn.js +1 -1
- package/src/crypto/utils/jws.js +37 -41
- package/src/crypto/utils/keyformat.js +181 -2
- package/src/crypto/utils/pem.js +1 -1
- package/src/crypto/utils/random.acvp.md +5 -5
- package/src/crypto/utils/random.js +845 -846
- package/src/crypto/utils/rsaKeygen.acvp.md +3 -2
- package/src/crypto/utils/rsaKeygen.js +6 -6
- package/src/crypto/utils/totp.js +1 -1
- package/src/crypto/utils/uuid.acvp.md +5 -5
- package/src/crypto/utils/uuid.js +11 -10
- package/src/crypto/utils/x509.js +591 -0
- package/src/crypto/wasm/aes.js +1 -1
- package/src/crypto/wasm/aes.scalar.wasm +0 -0
- package/src/crypto/wasm/argon2.js +17 -1
- package/src/crypto/wasm/argon2.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.simd.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.scalar.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.simd.wasm +0 -0
- package/src/crypto/wasm/cmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ecc.js +3 -3
- package/src/crypto/wasm/ecc.scalar.wasm +0 -0
- package/src/crypto/wasm/ed25519.js +1 -1
- package/src/crypto/wasm/ed25519.scalar.wasm +0 -0
- package/src/crypto/wasm/hkdf.scalar.wasm +0 -0
- package/src/crypto/wasm/hmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.js +2 -2
- package/src/crypto/wasm/ml_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.simd.wasm +0 -0
- package/src/crypto/wasm/ml_kem.js +2 -2
- package/src/crypto/wasm/ml_kem.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_kem.simd.wasm +0 -0
- package/src/crypto/wasm/pbkdf2.js +8 -6
- package/src/crypto/wasm/pbkdf2.scalar.wasm +0 -0
- package/src/crypto/wasm/rsa.js +6 -5
- package/src/crypto/wasm/rsa.scalar.wasm +0 -0
- package/src/crypto/wasm/runtime.js +84 -17
- package/src/crypto/wasm/sha2.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.simd.wasm +0 -0
- package/src/crypto/wasm/slh_dsa.js +1 -1
- package/src/crypto/wasm/slh_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/x25519.js +1 -1
- package/src/crypto/wasm/x25519.scalar.wasm +0 -0
- package/src/crypto/webcrypto/aes.js +8 -2
- package/src/crypto/webcrypto/aeskw.js +7 -2
- package/src/crypto/webcrypto/digest.js +1 -15
- package/src/crypto/webcrypto/ecc.js +2 -2
- package/src/crypto/webcrypto/ed25519.js +2 -2
- package/src/crypto/webcrypto/hmac.js +2 -2
- package/src/crypto/webcrypto/rsa.js +7 -2
- package/src/crypto/webcrypto/x25519.js +2 -2
- package/src/dom/display/animate.js +1 -1
- package/src/dom/display/fullscreen.js +1 -1
- package/src/dom/fs/download.js +1 -1
- package/src/dom/fs/fileIntake.js +192 -0
- package/src/dom/fs/fsAccess.js +2 -3
- package/src/dom/fs/indexedDB.js +1 -1
- package/src/dom/fs/remoteStore.js +1 -1
- package/src/dom/fs/storage.js +1 -1
- package/src/dom/lifecycle/idle.js +1 -1
- package/src/dom/lifecycle/visibility.js +1 -1
- package/src/dom/lifecycle/wakeLock.js +1 -1
- package/src/dom/net/ajax.js +1 -1
- package/src/dom/net/network.js +1 -1
- package/src/dom/net/sse.js +1 -1
- package/src/dom/net/webrtc.js +1 -1
- package/src/dom/net/ws.js +1 -1
- package/src/dom/query/dnd.js +56 -4
- package/src/dom/query/dom.js +1 -1
- package/src/dom/query/events.js +1 -1
- package/src/dom/query/gesture.js +1 -1
- package/src/dom/query/media.js +1 -1
- package/src/dom/query/sound.js +333 -0
- package/src/dom/rendering/chart.js +736 -663
- package/src/dom/rendering/component.js +25 -14
- package/src/dom/rendering/devtools.js +2 -2
- package/src/dom/rendering/parser.js +155 -12
- package/src/dom/rendering/render.js +14 -4
- package/src/dom/rendering/sanitize.js +11 -4
- package/src/dom/rendering/secPolicy.js +6 -4
- package/src/dom/rendering/styleSheet.js +217 -0
- package/src/dom/rendering/template.js +72 -13
- package/src/dom/rendering/themeTokens.js +542 -522
- package/src/dom/rendering/uiSession-core.js +51 -6
- package/src/dom/rendering/uiSession-direct.js +1 -1
- package/src/dom/rendering/uiSession-list.js +4 -4
- package/src/dom/rendering/uiSession.js +1 -1
- package/src/dom/rendering/virtualScroll.js +341 -341
- package/src/dom/sensors/battery.js +1 -1
- package/src/dom/sensors/geolocation.js +1 -1
- package/src/dom/sensors/networkInfo.js +1 -1
- package/src/dom/sensors/sensors.js +1 -1
- package/src/dom/sw/backgroundSync.js +1 -1
- package/src/dom/sw/cache.js +1 -1
- package/src/dom/sw/installPrompt.js +151 -0
- package/src/dom/sw/precache.js +257 -0
- package/src/dom/sw/push.js +1 -1
- package/src/dom/sw/sharedWorker.js +1 -1
- package/src/dom/sw/swUpdate.js +239 -0
- package/src/dom/utils/a11y.js +1 -1
- package/src/dom/utils/clipboard.js +56 -6
- package/src/dom/utils/entropyCollector.js +1 -1
- package/src/dom/utils/focus.js +1 -1
- package/src/dom/utils/form.js +1 -1
- package/src/dom/utils/keybindings.js +600 -574
- package/src/dom/utils/leaderElection.js +1 -1
- package/src/dom/utils/notifications.js +1 -1
- package/src/dom/utils/permissions.js +107 -107
- package/src/dom/utils/route.js +14 -2
- package/src/dom/utils/ua.js +42 -28
- package/src/dom/utils/webauthn.js +1 -1
- package/src/io/binary/reader.js +1 -1
- package/src/io/binary/writer.js +1 -1
- package/src/io/calc/bigint.js +1 -1
- package/src/io/calc/crc32.js +28 -2
- package/src/io/calc/easing.js +514 -514
- package/src/io/codec/b64.js +189 -52
- package/src/io/codec/base32.js +1 -1
- package/src/io/codec/base58.js +1 -1
- package/src/io/codec/buffer.js +1 -1
- package/src/io/codec/cbor.js +111 -18
- package/src/io/codec/csv.js +1 -1
- package/src/io/codec/hex.js +51 -6
- package/src/io/codec/mime.js +1 -1
- package/src/io/codec/msgpack.js +47 -6
- package/src/io/codec/url.js +24 -7
- package/src/io/codec/utf8.js +5 -3
- package/src/io/codec/xml.js +1 -1
- package/src/io/compress/bitstream.js +2 -2
- package/src/io/compress/brotli.js +663 -163
- package/src/io/compress/brotli_dict.js +1 -1
- package/src/io/compress/brotli_dict_words.js +1 -1
- package/src/io/compress/brotli_frame.js +1 -1
- package/src/io/compress/brotli_shared.js +7 -7
- package/src/io/compress/deflate.js +87 -53
- package/src/io/compress/gzip.js +187 -74
- package/src/io/compress/huffman.js +24 -1
- package/src/io/compress/lz4.js +45 -7
- package/src/io/compress/lz77.js +148 -63
- package/src/io/compress/lzw.js +35 -19
- package/src/io/compress/zip.js +862 -815
- package/src/io/compress/zlib.js +87 -7
- package/src/io/i18n/i18n.js +1 -1
- package/src/io/math/fixed-point.js +1 -1
- package/src/io/math/geom.js +1 -1
- package/src/io/math/interp.js +1 -1
- package/src/io/math/linalg.js +10 -4
- package/src/io/math/stats.js +1 -1
- package/src/io/structures/btree.js +1 -1
- package/src/io/structures/heap.js +1 -1
- package/src/io/structures/lruCache.js +1 -1
- package/src/io/structures/ringBuffer.js +1 -1
- package/src/io/structures/tree-walker.js +1 -1
- package/src/io/structures/trie.js +1 -1
- package/src/io/sync/abort.js +1 -1
- package/src/io/sync/atomics.js +1 -1
- package/src/io/sync/cancellable.js +1 -1
- package/src/io/sync/channel.js +1 -1
- package/src/io/sync/mutex.js +1 -1
- package/src/io/sync/semaphore.js +1 -1
- package/src/io/sync/tokenBucket.js +1 -1
- package/src/io/text/ansi.js +1 -1
- package/src/io/text/html-entities.js +1 -1
- package/src/io/time/date.js +1 -1
- package/src/io/timing/clock.js +1 -1
- package/src/io/timing/rateLimit.js +1 -1
- package/src/io/timing/scheduler.js +1 -1
- package/src/io/utils/errors.js +1 -1
- package/src/io/utils/eventBus.js +1 -1
- package/src/io/utils/signal.js +1 -1
- package/src/io/utils/valid.js +1 -1
- package/src/main.js +1 -1
- package/src/process/message.js +1 -1
- package/src/process/rpc.js +7 -3
- package/src/process/workerPool.js +11 -4
- package/src/sanity/base.js +85 -39
- package/src/sanity/lockdown-apply.js +3 -3
- package/src/sanity/lockdown.js +58 -32
- package/src/sanity/wasm-gate.js +2 -2
- package/src/typed.js +7 -3
- package/third-party/NOTICE-brotli-dictionary.txt +69 -0
- package/third-party/NOTICE-fw-wasm-crypto.txt +576 -0
- package/third-party/NOTICE-whatwg-entities.txt +44 -0
- package/types/registry.generated.d.ts +7 -1
- package/types/typed.d.ts +7 -3
- package/dist/types/crypto/utils/aes_ctr.d.ts +0 -84
- package/dist/types/crypto/utils/aes_ctr.d.ts.map +0 -1
- package/docs/api/crypto/utils/aes_ctr.md +0 -71
- package/src/crypto/utils/aes_ctr.acvp.md +0 -67
- package/src/crypto/utils/aes_ctr.js +0 -134
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
* function operates on a 128-byte block with 12 rounds of the G mixing
|
|
11
11
|
* function over a 16-word working vector.
|
|
12
12
|
*
|
|
13
|
-
* 64-bit arithmetic
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* 64-bit arithmetic runs on pairs of int32 halves held in locals (16 words
|
|
14
|
+
* × {hi, lo}) - JS lacks native uint64 outside of `BigInt`, far too slow in
|
|
15
|
+
* the inner loop. Additions wrap the low half and take the carry from bit
|
|
16
|
+
* operations; rotations use the standard 32/24/16/63 decompositions. Every
|
|
17
|
+
* value stays an int32: an unsigned half above 2^31 makes JavaScriptCore
|
|
18
|
+
* compute in doubles (measured 7x slower).
|
|
18
19
|
*
|
|
19
20
|
* Public API:
|
|
20
21
|
* blake2b(message, outLen=64, key?) - one-shot hash → Uint8Array
|
|
@@ -78,135 +79,166 @@ export const blake2b = {
|
|
|
78
79
|
[14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]
|
|
79
80
|
];
|
|
80
81
|
|
|
81
|
-
// ── 64-bit primitive ops on (hi, lo) pairs ────────────────────
|
|
82
|
-
|
|
83
|
-
// v[2i] = hi, v[2i+1] = lo. All ops are written inline in _compress
|
|
84
|
-
// for speed; helpers here are reference implementations / clarity.
|
|
85
|
-
|
|
86
|
-
function _add64(v, ai, bi) {
|
|
87
|
-
// v[ai..ai+1] += v[bi..bi+1] (carry from lo to hi)
|
|
88
|
-
const lo = (v[ai + 1] + v[bi + 1]) >>> 0;
|
|
89
|
-
const carry = lo < v[ai + 1] ? 1 : 0;
|
|
90
|
-
v[ai] = (v[ai] + v[bi] + carry) >>> 0;
|
|
91
|
-
v[ai + 1] = lo;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function _xor64(v, ai, bi) {
|
|
95
|
-
v[ai] ^= v[bi];
|
|
96
|
-
v[ai + 1] ^= v[bi + 1];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Rotate 64-bit value (hi, lo) right by n bits (1..63).
|
|
100
|
-
function _ror64(v, ai, n) {
|
|
101
|
-
const hi = v[ai];
|
|
102
|
-
const lo = v[ai + 1];
|
|
103
|
-
let nh, nl;
|
|
104
|
-
if (n === 32) {
|
|
105
|
-
nh = lo; nl = hi;
|
|
106
|
-
} else if (n < 32) {
|
|
107
|
-
nh = (hi >>> n) | (lo << (32 - n));
|
|
108
|
-
nl = (lo >>> n) | (hi << (32 - n));
|
|
109
|
-
} else {
|
|
110
|
-
const m = n - 32;
|
|
111
|
-
nh = (lo >>> m) | (hi << (32 - m));
|
|
112
|
-
nl = (hi >>> m) | (lo << (32 - m));
|
|
113
|
-
}
|
|
114
|
-
v[ai] = nh >>> 0;
|
|
115
|
-
v[ai + 1] = nl >>> 0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
82
|
// ── compression ───────────────────────────────────────────────
|
|
119
83
|
|
|
120
|
-
|
|
121
|
-
// v[a] += v[b] + (mxHi, mxLo)
|
|
122
|
-
let lo = (v[a + 1] + v[b + 1]) >>> 0;
|
|
123
|
-
let carry = lo < v[a + 1] ? 1 : 0;
|
|
124
|
-
v[a] = (v[a] + v[b] + carry) >>> 0;
|
|
125
|
-
v[a + 1] = lo;
|
|
126
|
-
lo = (v[a + 1] + mxLo) >>> 0;
|
|
127
|
-
carry = lo < v[a + 1] ? 1 : 0;
|
|
128
|
-
v[a] = (v[a] + mxHi + carry) >>> 0;
|
|
129
|
-
v[a + 1] = lo;
|
|
130
|
-
|
|
131
|
-
// v[d] = ROTR64(v[d] ^ v[a], 32)
|
|
132
|
-
_xor64(v, d, a);
|
|
133
|
-
_ror64(v, d, 32);
|
|
134
|
-
|
|
135
|
-
// v[c] += v[d]
|
|
136
|
-
_add64(v, c, d);
|
|
137
|
-
|
|
138
|
-
// v[b] = ROTR64(v[b] ^ v[c], 24)
|
|
139
|
-
_xor64(v, b, c);
|
|
140
|
-
_ror64(v, b, 24);
|
|
141
|
-
|
|
142
|
-
// v[a] += v[b] + (myHi, myLo)
|
|
143
|
-
lo = (v[a + 1] + v[b + 1]) >>> 0;
|
|
144
|
-
carry = lo < v[a + 1] ? 1 : 0;
|
|
145
|
-
v[a] = (v[a] + v[b] + carry) >>> 0;
|
|
146
|
-
v[a + 1] = lo;
|
|
147
|
-
lo = (v[a + 1] + myLo) >>> 0;
|
|
148
|
-
carry = lo < v[a + 1] ? 1 : 0;
|
|
149
|
-
v[a] = (v[a] + myHi + carry) >>> 0;
|
|
150
|
-
v[a + 1] = lo;
|
|
151
|
-
|
|
152
|
-
// v[d] = ROTR64(v[d] ^ v[a], 16)
|
|
153
|
-
_xor64(v, d, a);
|
|
154
|
-
_ror64(v, d, 16);
|
|
155
|
-
|
|
156
|
-
// v[c] += v[d]
|
|
157
|
-
_add64(v, c, d);
|
|
158
|
-
|
|
159
|
-
// v[b] = ROTR64(v[b] ^ v[c], 63)
|
|
160
|
-
_xor64(v, b, c);
|
|
161
|
-
_ror64(v, b, 63);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const _v = new Uint32Array(32); // 16 words × (hi, lo)
|
|
165
|
-
const _m = new Uint32Array(32); // 16 message words × (hi, lo)
|
|
84
|
+
const _m = new Int32Array(32); // 16 message words × (hi, lo), int32
|
|
166
85
|
|
|
86
|
+
/**
|
|
87
|
+
* BLAKE2b compression F (RFC 7693 §3.2) on locals: the 16 working words
|
|
88
|
+
* as (h, l) int32 pairs, the 12 rounds of generated inline mixing.
|
|
89
|
+
* @param {{h: Uint32Array, buf: Uint8Array, tHi: number, tLo: number}} ctx
|
|
90
|
+
* @param {boolean} last
|
|
91
|
+
*/
|
|
167
92
|
function _compress(ctx, last) {
|
|
168
|
-
|
|
169
|
-
const buf = ctx.buf;
|
|
93
|
+
const buf = ctx.buf, h = ctx.h, m = _m;
|
|
170
94
|
for (let i = 0; i < 16; i++) {
|
|
171
95
|
const o = i * 8;
|
|
172
|
-
|
|
173
|
-
|
|
96
|
+
m[i * 2 + 1] = buf[o] | (buf[o + 1] << 8) | (buf[o + 2] << 16) | (buf[o + 3] << 24);
|
|
97
|
+
m[i * 2] = buf[o + 4] | (buf[o + 5] << 8) | (buf[o + 6] << 16) | (buf[o + 7] << 24);
|
|
174
98
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
for (let i = 0; i < 8; i++) {
|
|
181
|
-
_v[16 + i * 2] = IV[i * 2];
|
|
182
|
-
_v[16 + i * 2 + 1] = IV[i * 2 + 1];
|
|
183
|
-
}
|
|
184
|
-
// XOR counter (t) into v[12..13].
|
|
185
|
-
_v[24] ^= ctx.tHi;
|
|
186
|
-
_v[25] ^= ctx.tLo;
|
|
187
|
-
// (high counter half v[14..15] stays zero - t fits in 64 bits here).
|
|
188
|
-
if (last) {
|
|
189
|
-
// Invert v[14] (RFC 7693 §3.2). v[14] sits at _v[28..29].
|
|
190
|
-
_v[28] = ~_v[28] >>> 0;
|
|
191
|
-
_v[29] = ~_v[29] >>> 0;
|
|
192
|
-
}
|
|
193
|
-
|
|
99
|
+
let v0h = h[0] | 0, v0l = h[1] | 0, v1h = h[2] | 0, v1l = h[3] | 0, v2h = h[4] | 0, v2l = h[5] | 0, v3h = h[6] | 0, v3l = h[7] | 0, v4h = h[8] | 0, v4l = h[9] | 0, v5h = h[10] | 0, v5l = h[11] | 0, v6h = h[12] | 0, v6l = h[13] | 0, v7h = h[14] | 0, v7l = h[15] | 0, v8h = IV[0] | 0, v8l = IV[1] | 0, v9h = IV[2] | 0, v9l = IV[3] | 0, v10h = IV[4] | 0, v10l = IV[5] | 0, v11h = IV[6] | 0, v11l = IV[7] | 0, v12h = IV[8] | 0, v12l = IV[9] | 0, v13h = IV[10] | 0, v13l = IV[11] | 0, v14h = IV[12] | 0, v14l = IV[13] | 0, v15h = IV[14] | 0, v15l = IV[15] | 0;
|
|
100
|
+
let l, th, tl;
|
|
101
|
+
v12h ^= ctx.tHi; v12l ^= ctx.tLo;
|
|
102
|
+
if (last) { v14h = ~v14h; v14l = ~v14l; }
|
|
194
103
|
for (let r = 0; r < 12; r++) {
|
|
195
104
|
const s = SIGMA[r];
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
105
|
+
const x0h = m[s[0] * 2], x0l = m[s[0] * 2 + 1];
|
|
106
|
+
const x1h = m[s[1] * 2], x1l = m[s[1] * 2 + 1];
|
|
107
|
+
const x2h = m[s[2] * 2], x2l = m[s[2] * 2 + 1];
|
|
108
|
+
const x3h = m[s[3] * 2], x3l = m[s[3] * 2 + 1];
|
|
109
|
+
const x4h = m[s[4] * 2], x4l = m[s[4] * 2 + 1];
|
|
110
|
+
const x5h = m[s[5] * 2], x5l = m[s[5] * 2 + 1];
|
|
111
|
+
const x6h = m[s[6] * 2], x6l = m[s[6] * 2 + 1];
|
|
112
|
+
const x7h = m[s[7] * 2], x7l = m[s[7] * 2 + 1];
|
|
113
|
+
const x8h = m[s[8] * 2], x8l = m[s[8] * 2 + 1];
|
|
114
|
+
const x9h = m[s[9] * 2], x9l = m[s[9] * 2 + 1];
|
|
115
|
+
const x10h = m[s[10] * 2], x10l = m[s[10] * 2 + 1];
|
|
116
|
+
const x11h = m[s[11] * 2], x11l = m[s[11] * 2 + 1];
|
|
117
|
+
const x12h = m[s[12] * 2], x12l = m[s[12] * 2 + 1];
|
|
118
|
+
const x13h = m[s[13] * 2], x13l = m[s[13] * 2 + 1];
|
|
119
|
+
const x14h = m[s[14] * 2], x14l = m[s[14] * 2 + 1];
|
|
120
|
+
const x15h = m[s[15] * 2], x15l = m[s[15] * 2 + 1];
|
|
121
|
+
l = (v0l + v4l) | 0; v0h = (v0h + v4h + ((((v0l & v4l) | ((v0l | v4l) & ~l)) >>> 31))) | 0; v0l = l;
|
|
122
|
+
l = (v0l + x0l) | 0; v0h = (v0h + x0h + ((((v0l & x0l) | ((v0l | x0l) & ~l)) >>> 31))) | 0; v0l = l;
|
|
123
|
+
th = v12h ^ v0h; tl = v12l ^ v0l;
|
|
124
|
+
v12h = tl; v12l = th;
|
|
125
|
+
l = (v8l + v12l) | 0; v8h = (v8h + v12h + ((((v8l & v12l) | ((v8l | v12l) & ~l)) >>> 31))) | 0; v8l = l;
|
|
126
|
+
th = v4h ^ v8h; tl = v4l ^ v8l;
|
|
127
|
+
v4h = (th >>> 24) | (tl << 8); v4l = (tl >>> 24) | (th << 8);
|
|
128
|
+
l = (v0l + v4l) | 0; v0h = (v0h + v4h + ((((v0l & v4l) | ((v0l | v4l) & ~l)) >>> 31))) | 0; v0l = l;
|
|
129
|
+
l = (v0l + x1l) | 0; v0h = (v0h + x1h + ((((v0l & x1l) | ((v0l | x1l) & ~l)) >>> 31))) | 0; v0l = l;
|
|
130
|
+
th = v12h ^ v0h; tl = v12l ^ v0l;
|
|
131
|
+
v12h = (th >>> 16) | (tl << 16); v12l = (tl >>> 16) | (th << 16);
|
|
132
|
+
l = (v8l + v12l) | 0; v8h = (v8h + v12h + ((((v8l & v12l) | ((v8l | v12l) & ~l)) >>> 31))) | 0; v8l = l;
|
|
133
|
+
th = v4h ^ v8h; tl = v4l ^ v8l;
|
|
134
|
+
v4h = (tl >>> 31) | (th << 1); v4l = (th >>> 31) | (tl << 1);
|
|
135
|
+
l = (v1l + v5l) | 0; v1h = (v1h + v5h + ((((v1l & v5l) | ((v1l | v5l) & ~l)) >>> 31))) | 0; v1l = l;
|
|
136
|
+
l = (v1l + x2l) | 0; v1h = (v1h + x2h + ((((v1l & x2l) | ((v1l | x2l) & ~l)) >>> 31))) | 0; v1l = l;
|
|
137
|
+
th = v13h ^ v1h; tl = v13l ^ v1l;
|
|
138
|
+
v13h = tl; v13l = th;
|
|
139
|
+
l = (v9l + v13l) | 0; v9h = (v9h + v13h + ((((v9l & v13l) | ((v9l | v13l) & ~l)) >>> 31))) | 0; v9l = l;
|
|
140
|
+
th = v5h ^ v9h; tl = v5l ^ v9l;
|
|
141
|
+
v5h = (th >>> 24) | (tl << 8); v5l = (tl >>> 24) | (th << 8);
|
|
142
|
+
l = (v1l + v5l) | 0; v1h = (v1h + v5h + ((((v1l & v5l) | ((v1l | v5l) & ~l)) >>> 31))) | 0; v1l = l;
|
|
143
|
+
l = (v1l + x3l) | 0; v1h = (v1h + x3h + ((((v1l & x3l) | ((v1l | x3l) & ~l)) >>> 31))) | 0; v1l = l;
|
|
144
|
+
th = v13h ^ v1h; tl = v13l ^ v1l;
|
|
145
|
+
v13h = (th >>> 16) | (tl << 16); v13l = (tl >>> 16) | (th << 16);
|
|
146
|
+
l = (v9l + v13l) | 0; v9h = (v9h + v13h + ((((v9l & v13l) | ((v9l | v13l) & ~l)) >>> 31))) | 0; v9l = l;
|
|
147
|
+
th = v5h ^ v9h; tl = v5l ^ v9l;
|
|
148
|
+
v5h = (tl >>> 31) | (th << 1); v5l = (th >>> 31) | (tl << 1);
|
|
149
|
+
l = (v2l + v6l) | 0; v2h = (v2h + v6h + ((((v2l & v6l) | ((v2l | v6l) & ~l)) >>> 31))) | 0; v2l = l;
|
|
150
|
+
l = (v2l + x4l) | 0; v2h = (v2h + x4h + ((((v2l & x4l) | ((v2l | x4l) & ~l)) >>> 31))) | 0; v2l = l;
|
|
151
|
+
th = v14h ^ v2h; tl = v14l ^ v2l;
|
|
152
|
+
v14h = tl; v14l = th;
|
|
153
|
+
l = (v10l + v14l) | 0; v10h = (v10h + v14h + ((((v10l & v14l) | ((v10l | v14l) & ~l)) >>> 31))) | 0; v10l = l;
|
|
154
|
+
th = v6h ^ v10h; tl = v6l ^ v10l;
|
|
155
|
+
v6h = (th >>> 24) | (tl << 8); v6l = (tl >>> 24) | (th << 8);
|
|
156
|
+
l = (v2l + v6l) | 0; v2h = (v2h + v6h + ((((v2l & v6l) | ((v2l | v6l) & ~l)) >>> 31))) | 0; v2l = l;
|
|
157
|
+
l = (v2l + x5l) | 0; v2h = (v2h + x5h + ((((v2l & x5l) | ((v2l | x5l) & ~l)) >>> 31))) | 0; v2l = l;
|
|
158
|
+
th = v14h ^ v2h; tl = v14l ^ v2l;
|
|
159
|
+
v14h = (th >>> 16) | (tl << 16); v14l = (tl >>> 16) | (th << 16);
|
|
160
|
+
l = (v10l + v14l) | 0; v10h = (v10h + v14h + ((((v10l & v14l) | ((v10l | v14l) & ~l)) >>> 31))) | 0; v10l = l;
|
|
161
|
+
th = v6h ^ v10h; tl = v6l ^ v10l;
|
|
162
|
+
v6h = (tl >>> 31) | (th << 1); v6l = (th >>> 31) | (tl << 1);
|
|
163
|
+
l = (v3l + v7l) | 0; v3h = (v3h + v7h + ((((v3l & v7l) | ((v3l | v7l) & ~l)) >>> 31))) | 0; v3l = l;
|
|
164
|
+
l = (v3l + x6l) | 0; v3h = (v3h + x6h + ((((v3l & x6l) | ((v3l | x6l) & ~l)) >>> 31))) | 0; v3l = l;
|
|
165
|
+
th = v15h ^ v3h; tl = v15l ^ v3l;
|
|
166
|
+
v15h = tl; v15l = th;
|
|
167
|
+
l = (v11l + v15l) | 0; v11h = (v11h + v15h + ((((v11l & v15l) | ((v11l | v15l) & ~l)) >>> 31))) | 0; v11l = l;
|
|
168
|
+
th = v7h ^ v11h; tl = v7l ^ v11l;
|
|
169
|
+
v7h = (th >>> 24) | (tl << 8); v7l = (tl >>> 24) | (th << 8);
|
|
170
|
+
l = (v3l + v7l) | 0; v3h = (v3h + v7h + ((((v3l & v7l) | ((v3l | v7l) & ~l)) >>> 31))) | 0; v3l = l;
|
|
171
|
+
l = (v3l + x7l) | 0; v3h = (v3h + x7h + ((((v3l & x7l) | ((v3l | x7l) & ~l)) >>> 31))) | 0; v3l = l;
|
|
172
|
+
th = v15h ^ v3h; tl = v15l ^ v3l;
|
|
173
|
+
v15h = (th >>> 16) | (tl << 16); v15l = (tl >>> 16) | (th << 16);
|
|
174
|
+
l = (v11l + v15l) | 0; v11h = (v11h + v15h + ((((v11l & v15l) | ((v11l | v15l) & ~l)) >>> 31))) | 0; v11l = l;
|
|
175
|
+
th = v7h ^ v11h; tl = v7l ^ v11l;
|
|
176
|
+
v7h = (tl >>> 31) | (th << 1); v7l = (th >>> 31) | (tl << 1);
|
|
177
|
+
l = (v0l + v5l) | 0; v0h = (v0h + v5h + ((((v0l & v5l) | ((v0l | v5l) & ~l)) >>> 31))) | 0; v0l = l;
|
|
178
|
+
l = (v0l + x8l) | 0; v0h = (v0h + x8h + ((((v0l & x8l) | ((v0l | x8l) & ~l)) >>> 31))) | 0; v0l = l;
|
|
179
|
+
th = v15h ^ v0h; tl = v15l ^ v0l;
|
|
180
|
+
v15h = tl; v15l = th;
|
|
181
|
+
l = (v10l + v15l) | 0; v10h = (v10h + v15h + ((((v10l & v15l) | ((v10l | v15l) & ~l)) >>> 31))) | 0; v10l = l;
|
|
182
|
+
th = v5h ^ v10h; tl = v5l ^ v10l;
|
|
183
|
+
v5h = (th >>> 24) | (tl << 8); v5l = (tl >>> 24) | (th << 8);
|
|
184
|
+
l = (v0l + v5l) | 0; v0h = (v0h + v5h + ((((v0l & v5l) | ((v0l | v5l) & ~l)) >>> 31))) | 0; v0l = l;
|
|
185
|
+
l = (v0l + x9l) | 0; v0h = (v0h + x9h + ((((v0l & x9l) | ((v0l | x9l) & ~l)) >>> 31))) | 0; v0l = l;
|
|
186
|
+
th = v15h ^ v0h; tl = v15l ^ v0l;
|
|
187
|
+
v15h = (th >>> 16) | (tl << 16); v15l = (tl >>> 16) | (th << 16);
|
|
188
|
+
l = (v10l + v15l) | 0; v10h = (v10h + v15h + ((((v10l & v15l) | ((v10l | v15l) & ~l)) >>> 31))) | 0; v10l = l;
|
|
189
|
+
th = v5h ^ v10h; tl = v5l ^ v10l;
|
|
190
|
+
v5h = (tl >>> 31) | (th << 1); v5l = (th >>> 31) | (tl << 1);
|
|
191
|
+
l = (v1l + v6l) | 0; v1h = (v1h + v6h + ((((v1l & v6l) | ((v1l | v6l) & ~l)) >>> 31))) | 0; v1l = l;
|
|
192
|
+
l = (v1l + x10l) | 0; v1h = (v1h + x10h + ((((v1l & x10l) | ((v1l | x10l) & ~l)) >>> 31))) | 0; v1l = l;
|
|
193
|
+
th = v12h ^ v1h; tl = v12l ^ v1l;
|
|
194
|
+
v12h = tl; v12l = th;
|
|
195
|
+
l = (v11l + v12l) | 0; v11h = (v11h + v12h + ((((v11l & v12l) | ((v11l | v12l) & ~l)) >>> 31))) | 0; v11l = l;
|
|
196
|
+
th = v6h ^ v11h; tl = v6l ^ v11l;
|
|
197
|
+
v6h = (th >>> 24) | (tl << 8); v6l = (tl >>> 24) | (th << 8);
|
|
198
|
+
l = (v1l + v6l) | 0; v1h = (v1h + v6h + ((((v1l & v6l) | ((v1l | v6l) & ~l)) >>> 31))) | 0; v1l = l;
|
|
199
|
+
l = (v1l + x11l) | 0; v1h = (v1h + x11h + ((((v1l & x11l) | ((v1l | x11l) & ~l)) >>> 31))) | 0; v1l = l;
|
|
200
|
+
th = v12h ^ v1h; tl = v12l ^ v1l;
|
|
201
|
+
v12h = (th >>> 16) | (tl << 16); v12l = (tl >>> 16) | (th << 16);
|
|
202
|
+
l = (v11l + v12l) | 0; v11h = (v11h + v12h + ((((v11l & v12l) | ((v11l | v12l) & ~l)) >>> 31))) | 0; v11l = l;
|
|
203
|
+
th = v6h ^ v11h; tl = v6l ^ v11l;
|
|
204
|
+
v6h = (tl >>> 31) | (th << 1); v6l = (th >>> 31) | (tl << 1);
|
|
205
|
+
l = (v2l + v7l) | 0; v2h = (v2h + v7h + ((((v2l & v7l) | ((v2l | v7l) & ~l)) >>> 31))) | 0; v2l = l;
|
|
206
|
+
l = (v2l + x12l) | 0; v2h = (v2h + x12h + ((((v2l & x12l) | ((v2l | x12l) & ~l)) >>> 31))) | 0; v2l = l;
|
|
207
|
+
th = v13h ^ v2h; tl = v13l ^ v2l;
|
|
208
|
+
v13h = tl; v13l = th;
|
|
209
|
+
l = (v8l + v13l) | 0; v8h = (v8h + v13h + ((((v8l & v13l) | ((v8l | v13l) & ~l)) >>> 31))) | 0; v8l = l;
|
|
210
|
+
th = v7h ^ v8h; tl = v7l ^ v8l;
|
|
211
|
+
v7h = (th >>> 24) | (tl << 8); v7l = (tl >>> 24) | (th << 8);
|
|
212
|
+
l = (v2l + v7l) | 0; v2h = (v2h + v7h + ((((v2l & v7l) | ((v2l | v7l) & ~l)) >>> 31))) | 0; v2l = l;
|
|
213
|
+
l = (v2l + x13l) | 0; v2h = (v2h + x13h + ((((v2l & x13l) | ((v2l | x13l) & ~l)) >>> 31))) | 0; v2l = l;
|
|
214
|
+
th = v13h ^ v2h; tl = v13l ^ v2l;
|
|
215
|
+
v13h = (th >>> 16) | (tl << 16); v13l = (tl >>> 16) | (th << 16);
|
|
216
|
+
l = (v8l + v13l) | 0; v8h = (v8h + v13h + ((((v8l & v13l) | ((v8l | v13l) & ~l)) >>> 31))) | 0; v8l = l;
|
|
217
|
+
th = v7h ^ v8h; tl = v7l ^ v8l;
|
|
218
|
+
v7h = (tl >>> 31) | (th << 1); v7l = (th >>> 31) | (tl << 1);
|
|
219
|
+
l = (v3l + v4l) | 0; v3h = (v3h + v4h + ((((v3l & v4l) | ((v3l | v4l) & ~l)) >>> 31))) | 0; v3l = l;
|
|
220
|
+
l = (v3l + x14l) | 0; v3h = (v3h + x14h + ((((v3l & x14l) | ((v3l | x14l) & ~l)) >>> 31))) | 0; v3l = l;
|
|
221
|
+
th = v14h ^ v3h; tl = v14l ^ v3l;
|
|
222
|
+
v14h = tl; v14l = th;
|
|
223
|
+
l = (v9l + v14l) | 0; v9h = (v9h + v14h + ((((v9l & v14l) | ((v9l | v14l) & ~l)) >>> 31))) | 0; v9l = l;
|
|
224
|
+
th = v4h ^ v9h; tl = v4l ^ v9l;
|
|
225
|
+
v4h = (th >>> 24) | (tl << 8); v4l = (tl >>> 24) | (th << 8);
|
|
226
|
+
l = (v3l + v4l) | 0; v3h = (v3h + v4h + ((((v3l & v4l) | ((v3l | v4l) & ~l)) >>> 31))) | 0; v3l = l;
|
|
227
|
+
l = (v3l + x15l) | 0; v3h = (v3h + x15h + ((((v3l & x15l) | ((v3l | x15l) & ~l)) >>> 31))) | 0; v3l = l;
|
|
228
|
+
th = v14h ^ v3h; tl = v14l ^ v3l;
|
|
229
|
+
v14h = (th >>> 16) | (tl << 16); v14l = (tl >>> 16) | (th << 16);
|
|
230
|
+
l = (v9l + v14l) | 0; v9h = (v9h + v14h + ((((v9l & v14l) | ((v9l | v14l) & ~l)) >>> 31))) | 0; v9l = l;
|
|
231
|
+
th = v4h ^ v9h; tl = v4l ^ v9l;
|
|
232
|
+
v4h = (tl >>> 31) | (th << 1); v4l = (th >>> 31) | (tl << 1);
|
|
209
233
|
}
|
|
234
|
+
h[0] ^= v0h ^ v8h; h[1] ^= v0l ^ v8l;
|
|
235
|
+
h[2] ^= v1h ^ v9h; h[3] ^= v1l ^ v9l;
|
|
236
|
+
h[4] ^= v2h ^ v10h; h[5] ^= v2l ^ v10l;
|
|
237
|
+
h[6] ^= v3h ^ v11h; h[7] ^= v3l ^ v11l;
|
|
238
|
+
h[8] ^= v4h ^ v12h; h[9] ^= v4l ^ v12l;
|
|
239
|
+
h[10] ^= v5h ^ v13h; h[11] ^= v5l ^ v13l;
|
|
240
|
+
h[12] ^= v6h ^ v14h; h[13] ^= v6l ^ v14l;
|
|
241
|
+
h[14] ^= v7h ^ v15h; h[15] ^= v7l ^ v15l;
|
|
210
242
|
}
|
|
211
243
|
|
|
212
244
|
// ── ctx + counter helpers ─────────────────────────────────────
|
|
@@ -39,9 +39,9 @@ another hash (tested: SHA-224, SHA-384, SHA-512).
|
|
|
39
39
|
| RFC 5869 App. A.3 | TC 3 (zero-length salt/info, SHA-256) | `A.3 Test Case 3` | Empty salt → 0^HashLen path + derive |
|
|
40
40
|
| **KDA-HKDF-Sp800-56Cr1** | AFT 120/200 (sub-sample 3/group) | `AFT` | byte-exact dkm (4 HMAC × 2 saltMethod × 5 zLength × 3 vectors) |
|
|
41
41
|
| **KDA-HKDF-Sp800-56Cr1** | VAL 120/200 (sub-sample 3/group, incl. 27 `testPassed=false`) | `VAL` | Candidate dkm verification — pass/fail labels honored |
|
|
42
|
-
| **KDA-HKDF-Sp800-56Cr1**
|
|
43
|
-
| **KDA-HKDF-Sp800-56Cr2 hybrid single**
|
|
44
|
-
| **KDA-HKDF-Sp800-56Cr2 hybrid multi**
|
|
42
|
+
| **KDA-HKDF-Sp800-56Cr1** | AFT 180/600 sub-sample 3/group over **6 new HMAC families** (SHA-3-{224,256,384,512} + SHA-512/{224,256}) | `6 new HMAC families` | byte-exact dkm, validates the streaming SHA-3, truncated SHA-512 and HMAC cascade over HKDF |
|
|
43
|
+
| **KDA-HKDF-Sp800-56Cr2 hybrid single** | 40 AFT capped 4/alg over the 10 families | `hybrid single-expansion AFT` | byte-exact dkm with `IKM = Z ‖ T` (SP 800-56C Rev. 2 §5.8.2) |
|
|
44
|
+
| **KDA-HKDF-Sp800-56Cr2 hybrid multi** | 20 AFT capped 2/alg, 56 total expand iterations | `hybrid multi-expansion AFT` | 1 shared PRK, N distinct expand iterations (TLS-style multi-key derivation) |
|
|
45
45
|
|
|
46
46
|
#### AFT sub-sampling strategy
|
|
47
47
|
|
|
@@ -71,10 +71,10 @@ multi-parameter. Filtering applied:
|
|
|
71
71
|
vPartyInfo || L_be32`, partyInfo = `partyId || ephemeralData`; 240
|
|
72
72
|
vectors with 16-byte `partyId` and 256-byte `ephemeralData`.
|
|
73
73
|
- [x] **HMAC-SHA-2 (4 variants)** — byte-exact.
|
|
74
|
-
- [x] **HMAC-SHA-3 (4 variants)** ✅
|
|
75
|
-
byte-exact via the streaming modules `sha3.sha3_*_hash
|
|
76
|
-
- [x] **HMAC-SHA-512/{224,256}** ✅
|
|
77
|
-
byte-exact via the `sha512_224.js` / `sha512_256.js` modules
|
|
74
|
+
- [x] **HMAC-SHA-3 (4 variants)** ✅ 60 Cr1 vectors (3/group × 4 algs × 5 groups)
|
|
75
|
+
byte-exact via the streaming modules `sha3.sha3_*_hash`.
|
|
76
|
+
- [x] **HMAC-SHA-512/{224,256}** ✅ 30 Cr1 vectors (3/group × 2 algs × 5 groups)
|
|
77
|
+
byte-exact via the `sha512_224.js` / `sha512_256.js` modules.
|
|
78
78
|
- [x] **Very large IKM** — zLength up to 65536 bits (8 KiB); multi-block
|
|
79
79
|
HMAC validated.
|
|
80
80
|
- [x] **Constant-time verify** — the `derive(...) == dkm` comparison is
|
|
@@ -85,9 +85,9 @@ multi-parameter. Filtering applied:
|
|
|
85
85
|
HashLen` → `false` (tested `expand(... 65281)` for HashLen=32 bytes).
|
|
86
86
|
- [x] **VAL pass/fail labels** — 27 `testPassed=false` cases (corrupted dkm)
|
|
87
87
|
rejected via `match === false`.
|
|
88
|
-
- [x] **Hybrid shared secret (Cr2)** ✅
|
|
88
|
+
- [x] **Hybrid shared secret (Cr2)** ✅ 40 vectors with
|
|
89
89
|
`IKM = Z ‖ T` byte-exact (SP 800-56C Rev. 2 §5.8.2).
|
|
90
|
-
- [x] **multiExpansion (Cr2)** ✅
|
|
90
|
+
- [x] **multiExpansion (Cr2)** ✅ 20 vectors (56 total iterations),
|
|
91
91
|
1 shared PRK then multiple expand with distinct fixedInfo. Validates the
|
|
92
92
|
TLS multi-key derivation use case (handshake_traffic_secret → multiple keys).
|
|
93
93
|
|
|
@@ -104,24 +104,24 @@ multi-parameter. Filtering applied:
|
|
|
104
104
|
|
|
105
105
|
## Known limitations
|
|
106
106
|
|
|
107
|
-
- ~~**HMAC-SHA-3 / HMAC-SHA-512/{224, 256}**~~ ✅
|
|
107
|
+
- ~~**HMAC-SHA-3 / HMAC-SHA-512/{224, 256}**~~ ✅
|
|
108
108
|
6 new families covered (180 Cr1 vectors sub-sample 3/group).
|
|
109
|
-
- ~~**Hybrid shared secret (Cr2)**~~ ✅
|
|
109
|
+
- ~~**Hybrid shared secret (Cr2)**~~ ✅ 40 vectors
|
|
110
110
|
AFT capped 4/alg over the 10 HMAC families; `IKM = Z ‖ T` validated byte-exact.
|
|
111
|
-
- ~~**multiExpansion**~~ ✅
|
|
111
|
+
- ~~**multiExpansion**~~ ✅ 20 vectors AFT capped 2/alg,
|
|
112
112
|
56 total expand iterations — TLS-style multi-key derivation validated.
|
|
113
113
|
- **Sub-sampling 3/group**: preserves tcId diversity. For a CMVP lab,
|
|
114
|
-
extend via `process.env.CRYPTO_FULL
|
|
114
|
+
extend via `process.env.CRYPTO_FULL`.
|
|
115
115
|
- **VAL pass/fail Cr2**: 100 negative vectors (hybrid+multi) not yet
|
|
116
116
|
covered. P3 — could be added following the existing Cr1 VAL pattern.
|
|
117
117
|
- **`hmac.js` dependency**: HKDF conformance remains tightly coupled to
|
|
118
118
|
HMAC; see [hmac.acvp.md](./hmac.acvp.md). All 10 HMAC families
|
|
119
|
-
validated
|
|
119
|
+
validated there are available here.
|
|
120
120
|
|
|
121
121
|
## Cross references
|
|
122
122
|
|
|
123
123
|
- Module: [`hash/hkdf.js`](./hkdf.js)
|
|
124
|
-
- Tests: [`hash/hkdf.test.js`](https://github.com/awacloud/awa/blob/main/packages/front/fw/src/crypto/hash/hkdf.test.js) — 490 tests (250 baseline + 240
|
|
124
|
+
- Tests: [`hash/hkdf.test.js`](https://github.com/awacloud/awa/blob/main/packages/front/fw/src/crypto/hash/hkdf.test.js) — 490 tests (250 baseline + 240 more: 180 Cr1 new families + 40 Cr2 hybrid single + 20 Cr2 hybrid multi)
|
|
125
125
|
- ACVP draft: `references/NIST/ACVP/src/draft-celi-acvp-kda.adoc`
|
|
126
126
|
- Vectors: `references/NIST/ACVP-Server-1.1.0.42/gen-val/json-files/KDA-HKDF-Sp800-56Cr1/`
|
|
127
127
|
- Underlying HMAC: [`hmac.acvp.md`](./hmac.acvp.md)
|
package/src/crypto/hash/hkdf.js
CHANGED
|
@@ -31,12 +31,12 @@ caller's responsibility (`bitArray.clamp(tag, macLen)`).
|
|
|
31
31
|
| **ACVP-HMAC-SHA2-256-2.0** | AFT sub-sample 35/150 | `ACVP HMAC-SHA2-256-2.0 / AFT` | byte-exact KAT, keyLen 8..2048, variable macLen |
|
|
32
32
|
| **ACVP-HMAC-SHA2-384-2.0** | AFT sub-sample 35/150 | `ACVP HMAC-SHA2-384-2.0 / AFT` | byte-exact KAT, keyLen 8..2048, variable macLen |
|
|
33
33
|
| **ACVP-HMAC-SHA2-512-2.0** | AFT sub-sample 36/150 | `ACVP HMAC-SHA2-512-2.0 / AFT` | byte-exact KAT, keyLen 8..2048, variable macLen |
|
|
34
|
-
| **ACVP-HMAC-SHA3-224-2.0**
|
|
35
|
-
| **ACVP-HMAC-SHA3-256-2.0**
|
|
36
|
-
| **ACVP-HMAC-SHA3-384-2.0**
|
|
37
|
-
| **ACVP-HMAC-SHA3-512-2.0**
|
|
38
|
-
| **ACVP-HMAC-SHA2-512-224-2.0**
|
|
39
|
-
| **ACVP-HMAC-SHA2-512-256-2.0**
|
|
34
|
+
| **ACVP-HMAC-SHA3-224-2.0** | AFT sub-sample 31/150 | `hmac - ACVP HMAC-SHA3-224-2.0` | byte-exact KAT via `sha3.sha3_224_hash` (rate 1152 bits) |
|
|
35
|
+
| **ACVP-HMAC-SHA3-256-2.0** | AFT sub-sample 31/150 | `hmac - ACVP HMAC-SHA3-256-2.0` | byte-exact KAT via `sha3.sha3_256_hash` (rate 1088 bits) |
|
|
36
|
+
| **ACVP-HMAC-SHA3-384-2.0** | AFT sub-sample 31/150 | `hmac - ACVP HMAC-SHA3-384-2.0` | byte-exact KAT via `sha3.sha3_384_hash` (rate 832 bits) |
|
|
37
|
+
| **ACVP-HMAC-SHA3-512-2.0** | AFT sub-sample 31/150 | `hmac - ACVP HMAC-SHA3-512-2.0` | byte-exact KAT via `sha3.sha3_512_hash` (rate 576 bits) |
|
|
38
|
+
| **ACVP-HMAC-SHA2-512-224-2.0** | AFT sub-sample 31/150 | `hmac - ACVP HMAC-SHA2-512-224-2.0` | byte-exact KAT via `sha512_224.factory(sha512)` (block 1024, digest 224 bits) |
|
|
39
|
+
| **ACVP-HMAC-SHA2-512-256-2.0** | AFT sub-sample 31/150 | `hmac - ACVP HMAC-SHA2-512-256-2.0` | byte-exact KAT via `sha512_256.factory(sha512)` (block 1024, digest 256 bits) |
|
|
40
40
|
|
|
41
41
|
#### AFT sub-sampling strategy
|
|
42
42
|
|
|
@@ -73,7 +73,7 @@ at extraction time). Strategy:
|
|
|
73
73
|
|
|
74
74
|
| Requirement | Status | Evidence |
|
|
75
75
|
|---|---|---|
|
|
76
|
-
| Approved algorithm | ✅ | FIPS 198-1 + ACVP-HMAC-SHA2-{224,256,384,512}-2.0 + ACVP-HMAC-SHA2-512-{224,256}-2.0
|
|
76
|
+
| Approved algorithm | ✅ | FIPS 198-1 + ACVP-HMAC-SHA2-{224,256,384,512}-2.0 + ACVP-HMAC-SHA2-512-{224,256}-2.0 + ACVP-HMAC-SHA3-{224,256,384,512}-2.0 |
|
|
77
77
|
| Validated parameter sizes | ✅ | **10 underlying hashes** (4 SHA-2 + 2 SHA-512-truncated + 4 SHA-3) × keyLen 8..2048 × 11 macLen values |
|
|
78
78
|
| Power-on KAT / self-test | ✅ | RFC 4231 + ~140 SHA-2 vectors + 62 SHA-512-truncated vectors + 124 SHA-3 ACVP vectors executed on every `bun test` |
|
|
79
79
|
| CT comparisons (if secret) | ✅ | `verify` → `bitArray.equal` (XOR-accumulated) |
|
|
@@ -84,13 +84,11 @@ at extraction time). Strategy:
|
|
|
84
84
|
- **HMAC-SHA-1 not covered**: SHA-1 is out of scope (discouraged by NIST SP
|
|
85
85
|
800-131A); no `sha1.js` module exposed. The ACVP
|
|
86
86
|
`HMAC-SHA-1-{1.0,2.0}` folders present under `references/NIST/` remain unused.
|
|
87
|
-
- ~~**HMAC-SHA-3 not covered**~~ ✅
|
|
87
|
+
- ~~**HMAC-SHA-3 not covered**~~ ✅
|
|
88
88
|
HMAC-SHA-3-{224,256,384,512} now covered via the streaming modules
|
|
89
|
-
`sha3.sha3_{224,256,384,512}_hash` exposed
|
|
89
|
+
`sha3.sha3_{224,256,384,512}_hash` exposed. **31
|
|
90
90
|
byte-exact ACVP HMAC-SHA3-*-2.0 vectors per variant** (124 total).
|
|
91
|
-
- ~~**HMAC-SHA-512/224 and HMAC-SHA-512/256 not covered**~~ ✅ **
|
|
92
|
-
B2**: covered via the `sha512_224.js` / `sha512_256.js` modules created
|
|
93
|
-
in A3. **62 byte-exact ACVP HMAC-SHA2-512-{224,256}-2.0 vectors**
|
|
91
|
+
- ~~**HMAC-SHA-512/224 and HMAC-SHA-512/256 not covered**~~ ✅ covered via the `sha512_224.js` / `sha512_256.js` modules. **62 byte-exact ACVP HMAC-SHA2-512-{224,256}-2.0 vectors**
|
|
94
92
|
(31 + 31 sub-samples).
|
|
95
93
|
- **AFT sub-sampling**: ~23% per variant. The HMAC code path is unique
|
|
96
94
|
(`encrypt`), only the `keyLen > blockSize` and `keyLen <
|
package/src/crypto/hash/hmac.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -68,6 +68,10 @@ export const hmac = {
|
|
|
68
68
|
|
|
69
69
|
if (typeof key === 'string') {
|
|
70
70
|
key = bitArray.ui8_to_ba(utf8.toBytes(key));
|
|
71
|
+
} else if (key instanceof Uint8Array) {
|
|
72
|
+
// A byte key is read as its bytes: without this branch its
|
|
73
|
+
// elements were taken as 32-bit words, giving another MAC.
|
|
74
|
+
key = bitArray.ui8_to_ba(key);
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
const exKey = [[], []];
|
|
@@ -43,7 +43,7 @@ callable; `.derive(...)` alias. `password`/`salt` accept `string`
|
|
|
43
43
|
| RFC 7914 / PKCS #5 (de-facto) | TC 3 (c=4096) | `c=4096, dkLen=256 bits` | byte-exact KAT (nominal count) |
|
|
44
44
|
| RFC 7914 / PKCS #5 (de-facto) | TC 4 (long P/S) | `c=4096, dkLen=320 bits` | byte-exact KAT, multi-block T_2 |
|
|
45
45
|
| **PBKDF-1.0** | AFT 25/50 (sub-sample 1/2) | `pbkdf2 - PBKDF-1.0 / AFT` | byte-exact dkm (HMAC-SHA-224 × 25 vectors) |
|
|
46
|
-
| **Cross-check against Python `hashlib.pbkdf2_hmac()`**
|
|
46
|
+
| **Cross-check against Python `hashlib.pbkdf2_hmac()`** | 9 families × 5 cases = 45 vectors | `pbkdf2 - 10-family cross-check` | byte-exact against the `hashlib.pbkdf2_hmac()` reference (SHA-2-256/384/512, SHA-512/{224,256}, SHA-3-{224,256,384,512}) |
|
|
47
47
|
|
|
48
48
|
#### AFT sub-sampling strategy
|
|
49
49
|
|
|
@@ -68,18 +68,18 @@ the other PRFs are absent from the v1.0 draft). Sub-sample applied:
|
|
|
68
68
|
(2 RFC).
|
|
69
69
|
- [x] **HMAC-SHA-256** (default PRF) — RFC 7914 vectors.
|
|
70
70
|
- [x] **HMAC-SHA-224** (Prff override) — 25 byte-exact ACVP.
|
|
71
|
-
- [x] **HMAC-SHA-{384,512}** ✅
|
|
72
|
-
- [x] **HMAC-SHA-512/{224,256}** ✅
|
|
73
|
-
- [x] **HMAC-SHA-3-{224,256,384,512}** ✅
|
|
71
|
+
- [x] **HMAC-SHA-{384,512}** ✅ 5 vectors/family cross-checked against Python `hashlib`.
|
|
72
|
+
- [x] **HMAC-SHA-512/{224,256}** ✅ 5 vectors/family cross-checked against Python `hashlib`.
|
|
73
|
+
- [x] **HMAC-SHA-3-{224,256,384,512}** ✅ 5 vectors/family cross-checked against Python `hashlib`.
|
|
74
74
|
- [x] **String → UTF-8 bytes** — handcrafted (`'password'` direct).
|
|
75
75
|
- [x] **Default count 600 000 applied** — `pbkdf2('p', 's', undefined,
|
|
76
76
|
128) === pbkdf2('p', 's', 600000, 128)`.
|
|
77
77
|
- [x] **Warning if count < 100 000** — emits `console.warn('WEAK:')`;
|
|
78
78
|
observed on 25/25 ACVP (all < 100 000) + 45 cross-check (same).
|
|
79
|
-
- [x] **Bounds** — `count <
|
|
80
|
-
- [x] **Empty password** ✅
|
|
79
|
+
- [x] **Bounds** — `count < 1` (or `NaN`) → `false`; `length < 0` → `false`.
|
|
80
|
+
- [x] **Empty password** ✅ `pbkdf2('', 'salt', 10, 128)` covered
|
|
81
81
|
for the 9 new families (degenerate PRF-over-zero-length-input case).
|
|
82
|
-
- [x] **dkLen < HashLen (T_1 truncation)** ✅
|
|
82
|
+
- [x] **dkLen < HashLen (T_1 truncation)** ✅ `dkLen=160` bits with
|
|
83
83
|
HashLen=512 bits forces a single truncated `T_1` output; covered for
|
|
84
84
|
the 9 new families.
|
|
85
85
|
- [ ] **PBKDF-2.0 ACVP** — not published to date; the Python cross-check
|
|
@@ -91,8 +91,8 @@ the other PRFs are absent from the v1.0 draft). Sub-sample applied:
|
|
|
91
91
|
| Requirement | Status | Evidence |
|
|
92
92
|
|---|---|---|
|
|
93
93
|
| Approved algorithm | ✅ | SP 800-132 (PBKDF) + PKCS #5 v2.1 |
|
|
94
|
-
| Validated parameter sizes | ✅ | dkLen 112..560 bits × salt 16..32 B × password 8..32 B × iter 1..10000 + cross-check 9 PRF families
|
|
95
|
-
| Power-on KAT / self-test | ✅ | RFC 7914 + 25 ACVP SHA-224 + 45 cross-check
|
|
94
|
+
| Validated parameter sizes | ✅ | dkLen 112..560 bits × salt 16..32 B × password 8..32 B × iter 1..10000 + cross-check 9 PRF families |
|
|
95
|
+
| Power-on KAT / self-test | ✅ | RFC 7914 + 25 ACVP SHA-224 + 45 cross-check executed on every `bun test` |
|
|
96
96
|
| CT comparisons (if secret) | N/A (PBKDF2 performs no comparison; delegated to the caller) | — |
|
|
97
97
|
| No `throw` / timing leak | ✅ | Review: `console.warn` + `return false` |
|
|
98
98
|
| Production hardening | ✅ | Default `count = 600 000` (OWASP 2023); warning below 100 000 |
|
|
@@ -101,13 +101,13 @@ the other PRFs are absent from the v1.0 draft). Sub-sample applied:
|
|
|
101
101
|
|
|
102
102
|
- **PBKDF-1.0 covers only HMAC-SHA-224**: the 9 other families
|
|
103
103
|
(SHA-256/384/512, SHA-512/{224,256}, SHA-3-{224,256,384,512}) are
|
|
104
|
-
validated
|
|
104
|
+
validated via cross-check against Python **`hashlib.pbkdf2_hmac()`**
|
|
105
105
|
(5 vectors/family = 45 regression vectors). A future PBKDF-2.0
|
|
106
106
|
ACVP would replace these snapshots with official NIST vectors.
|
|
107
107
|
- **50% sub-sampling**: 25 ACVP vectors not exercised (out of 50). The
|
|
108
108
|
even-index pattern uniformly covers the `iterationCount` range.
|
|
109
|
-
- ~~**HMAC-SHA-3**~~ ✅
|
|
110
|
-
- **
|
|
109
|
+
- ~~**HMAC-SHA-3**~~ ✅ supported via the streaming modules.
|
|
110
|
+
- **Wall-time cost**: 6.3 s for the 80 tests (including 18 vectors
|
|
111
111
|
at `c=4096` across 9 families). For `count = 600 000` (default
|
|
112
112
|
production), a single call = 30-60 s; the module is designed for
|
|
113
113
|
off-critical-path usage (key wrapping/storage).
|
|
@@ -115,7 +115,7 @@ the other PRFs are absent from the v1.0 draft). Sub-sample applied:
|
|
|
115
115
|
## Cross references
|
|
116
116
|
|
|
117
117
|
- Module: [`hash/pbkdf2.js`](./pbkdf2.js)
|
|
118
|
-
- Tests: [`hash/pbkdf2.test.js`](https://github.com/awacloud/awa/blob/main/packages/front/fw/src/crypto/hash/pbkdf2.test.js) — 80 tests (35 baseline + 45 cross-check over 9 families
|
|
118
|
+
- Tests: [`hash/pbkdf2.test.js`](https://github.com/awacloud/awa/blob/main/packages/front/fw/src/crypto/hash/pbkdf2.test.js) — 80 tests (35 baseline + 45 cross-check over 9 families)
|
|
119
119
|
- ACVP draft: `references/NIST/ACVP/src/draft-celi-acvp-pbkdf.adoc`
|
|
120
120
|
- Vectors: `references/NIST/ACVP-Server-1.1.0.42/gen-val/json-files/PBKDF-1.0/`
|
|
121
121
|
- Underlying HMAC: [`hmac.acvp.md`](./hmac.acvp.md)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -60,7 +60,7 @@ export const pbkdf2 = {
|
|
|
60
60
|
* @param {{fn:Function}} [Prff] PRF module (default: hmac, i.e.
|
|
61
61
|
* HMAC-SHA-256). Must expose `.fn` constructor + `.encrypt(data)`.
|
|
62
62
|
* @returns {bitArray|false} Derived key, or `false` on invalid
|
|
63
|
-
* parameters (negative length
|
|
63
|
+
* parameters (negative length, count below 1).
|
|
64
64
|
*/
|
|
65
65
|
function derive(password, salt, count, length, Prff) {
|
|
66
66
|
if (count === undefined) {
|
|
@@ -72,8 +72,10 @@ export const pbkdf2 = {
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
// RFC 8018 §5.2: c is a positive integer; `count < 1` (or NaN)
|
|
76
|
+
// would run no iteration at all.
|
|
77
|
+
if (length < 0 || !(count >= 1)) {
|
|
78
|
+
console.warn('[crypto] INVALID: pbkdf2: invalid params (count must be >= 1, length >= 0)');
|
|
77
79
|
return false;
|
|
78
80
|
}
|
|
79
81
|
// Edge case (post-upgrade audit): `length === 0` must return []
|
|
@@ -94,13 +96,39 @@ export const pbkdf2 = {
|
|
|
94
96
|
const prf = new Prf.fn(password);
|
|
95
97
|
let out = [];
|
|
96
98
|
|
|
99
|
+
// HMAC-SHA-256, the default PRF: every iteration after the first
|
|
100
|
+
// is two SHA-256 compressions of a padded 32-byte message on the
|
|
101
|
+
// key's inner and outer states (what HMAC computes), without
|
|
102
|
+
// allocation. Any other PRF takes the general loop.
|
|
103
|
+
const inner = prf._baseHash && prf._baseHash[0] && prf._baseHash[0]._h;
|
|
104
|
+
const outer = prf._baseHash && prf._baseHash[1] && prf._baseHash[1]._h;
|
|
105
|
+
const compress = !Prff && prf._hash && prf._hash[Symbol.for('@awacloud/fw/internal')] && prf._hash[Symbol.for('@awacloud/fw/internal')].compress;
|
|
106
|
+
const fast = typeof compress === 'function' && inner && outer && inner.length === 8 &&
|
|
107
|
+
prf._hash.fn.prototype.blockSize === 512;
|
|
108
|
+
const st = new Int32Array(8), blk = new Int32Array(16);
|
|
109
|
+
|
|
97
110
|
for (let k = 1; 32 * out.length < (length || 1); k++) {
|
|
98
111
|
let u = prf.encrypt(bitArray.concat(salt, [k]));
|
|
99
112
|
let ui = u;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
for (let
|
|
103
|
-
|
|
113
|
+
if (fast && u.length === 8) {
|
|
114
|
+
const cur = Int32Array.from(u);
|
|
115
|
+
for (let i = 1; i < count; i++) {
|
|
116
|
+
// inner: H(ipad state, U || 0x80 || 0... || 768 bits)
|
|
117
|
+
for (let j = 0; j < 8; j++) { st[j] = inner[j]; blk[j] = cur[j]; }
|
|
118
|
+
blk[8] = 0x80000000; blk[9] = 0; blk[10] = 0; blk[11] = 0; blk[12] = 0; blk[13] = 0; blk[14] = 0; blk[15] = 768;
|
|
119
|
+
compress(st, blk);
|
|
120
|
+
// outer: H(opad state, inner || 0x80 || 0... || 768 bits)
|
|
121
|
+
for (let j = 0; j < 8; j++) { blk[j] = st[j]; st[j] = outer[j]; }
|
|
122
|
+
blk[8] = 0x80000000; blk[9] = 0; blk[10] = 0; blk[11] = 0; blk[12] = 0; blk[13] = 0; blk[14] = 0; blk[15] = 768;
|
|
123
|
+
compress(st, blk);
|
|
124
|
+
for (let j = 0; j < 8; j++) { cur[j] = st[j]; u[j] ^= st[j]; }
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
for (let i = 1; i < count; i++) {
|
|
128
|
+
ui = prf.encrypt(ui);
|
|
129
|
+
for (let j = 0; j < ui.length; j++) {
|
|
130
|
+
u[j] ^= ui[j];
|
|
131
|
+
}
|
|
104
132
|
}
|
|
105
133
|
}
|
|
106
134
|
out = out.concat(u);
|