react-native-quick-crypto 1.1.0 → 1.1.1
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/android/build.gradle +5 -1
- package/cpp/argon2/HybridArgon2.cpp +10 -3
- package/cpp/blake3/HybridBlake3.cpp +5 -3
- package/cpp/cipher/CCMCipher.cpp +29 -16
- package/cpp/cipher/CCMCipher.hpp +2 -4
- package/cpp/cipher/ChaCha20Cipher.cpp +14 -18
- package/cpp/cipher/ChaCha20Cipher.hpp +2 -4
- package/cpp/cipher/ChaCha20Poly1305Cipher.cpp +34 -23
- package/cpp/cipher/ChaCha20Poly1305Cipher.hpp +2 -4
- package/cpp/cipher/GCMCipher.cpp +14 -15
- package/cpp/cipher/HybridCipher.cpp +39 -36
- package/cpp/cipher/HybridCipher.hpp +17 -1
- package/cpp/cipher/HybridRsaCipher.cpp +74 -29
- package/cpp/cipher/OCBCipher.cpp +4 -3
- package/cpp/cipher/XChaCha20Poly1305Cipher.cpp +14 -13
- package/cpp/cipher/XSalsa20Cipher.cpp +72 -6
- package/cpp/cipher/XSalsa20Cipher.hpp +25 -3
- package/cpp/cipher/XSalsa20Poly1305Cipher.cpp +21 -25
- package/cpp/dh/HybridDiffieHellman.cpp +29 -0
- package/cpp/ec/HybridEcKeyPair.cpp +35 -33
- package/cpp/ec/HybridEcKeyPair.hpp +3 -7
- package/cpp/ecdh/HybridECDH.cpp +23 -0
- package/cpp/ed25519/HybridEdKeyPair.cpp +73 -117
- package/cpp/ed25519/HybridEdKeyPair.hpp +5 -9
- package/cpp/hash/HybridHash.cpp +5 -7
- package/cpp/hkdf/HybridHkdf.cpp +6 -4
- package/cpp/hmac/HybridHmac.cpp +4 -6
- package/cpp/kmac/HybridKmac.cpp +4 -4
- package/cpp/mldsa/HybridMlDsaKeyPair.cpp +37 -49
- package/cpp/mlkem/HybridMlKemKeyPair.cpp +39 -43
- package/cpp/pbkdf2/HybridPbkdf2.cpp +7 -8
- package/cpp/rsa/HybridRsaKeyPair.cpp +5 -8
- package/cpp/rsa/HybridRsaKeyPair.hpp +4 -7
- package/cpp/scrypt/HybridScrypt.cpp +6 -4
- package/cpp/sign/HybridSignHandle.cpp +25 -68
- package/cpp/sign/HybridVerifyHandle.cpp +23 -60
- package/cpp/utils/HybridUtils.cpp +183 -43
- package/cpp/utils/HybridUtils.hpp +9 -2
- package/cpp/utils/QuickCryptoUtils.hpp +72 -0
- package/lib/commonjs/argon2.js +51 -2
- package/lib/commonjs/argon2.js.map +1 -1
- package/lib/commonjs/cipher.js +109 -11
- package/lib/commonjs/cipher.js.map +1 -1
- package/lib/commonjs/dsa.js +8 -2
- package/lib/commonjs/dsa.js.map +1 -1
- package/lib/commonjs/hash.js +15 -5
- package/lib/commonjs/hash.js.map +1 -1
- package/lib/commonjs/hkdf.js +33 -6
- package/lib/commonjs/hkdf.js.map +1 -1
- package/lib/commonjs/hmac.js +15 -5
- package/lib/commonjs/hmac.js.map +1 -1
- package/lib/commonjs/keys/publicCipher.js +10 -4
- package/lib/commonjs/keys/publicCipher.js.map +1 -1
- package/lib/commonjs/random.js +11 -2
- package/lib/commonjs/random.js.map +1 -1
- package/lib/commonjs/rsa.js +12 -5
- package/lib/commonjs/rsa.js.map +1 -1
- package/lib/commonjs/scrypt.js +47 -6
- package/lib/commonjs/scrypt.js.map +1 -1
- package/lib/commonjs/subtle.js +76 -5
- package/lib/commonjs/subtle.js.map +1 -1
- package/lib/commonjs/utils/cipher.js +18 -7
- package/lib/commonjs/utils/cipher.js.map +1 -1
- package/lib/commonjs/utils/conversion.js +33 -9
- package/lib/commonjs/utils/conversion.js.map +1 -1
- package/lib/commonjs/utils/timingSafeEqual.js +7 -2
- package/lib/commonjs/utils/timingSafeEqual.js.map +1 -1
- package/lib/commonjs/x509certificate.js +6 -6
- package/lib/commonjs/x509certificate.js.map +1 -1
- package/lib/module/argon2.js +51 -2
- package/lib/module/argon2.js.map +1 -1
- package/lib/module/cipher.js +109 -11
- package/lib/module/cipher.js.map +1 -1
- package/lib/module/dsa.js +8 -2
- package/lib/module/dsa.js.map +1 -1
- package/lib/module/hash.js +15 -5
- package/lib/module/hash.js.map +1 -1
- package/lib/module/hkdf.js +33 -6
- package/lib/module/hkdf.js.map +1 -1
- package/lib/module/hmac.js +15 -5
- package/lib/module/hmac.js.map +1 -1
- package/lib/module/keys/publicCipher.js +10 -4
- package/lib/module/keys/publicCipher.js.map +1 -1
- package/lib/module/random.js +11 -2
- package/lib/module/random.js.map +1 -1
- package/lib/module/rsa.js +11 -4
- package/lib/module/rsa.js.map +1 -1
- package/lib/module/scrypt.js +47 -6
- package/lib/module/scrypt.js.map +1 -1
- package/lib/module/subtle.js +76 -5
- package/lib/module/subtle.js.map +1 -1
- package/lib/module/utils/cipher.js +18 -7
- package/lib/module/utils/cipher.js.map +1 -1
- package/lib/module/utils/conversion.js +33 -9
- package/lib/module/utils/conversion.js.map +1 -1
- package/lib/module/utils/timingSafeEqual.js +8 -3
- package/lib/module/utils/timingSafeEqual.js.map +1 -1
- package/lib/module/x509certificate.js +6 -6
- package/lib/module/x509certificate.js.map +1 -1
- package/lib/typescript/argon2.d.ts.map +1 -1
- package/lib/typescript/cipher.d.ts +2 -2
- package/lib/typescript/cipher.d.ts.map +1 -1
- package/lib/typescript/dsa.d.ts.map +1 -1
- package/lib/typescript/hash.d.ts +2 -2
- package/lib/typescript/hash.d.ts.map +1 -1
- package/lib/typescript/hkdf.d.ts.map +1 -1
- package/lib/typescript/hmac.d.ts +2 -2
- package/lib/typescript/hmac.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/keys/publicCipher.d.ts.map +1 -1
- package/lib/typescript/random.d.ts.map +1 -1
- package/lib/typescript/rsa.d.ts.map +1 -1
- package/lib/typescript/scrypt.d.ts.map +1 -1
- package/lib/typescript/specs/utils.nitro.d.ts +0 -2
- package/lib/typescript/specs/utils.nitro.d.ts.map +1 -1
- package/lib/typescript/subtle.d.ts.map +1 -1
- package/lib/typescript/utils/cipher.d.ts +13 -1
- package/lib/typescript/utils/cipher.d.ts.map +1 -1
- package/lib/typescript/utils/conversion.d.ts +9 -6
- package/lib/typescript/utils/conversion.d.ts.map +1 -1
- package/lib/typescript/utils/timingSafeEqual.d.ts.map +1 -1
- package/lib/typescript/x509certificate.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/HybridUtilsSpec.cpp +0 -2
- package/nitrogen/generated/shared/c++/HybridUtilsSpec.hpp +0 -3
- package/package.json +37 -5
- package/src/argon2.ts +80 -2
- package/src/cipher.ts +139 -15
- package/src/dsa.ts +11 -2
- package/src/hash.ts +17 -7
- package/src/hkdf.ts +44 -6
- package/src/hmac.ts +17 -7
- package/src/keys/publicCipher.ts +10 -4
- package/src/random.ts +11 -2
- package/src/rsa.ts +18 -4
- package/src/scrypt.ts +73 -6
- package/src/specs/utils.nitro.ts +0 -2
- package/src/subtle.ts +90 -8
- package/src/utils/cipher.ts +30 -8
- package/src/utils/conversion.ts +58 -20
- package/src/utils/timingSafeEqual.ts +8 -3
- package/src/x509certificate.ts +5 -6
- package/deps/blake3/.cargo/config.toml +0 -2
- package/deps/blake3/.git-blame-ignore-revs +0 -2
- package/deps/blake3/.github/workflows/build_b3sum.py +0 -38
- package/deps/blake3/.github/workflows/ci.yml +0 -491
- package/deps/blake3/.github/workflows/tag.yml +0 -43
- package/deps/blake3/.github/workflows/upload_github_release_asset.py +0 -73
- package/deps/blake3/CONTRIBUTING.md +0 -31
- package/deps/blake3/Cargo.toml +0 -135
- package/deps/blake3/b3sum/Cargo.lock +0 -513
- package/deps/blake3/b3sum/Cargo.toml +0 -26
- package/deps/blake3/b3sum/README.md +0 -72
- package/deps/blake3/b3sum/src/main.rs +0 -564
- package/deps/blake3/b3sum/src/unit_tests.rs +0 -235
- package/deps/blake3/b3sum/tests/cli_tests.rs +0 -680
- package/deps/blake3/b3sum/what_does_check_do.md +0 -176
- package/deps/blake3/benches/bench.rs +0 -623
- package/deps/blake3/build.rs +0 -389
- package/deps/blake3/c/CMakeLists.txt +0 -383
- package/deps/blake3/c/CMakePresets.json +0 -73
- package/deps/blake3/c/Makefile.testing +0 -82
- package/deps/blake3/c/blake3-config.cmake.in +0 -14
- package/deps/blake3/c/blake3_avx2.c +0 -326
- package/deps/blake3/c/blake3_avx2_x86-64_unix.S +0 -1815
- package/deps/blake3/c/blake3_avx2_x86-64_windows_gnu.S +0 -1817
- package/deps/blake3/c/blake3_avx2_x86-64_windows_msvc.asm +0 -1828
- package/deps/blake3/c/blake3_avx512.c +0 -1388
- package/deps/blake3/c/blake3_avx512_x86-64_unix.S +0 -4824
- package/deps/blake3/c/blake3_avx512_x86-64_windows_gnu.S +0 -2615
- package/deps/blake3/c/blake3_avx512_x86-64_windows_msvc.asm +0 -2634
- package/deps/blake3/c/blake3_c_rust_bindings/Cargo.toml +0 -32
- package/deps/blake3/c/blake3_c_rust_bindings/README.md +0 -4
- package/deps/blake3/c/blake3_c_rust_bindings/benches/bench.rs +0 -477
- package/deps/blake3/c/blake3_c_rust_bindings/build.rs +0 -253
- package/deps/blake3/c/blake3_c_rust_bindings/cross_test.sh +0 -31
- package/deps/blake3/c/blake3_c_rust_bindings/src/lib.rs +0 -333
- package/deps/blake3/c/blake3_c_rust_bindings/src/test.rs +0 -696
- package/deps/blake3/c/blake3_sse2.c +0 -566
- package/deps/blake3/c/blake3_sse2_x86-64_unix.S +0 -2291
- package/deps/blake3/c/blake3_sse2_x86-64_windows_gnu.S +0 -2332
- package/deps/blake3/c/blake3_sse2_x86-64_windows_msvc.asm +0 -2350
- package/deps/blake3/c/blake3_sse41.c +0 -560
- package/deps/blake3/c/blake3_sse41_x86-64_unix.S +0 -2028
- package/deps/blake3/c/blake3_sse41_x86-64_windows_gnu.S +0 -2069
- package/deps/blake3/c/blake3_sse41_x86-64_windows_msvc.asm +0 -2089
- package/deps/blake3/c/blake3_tbb.cpp +0 -37
- package/deps/blake3/c/dependencies/CMakeLists.txt +0 -3
- package/deps/blake3/c/dependencies/tbb/CMakeLists.txt +0 -28
- package/deps/blake3/c/example.c +0 -36
- package/deps/blake3/c/example_tbb.c +0 -57
- package/deps/blake3/c/libblake3.pc.in +0 -12
- package/deps/blake3/c/main.c +0 -166
- package/deps/blake3/c/test.py +0 -97
- package/deps/blake3/media/B3.svg +0 -70
- package/deps/blake3/media/BLAKE3.svg +0 -85
- package/deps/blake3/media/speed.svg +0 -1474
- package/deps/blake3/reference_impl/Cargo.toml +0 -8
- package/deps/blake3/reference_impl/README.md +0 -14
- package/deps/blake3/reference_impl/reference_impl.rs +0 -374
- package/deps/blake3/src/ffi_avx2.rs +0 -65
- package/deps/blake3/src/ffi_avx512.rs +0 -169
- package/deps/blake3/src/ffi_neon.rs +0 -82
- package/deps/blake3/src/ffi_sse2.rs +0 -126
- package/deps/blake3/src/ffi_sse41.rs +0 -126
- package/deps/blake3/src/guts.rs +0 -60
- package/deps/blake3/src/hazmat.rs +0 -704
- package/deps/blake3/src/io.rs +0 -64
- package/deps/blake3/src/join.rs +0 -92
- package/deps/blake3/src/lib.rs +0 -1835
- package/deps/blake3/src/platform.rs +0 -587
- package/deps/blake3/src/portable.rs +0 -198
- package/deps/blake3/src/rust_avx2.rs +0 -474
- package/deps/blake3/src/rust_sse2.rs +0 -775
- package/deps/blake3/src/rust_sse41.rs +0 -766
- package/deps/blake3/src/test.rs +0 -1049
- package/deps/blake3/src/traits.rs +0 -227
- package/deps/blake3/src/wasm32_simd.rs +0 -794
- package/deps/blake3/test_vectors/Cargo.toml +0 -19
- package/deps/blake3/test_vectors/cross_test.sh +0 -25
- package/deps/blake3/test_vectors/src/bin/generate.rs +0 -4
- package/deps/blake3/test_vectors/src/lib.rs +0 -350
- package/deps/blake3/test_vectors/test_vectors.json +0 -217
- package/deps/blake3/tools/compiler_version/Cargo.toml +0 -7
- package/deps/blake3/tools/compiler_version/build.rs +0 -6
- package/deps/blake3/tools/compiler_version/src/main.rs +0 -27
- package/deps/blake3/tools/instruction_set_support/Cargo.toml +0 -6
- package/deps/blake3/tools/instruction_set_support/src/main.rs +0 -10
- package/deps/blake3/tools/release.md +0 -16
- package/deps/ncrypto/.bazelignore +0 -4
- package/deps/ncrypto/.bazelrc +0 -1
- package/deps/ncrypto/.bazelversion +0 -1
- package/deps/ncrypto/.clang-format +0 -111
- package/deps/ncrypto/.github/workflows/bazel.yml +0 -58
- package/deps/ncrypto/.github/workflows/commitlint.yml +0 -16
- package/deps/ncrypto/.github/workflows/linter.yml +0 -38
- package/deps/ncrypto/.github/workflows/macos.yml +0 -43
- package/deps/ncrypto/.github/workflows/release-please.yml +0 -16
- package/deps/ncrypto/.github/workflows/ubuntu.yml +0 -128
- package/deps/ncrypto/.github/workflows/visual-studio.yml +0 -49
- package/deps/ncrypto/.python-version +0 -1
- package/deps/ncrypto/.release-please-manifest.json +0 -3
- package/deps/ncrypto/BUILD.bazel +0 -44
- package/deps/ncrypto/CHANGELOG.md +0 -37
- package/deps/ncrypto/CMakeLists.txt +0 -79
- package/deps/ncrypto/MODULE.bazel +0 -16
- package/deps/ncrypto/MODULE.bazel.lock +0 -461
- package/deps/ncrypto/cmake/CPM.cmake +0 -1225
- package/deps/ncrypto/cmake/ncrypto-flags.cmake +0 -17
- package/deps/ncrypto/ncrypto.pc.in +0 -10
- package/deps/ncrypto/patches/0001-Expose-libdecrepit-so-NodeJS-can-use-it-for-ncrypto.patch +0 -28
- package/deps/ncrypto/pyproject.toml +0 -38
- package/deps/ncrypto/release-please-config.json +0 -11
- package/deps/ncrypto/src/CMakeLists.txt +0 -40
- package/deps/ncrypto/tests/BUILD.bazel +0 -11
- package/deps/ncrypto/tests/CMakeLists.txt +0 -7
- package/deps/ncrypto/tests/basic.cpp +0 -856
- package/deps/ncrypto/tools/run-clang-format.sh +0 -42
- package/deps/simdutf/.clang-format +0 -4
- package/deps/simdutf/.github/ISSUE_TEMPLATE/bug_report.md +0 -62
- package/deps/simdutf/.github/ISSUE_TEMPLATE/config.yml +0 -1
- package/deps/simdutf/.github/ISSUE_TEMPLATE/feature_request.md +0 -35
- package/deps/simdutf/.github/ISSUE_TEMPLATE/standard-issue-template.md +0 -29
- package/deps/simdutf/.github/pull_request_template.md +0 -51
- package/deps/simdutf/.github/workflows/aarch64.yml +0 -39
- package/deps/simdutf/.github/workflows/alpine.yml +0 -27
- package/deps/simdutf/.github/workflows/amalgamation_demos.yml +0 -34
- package/deps/simdutf/.github/workflows/armv7.yml +0 -32
- package/deps/simdutf/.github/workflows/atomic_fuzz.yml +0 -25
- package/deps/simdutf/.github/workflows/cifuzz.yml +0 -37
- package/deps/simdutf/.github/workflows/clangformat.yml +0 -36
- package/deps/simdutf/.github/workflows/debian-latestcxxstandards.yml +0 -40
- package/deps/simdutf/.github/workflows/debian.yml +0 -33
- package/deps/simdutf/.github/workflows/documentation.yml +0 -36
- package/deps/simdutf/.github/workflows/emscripten.yml +0 -19
- package/deps/simdutf/.github/workflows/loongarch64-gcc-14.2.yml +0 -39
- package/deps/simdutf/.github/workflows/macos-latest.yml +0 -29
- package/deps/simdutf/.github/workflows/msys2-clang.yml +0 -48
- package/deps/simdutf/.github/workflows/msys2.yml +0 -50
- package/deps/simdutf/.github/workflows/ppc64le.yml +0 -29
- package/deps/simdutf/.github/workflows/rvv-1024-clang-18.yml +0 -35
- package/deps/simdutf/.github/workflows/rvv-128-clang-17.yml +0 -35
- package/deps/simdutf/.github/workflows/rvv-256-gcc-14.yml +0 -31
- package/deps/simdutf/.github/workflows/s390x.yml +0 -29
- package/deps/simdutf/.github/workflows/selective-amalgamation.yml +0 -29
- package/deps/simdutf/.github/workflows/typos.yml +0 -19
- package/deps/simdutf/.github/workflows/ubuntu22-cxx20.yml +0 -30
- package/deps/simdutf/.github/workflows/ubuntu22.yml +0 -32
- package/deps/simdutf/.github/workflows/ubuntu22_gcc12.yml +0 -27
- package/deps/simdutf/.github/workflows/ubuntu22sani.yml +0 -29
- package/deps/simdutf/.github/workflows/ubuntu24-cxxstandards.yml +0 -34
- package/deps/simdutf/.github/workflows/ubuntu24-unsignedchar.yml +0 -34
- package/deps/simdutf/.github/workflows/ubuntu24.yml +0 -32
- package/deps/simdutf/.github/workflows/ubuntu24sani.yml +0 -36
- package/deps/simdutf/.github/workflows/ubuntu24sani_clang.yml +0 -29
- package/deps/simdutf/.github/workflows/vs17-arm-ci.yml +0 -21
- package/deps/simdutf/.github/workflows/vs17-ci-cxx20.yml +0 -41
- package/deps/simdutf/.github/workflows/vs17-ci.yml +0 -41
- package/deps/simdutf/.github/workflows/vs17-clang-ci.yml +0 -41
- package/deps/simdutf/.github/workflows/vs17-cxxstandards.yml +0 -36
- package/deps/simdutf/AI_USAGE_POLICY.md +0 -56
- package/deps/simdutf/AUTHORS +0 -6
- package/deps/simdutf/CMakeLists.txt +0 -231
- package/deps/simdutf/CONTRIBUTING.md +0 -214
- package/deps/simdutf/CONTRIBUTORS +0 -1
- package/deps/simdutf/Doxyfile +0 -2584
- package/deps/simdutf/Makefile.crosscompile +0 -54
- package/deps/simdutf/README-RVV.md +0 -16
- package/deps/simdutf/SECURITY.md +0 -8
- package/deps/simdutf/benchmarks/CMakeLists.txt +0 -101
- package/deps/simdutf/benchmarks/alignment.cpp +0 -150
- package/deps/simdutf/benchmarks/base64/CMakeLists.txt +0 -30
- package/deps/simdutf/benchmarks/base64/benchmark_base64.cpp +0 -875
- package/deps/simdutf/benchmarks/base64/libbase64_spaces.h +0 -49
- package/deps/simdutf/benchmarks/base64/node_base64.h +0 -227
- package/deps/simdutf/benchmarks/base64/openssl3_base64.h +0 -334
- package/deps/simdutf/benchmarks/benchmark.cpp +0 -65
- package/deps/simdutf/benchmarks/benchmark_to_well_formed_utf16.cpp +0 -347
- package/deps/simdutf/benchmarks/competition/.clang-format-ignore +0 -5
- package/deps/simdutf/benchmarks/competition/CppCon2018/utf_utils.cpp +0 -1276
- package/deps/simdutf/benchmarks/competition/CppCon2018/utf_utils.h +0 -595
- package/deps/simdutf/benchmarks/competition/README.md +0 -7
- package/deps/simdutf/benchmarks/competition/hoehrmann/hoehrmann.h +0 -91
- package/deps/simdutf/benchmarks/competition/inoue2008/inoue_utf8_to_utf16.h +0 -444
- package/deps/simdutf/benchmarks/competition/inoue2008/inoue_utf8_to_utf16_tables.h +0 -13183
- package/deps/simdutf/benchmarks/competition/inoue2008/script.py +0 -73
- package/deps/simdutf/benchmarks/competition/llvm/ConvertUTF.cpp +0 -738
- package/deps/simdutf/benchmarks/competition/llvm/ConvertUTF.h +0 -293
- package/deps/simdutf/benchmarks/competition/u8u16/COPYRIGHT +0 -8
- package/deps/simdutf/benchmarks/competition/u8u16/Makefile +0 -44
- package/deps/simdutf/benchmarks/competition/u8u16/OSL3.0.txt +0 -169
- package/deps/simdutf/benchmarks/competition/u8u16/Profiling/BOM_Profiler.h +0 -148
- package/deps/simdutf/benchmarks/competition/u8u16/Profiling/i386_timer.h +0 -45
- package/deps/simdutf/benchmarks/competition/u8u16/Profiling/ppc_timer.c +0 -34
- package/deps/simdutf/benchmarks/competition/u8u16/README +0 -56
- package/deps/simdutf/benchmarks/competition/u8u16/config/config_defs.h +0 -43
- package/deps/simdutf/benchmarks/competition/u8u16/config/g4_config.h +0 -27
- package/deps/simdutf/benchmarks/competition/u8u16/config/mmx_config.h +0 -16
- package/deps/simdutf/benchmarks/competition/u8u16/config/p4_config.h +0 -18
- package/deps/simdutf/benchmarks/competition/u8u16/config/p4_ideal_config.h +0 -16
- package/deps/simdutf/benchmarks/competition/u8u16/config/spu_config.h +0 -28
- package/deps/simdutf/benchmarks/competition/u8u16/config/ssse3_config.h +0 -20
- package/deps/simdutf/benchmarks/competition/u8u16/iconv_u8u16.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/lib/altivec_simd.h +0 -440
- package/deps/simdutf/benchmarks/competition/u8u16/lib/libgen/make_basic_ops.py +0 -121
- package/deps/simdutf/benchmarks/competition/u8u16/lib/libgen/make_half_operand_versions.py +0 -158
- package/deps/simdutf/benchmarks/competition/u8u16/lib/libgen/make_test.py +0 -270
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd.h +0 -141
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd_basic.h +0 -216
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd_built_in.h +0 -119
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd_modified.h +0 -2430
- package/deps/simdutf/benchmarks/competition/u8u16/lib/outline.txt +0 -39
- package/deps/simdutf/benchmarks/competition/u8u16/lib/spu_simd.h +0 -421
- package/deps/simdutf/benchmarks/competition/u8u16/lib/sse_simd.h +0 -836
- package/deps/simdutf/benchmarks/competition/u8u16/lib/stdint.h +0 -222
- package/deps/simdutf/benchmarks/competition/u8u16/libu8u16_BE.c +0 -4
- package/deps/simdutf/benchmarks/competition/u8u16/libu8u16_LE.c +0 -5
- package/deps/simdutf/benchmarks/competition/u8u16/proto/u8u16.py +0 -390
- package/deps/simdutf/benchmarks/competition/u8u16/src/Makefile +0 -18
- package/deps/simdutf/benchmarks/competition/u8u16/src/bytelex.h +0 -448
- package/deps/simdutf/benchmarks/competition/u8u16/src/charsets/ASCII_EBCDIC.h +0 -284
- package/deps/simdutf/benchmarks/competition/u8u16/src/libu8u16.c +0 -1975
- package/deps/simdutf/benchmarks/competition/u8u16/src/libu8u16.pdf +0 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/libu8u16.w +0 -2263
- package/deps/simdutf/benchmarks/competition/u8u16/src/multiliteral.h +0 -239
- package/deps/simdutf/benchmarks/competition/u8u16/src/u8u16.c +0 -232
- package/deps/simdutf/benchmarks/competition/u8u16/src/x8x16.c +0 -194
- package/deps/simdutf/benchmarks/competition/u8u16/src/xml_error.c +0 -193
- package/deps/simdutf/benchmarks/competition/u8u16/src/xml_error.h +0 -167
- package/deps/simdutf/benchmarks/competition/u8u16/src/xmldecl.c +0 -288
- package/deps/simdutf/benchmarks/competition/u8u16/src/xmldecl.h +0 -117
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_g4.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_mmx.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_p4.c +0 -3
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_p4_ideal.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_spu.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_ssse3.c +0 -3
- package/deps/simdutf/benchmarks/competition/u8u16/x8x16_p4.c +0 -2
- package/deps/simdutf/benchmarks/competition/utf8lut/LICENSE +0 -23
- package/deps/simdutf/benchmarks/competition/utf8lut/data/test_minimal.txt +0 -44
- package/deps/simdutf/benchmarks/competition/utf8lut/readme.md +0 -106
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_clang_corr_tests.cmd +0 -11
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_clang_corr_tests.sh +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_corr_tests.sh +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_example.sh +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_file_conv.sh +0 -14
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_iconv_lib.sh +0 -11
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_iconv_sample.sh +0 -8
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_corr_tests.cmd +0 -12
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_example.cmd +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_file_conv.cmd +0 -14
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_iconv_lib.cmd +0 -11
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_iconv_sample.cmd +0 -8
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_corr_tests.cmd +0 -11
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_example.cmd +0 -12
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_file_conv.cmd +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_iconv_lib.cmd +0 -10
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_iconv_sample.cmd +0 -9
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/html_table.py +0 -25
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/measure.py +0 -94
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/resize.py +0 -20
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/wipe_all.cmd +0 -2
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/wipe_interm.cmd +0 -1
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/CustomMemcpy.h +0 -75
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/PerfDefs.h +0 -47
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/Timing.cpp +0 -17
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/Timing.h +0 -76
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/AllProcessors.cpp +0 -35
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BaseBufferProcessor.cpp +0 -117
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BaseBufferProcessor.h +0 -210
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BufferDecoder.h +0 -158
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BufferEncoder.h +0 -104
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/ProcessorPlugins.h +0 -334
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/ProcessorSelector.h +0 -186
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/DecoderLut.cpp +0 -140
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/DecoderLut.h +0 -42
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/DecoderProcess.h +0 -100
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/Dfa.h +0 -57
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/EncoderLut.cpp +0 -85
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/EncoderLut.h +0 -27
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/EncoderProcess.h +0 -126
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/ProcessTrivial.h +0 -108
- package/deps/simdutf/benchmarks/competition/utf8lut/src/iconv/iconv.cpp +0 -139
- package/deps/simdutf/benchmarks/competition/utf8lut/src/iconv/iconv.h +0 -74
- package/deps/simdutf/benchmarks/competition/utf8lut/src/message/MessageConverter.cpp +0 -65
- package/deps/simdutf/benchmarks/competition/utf8lut/src/message/MessageConverter.h +0 -91
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/CorrectnessTests.cpp +0 -772
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/Example.cpp +0 -12
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/FileConverter.cpp +0 -486
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/iconv_sample.c +0 -162
- package/deps/simdutf/benchmarks/competition/utf8lut/src/utf8lut.h +0 -15
- package/deps/simdutf/benchmarks/competition/utf8sse4/fromutf8-sse.cpp +0 -292
- package/deps/simdutf/benchmarks/competition/utfcpp/LICENSE +0 -23
- package/deps/simdutf/benchmarks/competition/utfcpp/README.md +0 -1503
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/checked.h +0 -335
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/core.h +0 -338
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/cpp11.h +0 -103
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/cpp17.h +0 -103
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/unchecked.h +0 -274
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8.h +0 -34
- package/deps/simdutf/benchmarks/dataset/README.md +0 -155
- package/deps/simdutf/benchmarks/dataset/emoji.txt +0 -204
- package/deps/simdutf/benchmarks/dataset/scripts/utf8type.py +0 -40
- package/deps/simdutf/benchmarks/dataset/wikipedia_mars/Makefile +0 -80
- package/deps/simdutf/benchmarks/dataset/wikipedia_mars/convert_to_utf6.py +0 -20
- package/deps/simdutf/benchmarks/find/CMakeLists.txt +0 -6
- package/deps/simdutf/benchmarks/find/findbenchmark.cpp +0 -63
- package/deps/simdutf/benchmarks/find/findbenchmarker.h +0 -46
- package/deps/simdutf/benchmarks/shortbench.cpp +0 -555
- package/deps/simdutf/benchmarks/src/CMakeLists.txt +0 -52
- package/deps/simdutf/benchmarks/src/apple_arm_events.h +0 -1104
- package/deps/simdutf/benchmarks/src/benchmark.cpp +0 -3899
- package/deps/simdutf/benchmarks/src/benchmark.h +0 -317
- package/deps/simdutf/benchmarks/src/benchmark_base.cpp +0 -144
- package/deps/simdutf/benchmarks/src/benchmark_base.h +0 -98
- package/deps/simdutf/benchmarks/src/cmdline.cpp +0 -176
- package/deps/simdutf/benchmarks/src/cmdline.h +0 -35
- package/deps/simdutf/benchmarks/src/event_counter.h +0 -162
- package/deps/simdutf/benchmarks/src/linux-perf-events.h +0 -104
- package/deps/simdutf/benchmarks/stream.cpp +0 -209
- package/deps/simdutf/benchmarks/threaded.cpp +0 -123
- package/deps/simdutf/cmake/CPM.cmake +0 -1363
- package/deps/simdutf/cmake/JoinPaths.cmake +0 -23
- package/deps/simdutf/cmake/add_cpp_test.cmake +0 -68
- package/deps/simdutf/cmake/simdutf-config.cmake.in +0 -2
- package/deps/simdutf/cmake/simdutf-flags.cmake +0 -26
- package/deps/simdutf/cmake/toolchains-ci/riscv64-linux-gnu.cmake +0 -4
- package/deps/simdutf/cmake/toolchains-dev/README.md +0 -32
- package/deps/simdutf/cmake/toolchains-dev/aarch64.cmake +0 -14
- package/deps/simdutf/cmake/toolchains-dev/loongarch64.cmake +0 -22
- package/deps/simdutf/cmake/toolchains-dev/powerpc64.cmake +0 -16
- package/deps/simdutf/cmake/toolchains-dev/powerpc64le.cmake +0 -16
- package/deps/simdutf/cmake/toolchains-dev/riscv64.cmake +0 -16
- package/deps/simdutf/cmake/toolchains-dev/rvv-spike.cmake +0 -38
- package/deps/simdutf/doc/avx512.png +0 -0
- package/deps/simdutf/doc/logo.png +0 -0
- package/deps/simdutf/doc/logo.svg +0 -165
- package/deps/simdutf/doc/node2023.png +0 -0
- package/deps/simdutf/doc/shortinput.md +0 -78
- package/deps/simdutf/doc/utf16utf8.png +0 -0
- package/deps/simdutf/doc/utf8utf16.png +0 -0
- package/deps/simdutf/doc/widelogo.png +0 -0
- package/deps/simdutf/doxygen.py +0 -50
- package/deps/simdutf/fuzz/.clang-format +0 -9
- package/deps/simdutf/fuzz/CMakeLists.txt +0 -45
- package/deps/simdutf/fuzz/README.md +0 -168
- package/deps/simdutf/fuzz/atomic_base64.cpp +0 -448
- package/deps/simdutf/fuzz/base64.cpp +0 -278
- package/deps/simdutf/fuzz/build.sh +0 -83
- package/deps/simdutf/fuzz/conversion.cpp +0 -669
- package/deps/simdutf/fuzz/helpers/.clang-format-ignore +0 -1
- package/deps/simdutf/fuzz/helpers/common.h +0 -135
- package/deps/simdutf/fuzz/helpers/nameof.hpp +0 -1258
- package/deps/simdutf/fuzz/main.cpp +0 -72
- package/deps/simdutf/fuzz/minimize_and_cleanse.sh +0 -87
- package/deps/simdutf/fuzz/misc.cpp +0 -216
- package/deps/simdutf/fuzz/random_fuzz.sh +0 -154
- package/deps/simdutf/fuzz/roundtrip.cpp +0 -588
- package/deps/simdutf/fuzz/safe_conversion.cpp +0 -104
- package/deps/simdutf/riscv/Dockerfile +0 -16
- package/deps/simdutf/riscv/README.md +0 -24
- package/deps/simdutf/riscv/remove-docker-station +0 -8
- package/deps/simdutf/riscv/run-docker-station +0 -31
- package/deps/simdutf/scripts/.flake8 +0 -2
- package/deps/simdutf/scripts/Makefile +0 -2
- package/deps/simdutf/scripts/README_ADD_FUNCTION.md +0 -49
- package/deps/simdutf/scripts/add_function.py +0 -330
- package/deps/simdutf/scripts/amalgamation_tests.py +0 -156
- package/deps/simdutf/scripts/base64/Makefile +0 -2
- package/deps/simdutf/scripts/base64/README.md +0 -2
- package/deps/simdutf/scripts/base64/avx512.py +0 -76
- package/deps/simdutf/scripts/base64/neon_decode.py +0 -143
- package/deps/simdutf/scripts/base64/neon_generate_lut.py +0 -101
- package/deps/simdutf/scripts/base64/sse.py +0 -252
- package/deps/simdutf/scripts/base64/sseregular.py +0 -160
- package/deps/simdutf/scripts/base64/sseurl.py +0 -283
- package/deps/simdutf/scripts/base64/table.py +0 -59
- package/deps/simdutf/scripts/base64bench_print.py +0 -145
- package/deps/simdutf/scripts/benchmark-all.py +0 -119
- package/deps/simdutf/scripts/benchmark_print.py +0 -324
- package/deps/simdutf/scripts/check_feature_macros.py +0 -156
- package/deps/simdutf/scripts/check_typos.sh +0 -13
- package/deps/simdutf/scripts/clang_format.sh +0 -35
- package/deps/simdutf/scripts/clang_format_docker.sh +0 -38
- package/deps/simdutf/scripts/common.py +0 -24
- package/deps/simdutf/scripts/compilation_benchmark.py +0 -55
- package/deps/simdutf/scripts/compile_many_variations.sh +0 -64
- package/deps/simdutf/scripts/create_latex_table.py +0 -62
- package/deps/simdutf/scripts/docker/Dockerfile +0 -14
- package/deps/simdutf/scripts/docker/Makefile +0 -9
- package/deps/simdutf/scripts/docker/README.md +0 -30
- package/deps/simdutf/scripts/docker/llvm.gpg +0 -0
- package/deps/simdutf/scripts/ppc64_convert_utf16_to_utf8.py +0 -155
- package/deps/simdutf/scripts/prepare_doxygen.sh +0 -21
- package/deps/simdutf/scripts/release.py +0 -197
- package/deps/simdutf/scripts/shortinputplots.py +0 -97
- package/deps/simdutf/scripts/sse_convert_utf16_to_utf8.py +0 -422
- package/deps/simdutf/scripts/sse_convert_utf32_to_utf16.py +0 -105
- package/deps/simdutf/scripts/sse_utf8_utf16_decode.py +0 -186
- package/deps/simdutf/scripts/sse_validate_utf16le_proof.py +0 -137
- package/deps/simdutf/scripts/sse_validate_utf16le_testcases.py +0 -129
- package/deps/simdutf/scripts/table.py +0 -207
- package/deps/simdutf/scripts/tests/new.txt +0 -33
- package/deps/simdutf/scripts/tests/old.txt +0 -33
- package/deps/simdutf/scripts/tests/results.txt +0 -272
- package/deps/simdutf/simdutf.pc.in +0 -11
- package/deps/simdutf/singleheader/.flake8 +0 -2
- package/deps/simdutf/singleheader/CMakeLists.txt +0 -64
- package/deps/simdutf/singleheader/README-dev.md +0 -81
- package/deps/simdutf/singleheader/README.md +0 -19
- package/deps/simdutf/singleheader/amalgamate.py +0 -513
- package/deps/simdutf/singleheader/amalgamation_demo.c +0 -59
- package/deps/simdutf/singleheader/amalgamation_demo.cpp +0 -54
- package/deps/simdutf/singleheader/test-features.py +0 -262
- package/deps/simdutf/src/CMakeLists.txt +0 -78
- package/deps/simdutf/tests/CMakeLists.txt +0 -483
- package/deps/simdutf/tests/atomic_base64_tests.cpp +0 -2845
- package/deps/simdutf/tests/base64_tests.cpp +0 -3617
- package/deps/simdutf/tests/basic_fuzzer.cpp +0 -805
- package/deps/simdutf/tests/bele_tests.cpp +0 -182
- package/deps/simdutf/tests/constexpr_base64_tests.cpp +0 -387
- package/deps/simdutf/tests/convert_latin1_to_utf16be_tests.cpp +0 -52
- package/deps/simdutf/tests/convert_latin1_to_utf16le_tests.cpp +0 -80
- package/deps/simdutf/tests/convert_latin1_to_utf32_tests.cpp +0 -66
- package/deps/simdutf/tests/convert_latin1_to_utf8_tests.cpp +0 -120
- package/deps/simdutf/tests/convert_utf16_to_utf8_safe_tests.cpp +0 -203
- package/deps/simdutf/tests/convert_utf16_to_utf8_with_replacement_tests.cpp +0 -276
- package/deps/simdutf/tests/convert_utf16be_to_latin1_tests.cpp +0 -109
- package/deps/simdutf/tests/convert_utf16be_to_latin1_tests_with_errors.cpp +0 -136
- package/deps/simdutf/tests/convert_utf16be_to_utf32_tests.cpp +0 -193
- package/deps/simdutf/tests/convert_utf16be_to_utf32_with_errors_tests.cpp +0 -381
- package/deps/simdutf/tests/convert_utf16be_to_utf8_tests.cpp +0 -259
- package/deps/simdutf/tests/convert_utf16be_to_utf8_with_errors_tests.cpp +0 -266
- package/deps/simdutf/tests/convert_utf16le_to_latin1_tests.cpp +0 -148
- package/deps/simdutf/tests/convert_utf16le_to_latin1_tests_with_errors.cpp +0 -176
- package/deps/simdutf/tests/convert_utf16le_to_utf32_tests.cpp +0 -213
- package/deps/simdutf/tests/convert_utf16le_to_utf32_with_errors_tests.cpp +0 -318
- package/deps/simdutf/tests/convert_utf16le_to_utf8_tests.cpp +0 -343
- package/deps/simdutf/tests/convert_utf16le_to_utf8_with_errors_tests.cpp +0 -271
- package/deps/simdutf/tests/convert_utf32_to_latin1_tests.cpp +0 -111
- package/deps/simdutf/tests/convert_utf32_to_latin1_with_errors_tests.cpp +0 -96
- package/deps/simdutf/tests/convert_utf32_to_utf16be_tests.cpp +0 -148
- package/deps/simdutf/tests/convert_utf32_to_utf16be_with_errors_tests.cpp +0 -192
- package/deps/simdutf/tests/convert_utf32_to_utf16le_tests.cpp +0 -166
- package/deps/simdutf/tests/convert_utf32_to_utf16le_with_errors_tests.cpp +0 -215
- package/deps/simdutf/tests/convert_utf32_to_utf8_tests.cpp +0 -181
- package/deps/simdutf/tests/convert_utf32_to_utf8_with_errors_tests.cpp +0 -261
- package/deps/simdutf/tests/convert_utf8_to_latin1_tests.cpp +0 -516
- package/deps/simdutf/tests/convert_utf8_to_latin1_with_errors_tests.cpp +0 -579
- package/deps/simdutf/tests/convert_utf8_to_utf16be_tests.cpp +0 -412
- package/deps/simdutf/tests/convert_utf8_to_utf16be_with_errors_tests.cpp +0 -480
- package/deps/simdutf/tests/convert_utf8_to_utf16le_tests.cpp +0 -671
- package/deps/simdutf/tests/convert_utf8_to_utf16le_with_errors_tests.cpp +0 -455
- package/deps/simdutf/tests/convert_utf8_to_utf32_tests.cpp +0 -1204
- package/deps/simdutf/tests/convert_utf8_to_utf32_with_errors_tests.cpp +0 -337
- package/deps/simdutf/tests/convert_valid_utf16be_to_latin1_tests.cpp +0 -37
- package/deps/simdutf/tests/convert_valid_utf16be_to_utf32_tests.cpp +0 -97
- package/deps/simdutf/tests/convert_valid_utf16be_to_utf8_tests.cpp +0 -126
- package/deps/simdutf/tests/convert_valid_utf16le_to_latin1_tests.cpp +0 -71
- package/deps/simdutf/tests/convert_valid_utf16le_to_utf32_tests.cpp +0 -122
- package/deps/simdutf/tests/convert_valid_utf16le_to_utf8_tests.cpp +0 -244
- package/deps/simdutf/tests/convert_valid_utf32_to_latin1_tests.cpp +0 -49
- package/deps/simdutf/tests/convert_valid_utf32_to_utf16be_tests.cpp +0 -92
- package/deps/simdutf/tests/convert_valid_utf32_to_utf16le_tests.cpp +0 -114
- package/deps/simdutf/tests/convert_valid_utf32_to_utf8_tests.cpp +0 -109
- package/deps/simdutf/tests/convert_valid_utf8_to_latin1_tests.cpp +0 -84
- package/deps/simdutf/tests/convert_valid_utf8_to_utf16be_tests.cpp +0 -124
- package/deps/simdutf/tests/convert_valid_utf8_to_utf16le_tests.cpp +0 -221
- package/deps/simdutf/tests/convert_valid_utf8_to_utf32_tests.cpp +0 -155
- package/deps/simdutf/tests/count_utf16be.cpp +0 -64
- package/deps/simdutf/tests/count_utf16le.cpp +0 -61
- package/deps/simdutf/tests/count_utf8.cpp +0 -87
- package/deps/simdutf/tests/detect_encodings_tests.cpp +0 -312
- package/deps/simdutf/tests/embed/valid_utf8.txt +0 -1
- package/deps/simdutf/tests/embed_tests.cpp +0 -22
- package/deps/simdutf/tests/find_tests.cpp +0 -77
- package/deps/simdutf/tests/fixed_string_tests.cpp +0 -153
- package/deps/simdutf/tests/helpers/CMakeLists.txt +0 -25
- package/deps/simdutf/tests/helpers/compiletime_conversions.h +0 -222
- package/deps/simdutf/tests/helpers/fixed_string.h +0 -267
- package/deps/simdutf/tests/helpers/random_int.cpp +0 -30
- package/deps/simdutf/tests/helpers/random_int.h +0 -39
- package/deps/simdutf/tests/helpers/random_utf16.cpp +0 -123
- package/deps/simdutf/tests/helpers/random_utf16.h +0 -52
- package/deps/simdutf/tests/helpers/random_utf32.cpp +0 -41
- package/deps/simdutf/tests/helpers/random_utf32.h +0 -40
- package/deps/simdutf/tests/helpers/random_utf8.cpp +0 -93
- package/deps/simdutf/tests/helpers/random_utf8.h +0 -36
- package/deps/simdutf/tests/helpers/test.cpp +0 -231
- package/deps/simdutf/tests/helpers/test.h +0 -193
- package/deps/simdutf/tests/helpers/transcode_test_base.cpp +0 -1257
- package/deps/simdutf/tests/helpers/transcode_test_base.h +0 -683
- package/deps/simdutf/tests/helpers/utf16.h +0 -27
- package/deps/simdutf/tests/installation_tests/find/CMakeLists.txt +0 -43
- package/deps/simdutf/tests/installation_tests/from_fetch/CMakeLists.txt +0 -47
- package/deps/simdutf/tests/internal_tests.cpp +0 -27
- package/deps/simdutf/tests/null_safety_tests.cpp +0 -94
- package/deps/simdutf/tests/random_fuzzer.cpp +0 -779
- package/deps/simdutf/tests/readme_tests.cpp +0 -274
- package/deps/simdutf/tests/reference/CMakeLists.txt +0 -23
- package/deps/simdutf/tests/reference/decode_utf16.h +0 -81
- package/deps/simdutf/tests/reference/decode_utf32.h +0 -47
- package/deps/simdutf/tests/reference/encode_latin1.cpp +0 -1
- package/deps/simdutf/tests/reference/encode_latin1.h +0 -32
- package/deps/simdutf/tests/reference/encode_utf16.cpp +0 -49
- package/deps/simdutf/tests/reference/encode_utf16.h +0 -20
- package/deps/simdutf/tests/reference/encode_utf32.cpp +0 -1
- package/deps/simdutf/tests/reference/encode_utf32.h +0 -36
- package/deps/simdutf/tests/reference/encode_utf8.cpp +0 -1
- package/deps/simdutf/tests/reference/encode_utf8.h +0 -40
- package/deps/simdutf/tests/reference/validate_utf16.cpp +0 -60
- package/deps/simdutf/tests/reference/validate_utf16.h +0 -14
- package/deps/simdutf/tests/reference/validate_utf16_to_latin1.cpp +0 -35
- package/deps/simdutf/tests/reference/validate_utf16_to_latin1.h +0 -13
- package/deps/simdutf/tests/reference/validate_utf32.cpp +0 -27
- package/deps/simdutf/tests/reference/validate_utf32.h +0 -12
- package/deps/simdutf/tests/reference/validate_utf32_to_latin1.cpp +0 -27
- package/deps/simdutf/tests/reference/validate_utf32_to_latin1.h +0 -12
- package/deps/simdutf/tests/reference/validate_utf8.cpp +0 -82
- package/deps/simdutf/tests/reference/validate_utf8.h +0 -11
- package/deps/simdutf/tests/reference/validate_utf8_to_latin1.cpp +0 -43
- package/deps/simdutf/tests/reference/validate_utf8_to_latin1.h +0 -12
- package/deps/simdutf/tests/select_implementation.cpp +0 -43
- package/deps/simdutf/tests/simdutf_c_tests.cpp +0 -244
- package/deps/simdutf/tests/span_tests.cpp +0 -401
- package/deps/simdutf/tests/special_tests.cpp +0 -559
- package/deps/simdutf/tests/straight_c_test.c +0 -187
- package/deps/simdutf/tests/text_encoding_tests.cpp +0 -77
- package/deps/simdutf/tests/to_well_formed_utf16_tests.cpp +0 -377
- package/deps/simdutf/tests/utf8_length_from_utf16_tests.cpp +0 -202
- package/deps/simdutf/tests/validate_ascii_basic_tests.cpp +0 -165
- package/deps/simdutf/tests/validate_ascii_with_errors_tests.cpp +0 -77
- package/deps/simdutf/tests/validate_utf16be_basic_tests.cpp +0 -175
- package/deps/simdutf/tests/validate_utf16be_with_errors_tests.cpp +0 -188
- package/deps/simdutf/tests/validate_utf16le_basic_tests.cpp +0 -268
- package/deps/simdutf/tests/validate_utf16le_with_errors_tests.cpp +0 -274
- package/deps/simdutf/tests/validate_utf32_basic_tests.cpp +0 -92
- package/deps/simdutf/tests/validate_utf32_with_errors_tests.cpp +0 -114
- package/deps/simdutf/tests/validate_utf8_basic_tests.cpp +0 -178
- package/deps/simdutf/tests/validate_utf8_brute_force_tests.cpp +0 -88
- package/deps/simdutf/tests/validate_utf8_puzzler_tests.cpp +0 -33
- package/deps/simdutf/tests/validate_utf8_with_errors_tests.cpp +0 -228
- package/deps/simdutf/tools/CMakeLists.txt +0 -85
- package/deps/simdutf/tools/fastbase64.cpp +0 -250
- package/deps/simdutf/tools/sutf.cpp +0 -556
- package/deps/simdutf/tools/sutf.h +0 -40
- package/lib/tsconfig.tsbuildinfo +0 -1
|
@@ -1,856 +0,0 @@
|
|
|
1
|
-
#include <ncrypto.h>
|
|
2
|
-
#include <ncrypto/aead.h>
|
|
3
|
-
|
|
4
|
-
#include <gtest/gtest.h>
|
|
5
|
-
#include <string>
|
|
6
|
-
|
|
7
|
-
using namespace ncrypto;
|
|
8
|
-
|
|
9
|
-
// Convenience class for creating buffers in tests
|
|
10
|
-
struct TestBuf : public std::string {
|
|
11
|
-
TestBuf(const std::string& constStr)
|
|
12
|
-
: std::string(constStr),
|
|
13
|
-
buf{reinterpret_cast<unsigned char*>(data()), size()} {}
|
|
14
|
-
TestBuf(size_t n) : TestBuf(std::string(n, 0)) {}
|
|
15
|
-
|
|
16
|
-
operator Buffer<unsigned char>&() { return buf; }
|
|
17
|
-
|
|
18
|
-
Buffer<const unsigned char> asConst() const {
|
|
19
|
-
return Buffer<const unsigned char>{
|
|
20
|
-
.data = reinterpret_cast<const unsigned char*>(data()), .len = size()};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
private:
|
|
24
|
-
Buffer<unsigned char> buf;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
#include <string>
|
|
28
|
-
#include <unordered_set>
|
|
29
|
-
|
|
30
|
-
using namespace ncrypto;
|
|
31
|
-
|
|
32
|
-
TEST(basic, cipher_foreach) {
|
|
33
|
-
std::unordered_set<std::string> foundCiphers;
|
|
34
|
-
|
|
35
|
-
Cipher::ForEach([&](const char* name) { foundCiphers.insert(name); });
|
|
36
|
-
|
|
37
|
-
// When testing Cipher::ForEach, we cannot expect a particular list of ciphers
|
|
38
|
-
// as that depends on openssl vs boringssl, versions, configuration, etc.
|
|
39
|
-
// Instead, we look for a couple of very common ciphers that should always be
|
|
40
|
-
// present.
|
|
41
|
-
ASSERT_TRUE(foundCiphers.count("aes-128-ctr") ||
|
|
42
|
-
foundCiphers.count("AES-128-CTR"));
|
|
43
|
-
ASSERT_TRUE(foundCiphers.count("aes-256-cbc") ||
|
|
44
|
-
foundCiphers.count("AES-256-CBC"));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
TEST(BignumPointer, bitLength) {
|
|
48
|
-
// Test empty/null BignumPointer
|
|
49
|
-
BignumPointer empty;
|
|
50
|
-
ASSERT_EQ(empty.bitLength(), 0);
|
|
51
|
-
|
|
52
|
-
// Test zero value
|
|
53
|
-
auto zero = BignumPointer::New();
|
|
54
|
-
ASSERT_TRUE(zero);
|
|
55
|
-
ASSERT_TRUE(zero.setWord(0));
|
|
56
|
-
ASSERT_EQ(zero.bitLength(), 0);
|
|
57
|
-
|
|
58
|
-
// Test value 1 (1 bit)
|
|
59
|
-
auto one = BignumPointer::New();
|
|
60
|
-
ASSERT_TRUE(one);
|
|
61
|
-
ASSERT_TRUE(one.setWord(1));
|
|
62
|
-
ASSERT_EQ(one.bitLength(), 1);
|
|
63
|
-
|
|
64
|
-
// Test value 2 (2 bits: 10 in binary)
|
|
65
|
-
auto two = BignumPointer::New();
|
|
66
|
-
ASSERT_TRUE(two);
|
|
67
|
-
ASSERT_TRUE(two.setWord(2));
|
|
68
|
-
ASSERT_EQ(two.bitLength(), 2);
|
|
69
|
-
|
|
70
|
-
// Test value 255 (8 bits: 11111111 in binary)
|
|
71
|
-
auto byte = BignumPointer::New();
|
|
72
|
-
ASSERT_TRUE(byte);
|
|
73
|
-
ASSERT_TRUE(byte.setWord(255));
|
|
74
|
-
ASSERT_EQ(byte.bitLength(), 8);
|
|
75
|
-
|
|
76
|
-
// Test value 256 (9 bits: 100000000 in binary)
|
|
77
|
-
auto nineBits = BignumPointer::New();
|
|
78
|
-
ASSERT_TRUE(nineBits);
|
|
79
|
-
ASSERT_TRUE(nineBits.setWord(256));
|
|
80
|
-
ASSERT_EQ(nineBits.bitLength(), 9);
|
|
81
|
-
|
|
82
|
-
// Test larger value (0xFFFFFFFF = 32 bits)
|
|
83
|
-
auto thirtyTwoBits = BignumPointer::New();
|
|
84
|
-
ASSERT_TRUE(thirtyTwoBits);
|
|
85
|
-
ASSERT_TRUE(thirtyTwoBits.setWord(0xFFFFFFFF));
|
|
86
|
-
ASSERT_EQ(thirtyTwoBits.bitLength(), 32);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
TEST(BignumPointer, byteLength) {
|
|
90
|
-
// Test empty/null BignumPointer
|
|
91
|
-
BignumPointer empty;
|
|
92
|
-
ASSERT_EQ(empty.byteLength(), 0);
|
|
93
|
-
|
|
94
|
-
// Test zero value
|
|
95
|
-
auto zero = BignumPointer::New();
|
|
96
|
-
ASSERT_TRUE(zero);
|
|
97
|
-
ASSERT_TRUE(zero.setWord(0));
|
|
98
|
-
ASSERT_EQ(zero.byteLength(), 0);
|
|
99
|
-
|
|
100
|
-
// Test value 1 (1 byte)
|
|
101
|
-
auto one = BignumPointer::New();
|
|
102
|
-
ASSERT_TRUE(one);
|
|
103
|
-
ASSERT_TRUE(one.setWord(1));
|
|
104
|
-
ASSERT_EQ(one.byteLength(), 1);
|
|
105
|
-
|
|
106
|
-
// Test value 255 (1 byte)
|
|
107
|
-
auto byte = BignumPointer::New();
|
|
108
|
-
ASSERT_TRUE(byte);
|
|
109
|
-
ASSERT_TRUE(byte.setWord(255));
|
|
110
|
-
ASSERT_EQ(byte.byteLength(), 1);
|
|
111
|
-
|
|
112
|
-
// Test value 256 (2 bytes)
|
|
113
|
-
auto twoBytes = BignumPointer::New();
|
|
114
|
-
ASSERT_TRUE(twoBytes);
|
|
115
|
-
ASSERT_TRUE(twoBytes.setWord(256));
|
|
116
|
-
ASSERT_EQ(twoBytes.byteLength(), 2);
|
|
117
|
-
|
|
118
|
-
// Test larger value (0xFFFFFFFF = 4 bytes)
|
|
119
|
-
auto fourBytes = BignumPointer::New();
|
|
120
|
-
ASSERT_TRUE(fourBytes);
|
|
121
|
-
ASSERT_TRUE(fourBytes.setWord(0xFFFFFFFF));
|
|
122
|
-
ASSERT_EQ(fourBytes.byteLength(), 4);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// ============================================================================
|
|
126
|
-
// Ec class tests
|
|
127
|
-
|
|
128
|
-
// Helper to create an EC key for testing
|
|
129
|
-
static ECKeyPointer createTestEcKey() {
|
|
130
|
-
// NID_X9_62_prime256v1 is P-256
|
|
131
|
-
auto key = ECKeyPointer::NewByCurveName(NID_X9_62_prime256v1);
|
|
132
|
-
if (key && EC_KEY_generate_key(key.get())) {
|
|
133
|
-
return key;
|
|
134
|
-
}
|
|
135
|
-
return {};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
TEST(Ec, getDegree) {
|
|
139
|
-
auto ecKey = createTestEcKey();
|
|
140
|
-
ASSERT_TRUE(ecKey);
|
|
141
|
-
|
|
142
|
-
Ec ec(ecKey.get());
|
|
143
|
-
ASSERT_TRUE(ec);
|
|
144
|
-
|
|
145
|
-
// P-256 has degree 256
|
|
146
|
-
ASSERT_EQ(ec.getDegree(), 256u);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
TEST(Ec, getCurveName) {
|
|
150
|
-
auto ecKey = createTestEcKey();
|
|
151
|
-
ASSERT_TRUE(ecKey);
|
|
152
|
-
|
|
153
|
-
Ec ec(ecKey.get());
|
|
154
|
-
ASSERT_TRUE(ec);
|
|
155
|
-
|
|
156
|
-
// P-256 is also known as prime256v1
|
|
157
|
-
std::string name = ec.getCurveName();
|
|
158
|
-
ASSERT_TRUE(name == "prime256v1" || name == "P-256");
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
TEST(Ec, getPublicKey) {
|
|
162
|
-
auto ecKey = createTestEcKey();
|
|
163
|
-
ASSERT_TRUE(ecKey);
|
|
164
|
-
|
|
165
|
-
Ec ec(ecKey.get());
|
|
166
|
-
ASSERT_TRUE(ec);
|
|
167
|
-
|
|
168
|
-
// Public key should exist
|
|
169
|
-
const EC_POINT* pubKey = ec.getPublicKey();
|
|
170
|
-
ASSERT_NE(pubKey, nullptr);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
TEST(Ec, getPrivateKey) {
|
|
174
|
-
auto ecKey = createTestEcKey();
|
|
175
|
-
ASSERT_TRUE(ecKey);
|
|
176
|
-
|
|
177
|
-
Ec ec(ecKey.get());
|
|
178
|
-
ASSERT_TRUE(ec);
|
|
179
|
-
|
|
180
|
-
// Private key should exist for a generated key
|
|
181
|
-
const BIGNUM* privKey = ec.getPrivateKey();
|
|
182
|
-
ASSERT_NE(privKey, nullptr);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
TEST(Ec, getXYCoordinates) {
|
|
186
|
-
auto ecKey = createTestEcKey();
|
|
187
|
-
ASSERT_TRUE(ecKey);
|
|
188
|
-
|
|
189
|
-
Ec ec(ecKey.get());
|
|
190
|
-
ASSERT_TRUE(ec);
|
|
191
|
-
|
|
192
|
-
// X and Y coordinates should be populated
|
|
193
|
-
const BignumPointer& x = ec.getX();
|
|
194
|
-
const BignumPointer& y = ec.getY();
|
|
195
|
-
|
|
196
|
-
ASSERT_TRUE(x);
|
|
197
|
-
ASSERT_TRUE(y);
|
|
198
|
-
|
|
199
|
-
// For P-256, coordinates should be 256 bits (32 bytes)
|
|
200
|
-
ASSERT_GT(x.byteLength(), 0u);
|
|
201
|
-
ASSERT_LE(x.byteLength(), 32u);
|
|
202
|
-
ASSERT_GT(y.byteLength(), 0u);
|
|
203
|
-
ASSERT_LE(y.byteLength(), 32u);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
TEST(Ec, getCurve) {
|
|
207
|
-
auto ecKey = createTestEcKey();
|
|
208
|
-
ASSERT_TRUE(ecKey);
|
|
209
|
-
|
|
210
|
-
Ec ec(ecKey.get());
|
|
211
|
-
ASSERT_TRUE(ec);
|
|
212
|
-
|
|
213
|
-
// getCurve should return the NID for P-256
|
|
214
|
-
int curve = ec.getCurve();
|
|
215
|
-
ASSERT_EQ(curve, NID_X9_62_prime256v1);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
TEST(Ec, GetCurves) {
|
|
219
|
-
std::vector<std::string> curves;
|
|
220
|
-
|
|
221
|
-
bool result = Ec::GetCurves([&](const char* name) {
|
|
222
|
-
curves.push_back(name);
|
|
223
|
-
return true;
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
ASSERT_TRUE(result);
|
|
227
|
-
// Should have at least some built-in curves
|
|
228
|
-
ASSERT_GT(curves.size(), 0u);
|
|
229
|
-
|
|
230
|
-
// Check that common curves are present
|
|
231
|
-
bool hasP256 = false;
|
|
232
|
-
bool hasP384 = false;
|
|
233
|
-
for (const auto& curve : curves) {
|
|
234
|
-
if (curve == "prime256v1" || curve == "P-256") hasP256 = true;
|
|
235
|
-
if (curve == "secp384r1" || curve == "P-384") hasP384 = true;
|
|
236
|
-
}
|
|
237
|
-
ASSERT_TRUE(hasP256);
|
|
238
|
-
ASSERT_TRUE(hasP384);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
TEST(Ec, GetCurves_early_exit) {
|
|
242
|
-
int count = 0;
|
|
243
|
-
|
|
244
|
-
// Test that returning false stops iteration
|
|
245
|
-
bool result = Ec::GetCurves([&](const char* name) {
|
|
246
|
-
count++;
|
|
247
|
-
return count < 3; // Stop after 2 curves
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
ASSERT_FALSE(result);
|
|
251
|
-
ASSERT_EQ(count, 3);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// ============================================================================
|
|
255
|
-
// EVPKeyPointer tests
|
|
256
|
-
|
|
257
|
-
TEST(EVPKeyPointer, operatorEc) {
|
|
258
|
-
auto ecKey = createTestEcKey();
|
|
259
|
-
ASSERT_TRUE(ecKey);
|
|
260
|
-
|
|
261
|
-
// Create EVPKeyPointer from EC_KEY
|
|
262
|
-
EVPKeyPointer key(EVP_PKEY_new());
|
|
263
|
-
ASSERT_TRUE(key);
|
|
264
|
-
ASSERT_TRUE(EVP_PKEY_set1_EC_KEY(key.get(), ecKey.get()));
|
|
265
|
-
|
|
266
|
-
// Convert to Ec
|
|
267
|
-
Ec ec = key;
|
|
268
|
-
ASSERT_TRUE(ec);
|
|
269
|
-
ASSERT_EQ(ec.getDegree(), 256u);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
TEST(EVPKeyPointer, clone) {
|
|
273
|
-
auto ecKey = createTestEcKey();
|
|
274
|
-
ASSERT_TRUE(ecKey);
|
|
275
|
-
|
|
276
|
-
// Create EVPKeyPointer from EC_KEY
|
|
277
|
-
EVPKeyPointer key(EVP_PKEY_new());
|
|
278
|
-
ASSERT_TRUE(key);
|
|
279
|
-
ASSERT_TRUE(EVP_PKEY_set1_EC_KEY(key.get(), ecKey.get()));
|
|
280
|
-
|
|
281
|
-
// Clone the key
|
|
282
|
-
auto cloned = key.clone();
|
|
283
|
-
ASSERT_TRUE(cloned);
|
|
284
|
-
|
|
285
|
-
// Both should be valid
|
|
286
|
-
ASSERT_TRUE(key);
|
|
287
|
-
ASSERT_TRUE(cloned);
|
|
288
|
-
|
|
289
|
-
// Both should have the same key type
|
|
290
|
-
ASSERT_EQ(key.id(), cloned.id());
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
TEST(EVPKeyPointer, cloneEmpty) {
|
|
294
|
-
EVPKeyPointer empty;
|
|
295
|
-
ASSERT_FALSE(empty);
|
|
296
|
-
|
|
297
|
-
// Clone of empty should be empty
|
|
298
|
-
auto cloned = empty.clone();
|
|
299
|
-
ASSERT_FALSE(cloned);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// ============================================================================
|
|
303
|
-
// KDF tests
|
|
304
|
-
|
|
305
|
-
TEST(KDF, pbkdf2Into) {
|
|
306
|
-
const char* password = "password";
|
|
307
|
-
const unsigned char salt[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
|
|
308
|
-
const size_t length = 32;
|
|
309
|
-
|
|
310
|
-
Buffer<const char> passBuf{password, strlen(password)};
|
|
311
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
312
|
-
|
|
313
|
-
unsigned char output[32];
|
|
314
|
-
Buffer<unsigned char> outBuf{output, length};
|
|
315
|
-
|
|
316
|
-
Digest md(EVP_sha256());
|
|
317
|
-
ASSERT_TRUE(md);
|
|
318
|
-
|
|
319
|
-
bool result = pbkdf2Into(md, passBuf, saltBuf, 1000, length, &outBuf);
|
|
320
|
-
ASSERT_TRUE(result);
|
|
321
|
-
|
|
322
|
-
// Verify output is not all zeros
|
|
323
|
-
bool allZeros = true;
|
|
324
|
-
for (size_t i = 0; i < length; i++) {
|
|
325
|
-
if (output[i] != 0) {
|
|
326
|
-
allZeros = false;
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
ASSERT_FALSE(allZeros);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
TEST(KDF, pbkdf2) {
|
|
334
|
-
const char* password = "password";
|
|
335
|
-
const unsigned char salt[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
|
|
336
|
-
const size_t length = 32;
|
|
337
|
-
|
|
338
|
-
Buffer<const char> passBuf{password, strlen(password)};
|
|
339
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
340
|
-
|
|
341
|
-
Digest md(EVP_sha256());
|
|
342
|
-
ASSERT_TRUE(md);
|
|
343
|
-
|
|
344
|
-
auto result = pbkdf2(md, passBuf, saltBuf, 1000, length);
|
|
345
|
-
ASSERT_TRUE(result);
|
|
346
|
-
ASSERT_EQ(result.size(), length);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
TEST(KDF, scryptInto) {
|
|
350
|
-
const char* password = "password";
|
|
351
|
-
const unsigned char salt[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
|
|
352
|
-
const size_t length = 32;
|
|
353
|
-
|
|
354
|
-
Buffer<const char> passBuf{password, strlen(password)};
|
|
355
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
356
|
-
|
|
357
|
-
unsigned char output[32];
|
|
358
|
-
Buffer<unsigned char> outBuf{output, length};
|
|
359
|
-
|
|
360
|
-
// Use small parameters for testing
|
|
361
|
-
bool result = scryptInto(passBuf, saltBuf, 16, 1, 1, 0, length, &outBuf);
|
|
362
|
-
ASSERT_TRUE(result);
|
|
363
|
-
|
|
364
|
-
// Verify output is not all zeros
|
|
365
|
-
bool allZeros = true;
|
|
366
|
-
for (size_t i = 0; i < length; i++) {
|
|
367
|
-
if (output[i] != 0) {
|
|
368
|
-
allZeros = false;
|
|
369
|
-
break;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
ASSERT_FALSE(allZeros);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
TEST(KDF, scrypt) {
|
|
376
|
-
const char* password = "password";
|
|
377
|
-
const unsigned char salt[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
|
|
378
|
-
const size_t length = 32;
|
|
379
|
-
|
|
380
|
-
Buffer<const char> passBuf{password, strlen(password)};
|
|
381
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
382
|
-
|
|
383
|
-
// Use small parameters for testing
|
|
384
|
-
auto result = scrypt(passBuf, saltBuf, 16, 1, 1, 0, length);
|
|
385
|
-
ASSERT_TRUE(result);
|
|
386
|
-
ASSERT_EQ(result.size(), length);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
TEST(KDF, hkdfInfo) {
|
|
390
|
-
const unsigned char key[] = {0x0b,
|
|
391
|
-
0x0b,
|
|
392
|
-
0x0b,
|
|
393
|
-
0x0b,
|
|
394
|
-
0x0b,
|
|
395
|
-
0x0b,
|
|
396
|
-
0x0b,
|
|
397
|
-
0x0b,
|
|
398
|
-
0x0b,
|
|
399
|
-
0x0b,
|
|
400
|
-
0x0b,
|
|
401
|
-
0x0b,
|
|
402
|
-
0x0b,
|
|
403
|
-
0x0b,
|
|
404
|
-
0x0b,
|
|
405
|
-
0x0b};
|
|
406
|
-
const unsigned char salt[] = {
|
|
407
|
-
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09};
|
|
408
|
-
const unsigned char info[] = {0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7};
|
|
409
|
-
const size_t length = 42;
|
|
410
|
-
|
|
411
|
-
Buffer<const unsigned char> keyBuf{key, sizeof(key)};
|
|
412
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
413
|
-
Buffer<const unsigned char> infoBuf{info, sizeof(info)};
|
|
414
|
-
|
|
415
|
-
unsigned char output[42];
|
|
416
|
-
Buffer<unsigned char> outBuf{output, length};
|
|
417
|
-
|
|
418
|
-
Digest md(EVP_sha256());
|
|
419
|
-
ASSERT_TRUE(md);
|
|
420
|
-
|
|
421
|
-
bool result = hkdfInfo(md, keyBuf, infoBuf, saltBuf, length, &outBuf);
|
|
422
|
-
ASSERT_TRUE(result);
|
|
423
|
-
|
|
424
|
-
// Verify output is not all zeros
|
|
425
|
-
bool allZeros = true;
|
|
426
|
-
for (size_t i = 0; i < length; i++) {
|
|
427
|
-
if (output[i] != 0) {
|
|
428
|
-
allZeros = false;
|
|
429
|
-
break;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
ASSERT_FALSE(allZeros);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
TEST(KDF, hkdf) {
|
|
436
|
-
const unsigned char key[] = {0x0b,
|
|
437
|
-
0x0b,
|
|
438
|
-
0x0b,
|
|
439
|
-
0x0b,
|
|
440
|
-
0x0b,
|
|
441
|
-
0x0b,
|
|
442
|
-
0x0b,
|
|
443
|
-
0x0b,
|
|
444
|
-
0x0b,
|
|
445
|
-
0x0b,
|
|
446
|
-
0x0b,
|
|
447
|
-
0x0b,
|
|
448
|
-
0x0b,
|
|
449
|
-
0x0b,
|
|
450
|
-
0x0b,
|
|
451
|
-
0x0b};
|
|
452
|
-
const unsigned char salt[] = {
|
|
453
|
-
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09};
|
|
454
|
-
const unsigned char info[] = {0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7};
|
|
455
|
-
const size_t length = 42;
|
|
456
|
-
|
|
457
|
-
Buffer<const unsigned char> keyBuf{key, sizeof(key)};
|
|
458
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
459
|
-
Buffer<const unsigned char> infoBuf{info, sizeof(info)};
|
|
460
|
-
|
|
461
|
-
Digest md(EVP_sha256());
|
|
462
|
-
ASSERT_TRUE(md);
|
|
463
|
-
|
|
464
|
-
auto result = hkdf(md, keyBuf, infoBuf, saltBuf, length);
|
|
465
|
-
ASSERT_TRUE(result);
|
|
466
|
-
ASSERT_EQ(result.size(), length);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
// ============================================================================
|
|
470
|
-
// SPKAC tests
|
|
471
|
-
|
|
472
|
-
TEST(SPKAC, VerifySpkacBuffer) {
|
|
473
|
-
// A valid SPKAC string (base64 encoded)
|
|
474
|
-
// This is a test SPKAC - in real use, you'd have a properly generated one
|
|
475
|
-
const char* spkac =
|
|
476
|
-
"MIIBQDCBqjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2L3lR6VHBxKBZGnr"
|
|
477
|
-
"5R9AmJwcQPePMHl7X1tj0n5PKMXwXHLqD/xHtqWFN9aSWfZhCYVOYMPLsIEZvtsJ"
|
|
478
|
-
"qFCJzJXB7lYlLqcLLVJ5sDlT0fM8QiJR6CnBlWgaXEozL5XdKJdQ7UVlL1qqoLJP"
|
|
479
|
-
"8wLJ0PhXFaNvlNBaXx1lAx0CAwEAARYAMA0GCSqGSIb3DQEBBQUAA4GBAKMzhfqX"
|
|
480
|
-
"MvWRBfL+VNVX/3rE9IahSMPl/Dz0P4UO0MtDgYFR4N0tPPqg1EMH7HJRxPJQDUlf"
|
|
481
|
-
"M9TsMI8e8KfJX0VdPmmjvNy3LcboJqmqQ8TViV2U0K0mTgg3kEWdKl25QcleVQry"
|
|
482
|
-
"CqU2ThYNnK3QEbFwuTS4MHk4MHk2WHJoYzlk";
|
|
483
|
-
|
|
484
|
-
Buffer<const char> buf{spkac, strlen(spkac)};
|
|
485
|
-
|
|
486
|
-
// Note: This specific SPKAC may not verify correctly due to signature issues,
|
|
487
|
-
// but we're testing that the function runs without crashing and accepts the
|
|
488
|
-
// buffer interface
|
|
489
|
-
bool result = VerifySpkac(buf);
|
|
490
|
-
// The result depends on the validity of the SPKAC
|
|
491
|
-
(void)result;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
TEST(SPKAC, ExportPublicKeyBuffer) {
|
|
495
|
-
const char* spkac =
|
|
496
|
-
"MIIBQDCBqjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2L3lR6VHBxKBZGnr"
|
|
497
|
-
"5R9AmJwcQPePMHl7X1tj0n5PKMXwXHLqD/xHtqWFN9aSWfZhCYVOYMPLsIEZvtsJ"
|
|
498
|
-
"qFCJzJXB7lYlLqcLLVJ5sDlT0fM8QiJR6CnBlWgaXEozL5XdKJdQ7UVlL1qqoLJP"
|
|
499
|
-
"8wLJ0PhXFaNvlNBaXx1lAx0CAwEAARYAMA0GCSqGSIb3DQEBBQUAA4GBAKMzhfqX"
|
|
500
|
-
"MvWRBfL+VNVX/3rE9IahSMPl/Dz0P4UO0MtDgYFR4N0tPPqg1EMH7HJRxPJQDUlf"
|
|
501
|
-
"M9TsMI8e8KfJX0VdPmmjvNy3LcboJqmqQ8TViV2U0K0mTgg3kEWdKl25QcleVQry"
|
|
502
|
-
"CqU2ThYNnK3QEbFwuTS4MHk4MHk2WHJoYzlk";
|
|
503
|
-
|
|
504
|
-
Buffer<const char> buf{spkac, strlen(spkac)};
|
|
505
|
-
|
|
506
|
-
// Test that the buffer version works
|
|
507
|
-
auto bio = ExportPublicKey(buf);
|
|
508
|
-
// Result depends on SPKAC validity
|
|
509
|
-
(void)bio;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
TEST(SPKAC, ExportChallengeBuffer) {
|
|
513
|
-
const char* spkac =
|
|
514
|
-
"MIIBQDCBqjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2L3lR6VHBxKBZGnr"
|
|
515
|
-
"5R9AmJwcQPePMHl7X1tj0n5PKMXwXHLqD/xHtqWFN9aSWfZhCYVOYMPLsIEZvtsJ"
|
|
516
|
-
"qFCJzJXB7lYlLqcLLVJ5sDlT0fM8QiJR6CnBlWgaXEozL5XdKJdQ7UVlL1qqoLJP"
|
|
517
|
-
"8wLJ0PhXFaNvlNBaXx1lAx0CAwEAARYAMA0GCSqGSIb3DQEBBQUAA4GBAKMzhfqX"
|
|
518
|
-
"MvWRBfL+VNVX/3rE9IahSMPl/Dz0P4UO0MtDgYFR4N0tPPqg1EMH7HJRxPJQDUlf"
|
|
519
|
-
"M9TsMI8e8KfJX0VdPmmjvNy3LcboJqmqQ8TViV2U0K0mTgg3kEWdKl25QcleVQry"
|
|
520
|
-
"CqU2ThYNnK3QEbFwuTS4MHk4MHk2WHJoYzlk";
|
|
521
|
-
|
|
522
|
-
Buffer<const char> buf{spkac, strlen(spkac)};
|
|
523
|
-
|
|
524
|
-
// Test that the buffer version works and returns DataPointer
|
|
525
|
-
auto challenge = ExportChallenge(buf);
|
|
526
|
-
// Result depends on SPKAC validity
|
|
527
|
-
(void)challenge;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
#ifdef OPENSSL_IS_BORINGSSL
|
|
531
|
-
TEST(basic, chacha20_poly1305) {
|
|
532
|
-
unsigned char key[] = {0xde, 0xad, 0xbe, 0xef, 0x00, 0x01, 0x02, 0x03,
|
|
533
|
-
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
|
534
|
-
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
|
|
535
|
-
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7};
|
|
536
|
-
|
|
537
|
-
auto aead = Aead::CHACHA20_POLY1305;
|
|
538
|
-
auto encryptCtx = AeadCtxPointer::New(aead, true, key, aead.getKeyLength());
|
|
539
|
-
|
|
540
|
-
TestBuf input("Hello world");
|
|
541
|
-
TestBuf tag(aead.getMaxTagLength());
|
|
542
|
-
TestBuf nonce(aead.getNonceLength());
|
|
543
|
-
TestBuf aad("I dunno man");
|
|
544
|
-
TestBuf encryptOutput(input.size());
|
|
545
|
-
|
|
546
|
-
auto encryptOk = encryptCtx.encrypt(
|
|
547
|
-
input.asConst(), encryptOutput, tag, nonce.asConst(), aad.asConst());
|
|
548
|
-
ASSERT_TRUE(encryptOk);
|
|
549
|
-
ASSERT_NE(input, encryptOutput);
|
|
550
|
-
|
|
551
|
-
auto decryptCtx = AeadCtxPointer::New(aead, false, key, aead.getKeyLength());
|
|
552
|
-
|
|
553
|
-
TestBuf decryptOutput(encryptOutput.size());
|
|
554
|
-
|
|
555
|
-
auto decryptOk = decryptCtx.decrypt(encryptOutput.asConst(),
|
|
556
|
-
decryptOutput,
|
|
557
|
-
tag.asConst(),
|
|
558
|
-
nonce.asConst(),
|
|
559
|
-
aad.asConst());
|
|
560
|
-
ASSERT_TRUE(decryptOk);
|
|
561
|
-
ASSERT_EQ(input, decryptOutput);
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
TEST(basic, aead_info) {
|
|
565
|
-
auto aead = Aead::FromName("aEs-256-gcM"); // spongebob does encryption
|
|
566
|
-
ASSERT_EQ(aead.getName(), "aes-256-gcm");
|
|
567
|
-
ASSERT_EQ(aead.getModeLabel(), "gcm");
|
|
568
|
-
ASSERT_EQ(aead.getBlockSize(), 1);
|
|
569
|
-
ASSERT_EQ(aead.getNonceLength(), 12);
|
|
570
|
-
ASSERT_EQ(aead.getMaxTagLength(), 16);
|
|
571
|
-
}
|
|
572
|
-
#endif
|
|
573
|
-
|
|
574
|
-
// ============================================================================
|
|
575
|
-
// Argon2 KDF tests (OpenSSL 3.2.0+ only)
|
|
576
|
-
|
|
577
|
-
#if OPENSSL_VERSION_NUMBER >= 0x30200000L
|
|
578
|
-
#ifndef OPENSSL_NO_ARGON2
|
|
579
|
-
|
|
580
|
-
TEST(KDF, argon2i) {
|
|
581
|
-
const char* password = "password";
|
|
582
|
-
const unsigned char salt[] = {0x01,
|
|
583
|
-
0x02,
|
|
584
|
-
0x03,
|
|
585
|
-
0x04,
|
|
586
|
-
0x05,
|
|
587
|
-
0x06,
|
|
588
|
-
0x07,
|
|
589
|
-
0x08,
|
|
590
|
-
0x09,
|
|
591
|
-
0x0a,
|
|
592
|
-
0x0b,
|
|
593
|
-
0x0c,
|
|
594
|
-
0x0d,
|
|
595
|
-
0x0e,
|
|
596
|
-
0x0f,
|
|
597
|
-
0x10};
|
|
598
|
-
const size_t length = 32;
|
|
599
|
-
|
|
600
|
-
Buffer<const char> passBuf{password, strlen(password)};
|
|
601
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
602
|
-
Buffer<const unsigned char> secret{nullptr, 0};
|
|
603
|
-
Buffer<const unsigned char> ad{nullptr, 0};
|
|
604
|
-
|
|
605
|
-
// Use small parameters for testing
|
|
606
|
-
// lanes=1, memcost=16 (KB), iter=3, version=0x13 (1.3)
|
|
607
|
-
auto result = argon2(passBuf,
|
|
608
|
-
saltBuf,
|
|
609
|
-
1,
|
|
610
|
-
length,
|
|
611
|
-
16,
|
|
612
|
-
3,
|
|
613
|
-
0x13,
|
|
614
|
-
secret,
|
|
615
|
-
ad,
|
|
616
|
-
Argon2Type::ARGON2I);
|
|
617
|
-
ASSERT_TRUE(result);
|
|
618
|
-
ASSERT_EQ(result.size(), length);
|
|
619
|
-
|
|
620
|
-
// Verify output is not all zeros
|
|
621
|
-
bool allZeros = true;
|
|
622
|
-
for (size_t i = 0; i < length; i++) {
|
|
623
|
-
if (reinterpret_cast<unsigned char*>(result.get())[i] != 0) {
|
|
624
|
-
allZeros = false;
|
|
625
|
-
break;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
ASSERT_FALSE(allZeros);
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
TEST(KDF, argon2d) {
|
|
632
|
-
const char* password = "password";
|
|
633
|
-
const unsigned char salt[] = {0x01,
|
|
634
|
-
0x02,
|
|
635
|
-
0x03,
|
|
636
|
-
0x04,
|
|
637
|
-
0x05,
|
|
638
|
-
0x06,
|
|
639
|
-
0x07,
|
|
640
|
-
0x08,
|
|
641
|
-
0x09,
|
|
642
|
-
0x0a,
|
|
643
|
-
0x0b,
|
|
644
|
-
0x0c,
|
|
645
|
-
0x0d,
|
|
646
|
-
0x0e,
|
|
647
|
-
0x0f,
|
|
648
|
-
0x10};
|
|
649
|
-
const size_t length = 32;
|
|
650
|
-
|
|
651
|
-
Buffer<const char> passBuf{password, strlen(password)};
|
|
652
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
653
|
-
Buffer<const unsigned char> secret{nullptr, 0};
|
|
654
|
-
Buffer<const unsigned char> ad{nullptr, 0};
|
|
655
|
-
|
|
656
|
-
auto result = argon2(passBuf,
|
|
657
|
-
saltBuf,
|
|
658
|
-
1,
|
|
659
|
-
length,
|
|
660
|
-
16,
|
|
661
|
-
3,
|
|
662
|
-
0x13,
|
|
663
|
-
secret,
|
|
664
|
-
ad,
|
|
665
|
-
Argon2Type::ARGON2D);
|
|
666
|
-
ASSERT_TRUE(result);
|
|
667
|
-
ASSERT_EQ(result.size(), length);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
TEST(KDF, argon2id) {
|
|
671
|
-
const char* password = "password";
|
|
672
|
-
const unsigned char salt[] = {0x01,
|
|
673
|
-
0x02,
|
|
674
|
-
0x03,
|
|
675
|
-
0x04,
|
|
676
|
-
0x05,
|
|
677
|
-
0x06,
|
|
678
|
-
0x07,
|
|
679
|
-
0x08,
|
|
680
|
-
0x09,
|
|
681
|
-
0x0a,
|
|
682
|
-
0x0b,
|
|
683
|
-
0x0c,
|
|
684
|
-
0x0d,
|
|
685
|
-
0x0e,
|
|
686
|
-
0x0f,
|
|
687
|
-
0x10};
|
|
688
|
-
const size_t length = 32;
|
|
689
|
-
|
|
690
|
-
Buffer<const char> passBuf{password, strlen(password)};
|
|
691
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
692
|
-
Buffer<const unsigned char> secret{nullptr, 0};
|
|
693
|
-
Buffer<const unsigned char> ad{nullptr, 0};
|
|
694
|
-
|
|
695
|
-
auto result = argon2(passBuf,
|
|
696
|
-
saltBuf,
|
|
697
|
-
1,
|
|
698
|
-
length,
|
|
699
|
-
16,
|
|
700
|
-
3,
|
|
701
|
-
0x13,
|
|
702
|
-
secret,
|
|
703
|
-
ad,
|
|
704
|
-
Argon2Type::ARGON2ID);
|
|
705
|
-
ASSERT_TRUE(result);
|
|
706
|
-
ASSERT_EQ(result.size(), length);
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
TEST(KDF, argon2_with_secret_and_ad) {
|
|
710
|
-
const char* password = "password";
|
|
711
|
-
const unsigned char salt[] = {0x01,
|
|
712
|
-
0x02,
|
|
713
|
-
0x03,
|
|
714
|
-
0x04,
|
|
715
|
-
0x05,
|
|
716
|
-
0x06,
|
|
717
|
-
0x07,
|
|
718
|
-
0x08,
|
|
719
|
-
0x09,
|
|
720
|
-
0x0a,
|
|
721
|
-
0x0b,
|
|
722
|
-
0x0c,
|
|
723
|
-
0x0d,
|
|
724
|
-
0x0e,
|
|
725
|
-
0x0f,
|
|
726
|
-
0x10};
|
|
727
|
-
const unsigned char secretData[] = {0xaa, 0xbb, 0xcc, 0xdd};
|
|
728
|
-
const unsigned char adData[] = {0x11, 0x22, 0x33, 0x44, 0x55};
|
|
729
|
-
const size_t length = 32;
|
|
730
|
-
|
|
731
|
-
Buffer<const char> passBuf{password, strlen(password)};
|
|
732
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
733
|
-
Buffer<const unsigned char> secret{secretData, sizeof(secretData)};
|
|
734
|
-
Buffer<const unsigned char> ad{adData, sizeof(adData)};
|
|
735
|
-
|
|
736
|
-
auto result = argon2(passBuf,
|
|
737
|
-
saltBuf,
|
|
738
|
-
1,
|
|
739
|
-
length,
|
|
740
|
-
16,
|
|
741
|
-
3,
|
|
742
|
-
0x13,
|
|
743
|
-
secret,
|
|
744
|
-
ad,
|
|
745
|
-
Argon2Type::ARGON2ID);
|
|
746
|
-
ASSERT_TRUE(result);
|
|
747
|
-
ASSERT_EQ(result.size(), length);
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
TEST(KDF, argon2_empty_password) {
|
|
751
|
-
const unsigned char salt[] = {0x01,
|
|
752
|
-
0x02,
|
|
753
|
-
0x03,
|
|
754
|
-
0x04,
|
|
755
|
-
0x05,
|
|
756
|
-
0x06,
|
|
757
|
-
0x07,
|
|
758
|
-
0x08,
|
|
759
|
-
0x09,
|
|
760
|
-
0x0a,
|
|
761
|
-
0x0b,
|
|
762
|
-
0x0c,
|
|
763
|
-
0x0d,
|
|
764
|
-
0x0e,
|
|
765
|
-
0x0f,
|
|
766
|
-
0x10};
|
|
767
|
-
const size_t length = 32;
|
|
768
|
-
|
|
769
|
-
Buffer<const char> passBuf{"", 0};
|
|
770
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
771
|
-
Buffer<const unsigned char> secret{nullptr, 0};
|
|
772
|
-
Buffer<const unsigned char> ad{nullptr, 0};
|
|
773
|
-
|
|
774
|
-
// Empty password should still work
|
|
775
|
-
auto result = argon2(passBuf,
|
|
776
|
-
saltBuf,
|
|
777
|
-
1,
|
|
778
|
-
length,
|
|
779
|
-
16,
|
|
780
|
-
3,
|
|
781
|
-
0x13,
|
|
782
|
-
secret,
|
|
783
|
-
ad,
|
|
784
|
-
Argon2Type::ARGON2ID);
|
|
785
|
-
ASSERT_TRUE(result);
|
|
786
|
-
ASSERT_EQ(result.size(), length);
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
TEST(KDF, argon2_different_types_produce_different_output) {
|
|
790
|
-
const char* password = "password";
|
|
791
|
-
const unsigned char salt[] = {0x01,
|
|
792
|
-
0x02,
|
|
793
|
-
0x03,
|
|
794
|
-
0x04,
|
|
795
|
-
0x05,
|
|
796
|
-
0x06,
|
|
797
|
-
0x07,
|
|
798
|
-
0x08,
|
|
799
|
-
0x09,
|
|
800
|
-
0x0a,
|
|
801
|
-
0x0b,
|
|
802
|
-
0x0c,
|
|
803
|
-
0x0d,
|
|
804
|
-
0x0e,
|
|
805
|
-
0x0f,
|
|
806
|
-
0x10};
|
|
807
|
-
const size_t length = 32;
|
|
808
|
-
|
|
809
|
-
Buffer<const char> passBuf{password, strlen(password)};
|
|
810
|
-
Buffer<const unsigned char> saltBuf{salt, sizeof(salt)};
|
|
811
|
-
Buffer<const unsigned char> secret{nullptr, 0};
|
|
812
|
-
Buffer<const unsigned char> ad{nullptr, 0};
|
|
813
|
-
|
|
814
|
-
auto resultI = argon2(passBuf,
|
|
815
|
-
saltBuf,
|
|
816
|
-
1,
|
|
817
|
-
length,
|
|
818
|
-
16,
|
|
819
|
-
3,
|
|
820
|
-
0x13,
|
|
821
|
-
secret,
|
|
822
|
-
ad,
|
|
823
|
-
Argon2Type::ARGON2I);
|
|
824
|
-
auto resultD = argon2(passBuf,
|
|
825
|
-
saltBuf,
|
|
826
|
-
1,
|
|
827
|
-
length,
|
|
828
|
-
16,
|
|
829
|
-
3,
|
|
830
|
-
0x13,
|
|
831
|
-
secret,
|
|
832
|
-
ad,
|
|
833
|
-
Argon2Type::ARGON2D);
|
|
834
|
-
auto resultID = argon2(passBuf,
|
|
835
|
-
saltBuf,
|
|
836
|
-
1,
|
|
837
|
-
length,
|
|
838
|
-
16,
|
|
839
|
-
3,
|
|
840
|
-
0x13,
|
|
841
|
-
secret,
|
|
842
|
-
ad,
|
|
843
|
-
Argon2Type::ARGON2ID);
|
|
844
|
-
|
|
845
|
-
ASSERT_TRUE(resultI);
|
|
846
|
-
ASSERT_TRUE(resultD);
|
|
847
|
-
ASSERT_TRUE(resultID);
|
|
848
|
-
|
|
849
|
-
// All three types should produce different outputs
|
|
850
|
-
ASSERT_NE(memcmp(resultI.get(), resultD.get(), length), 0);
|
|
851
|
-
ASSERT_NE(memcmp(resultI.get(), resultID.get(), length), 0);
|
|
852
|
-
ASSERT_NE(memcmp(resultD.get(), resultID.get(), length), 0);
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
#endif // OPENSSL_NO_ARGON2
|
|
856
|
-
#endif // OPENSSL_VERSION_NUMBER >= 0x30200000L
|