$ show intel/isa-l_crypto
Intel ISA-L Crypto is a production-grade, high-performance cryptographic library optimized for storage and networking workloads. It provides software implementations of AES (CBC, GCM, XTS), multi-buffer hashing (SHA1, SHA256, SHA512, MD5, SM3), multi-hash parallel hashing, rolling hash for content-defined chunking, and FIPS 140 self-tests. The library is not an application but a low-level C library with assembly (x86 SSE/AVX/AVX512/VAES/AVX10, ARM NEON/SVE/SVE2, RISC-V RVV) to maximize throughput on modern CPUs. The codebase is organized by algorithm (aes/ sha1_mb/ mh_sha1/ rolling_hash/) with architecture-specific subdirectories. It uses a robust multi-buffer job manager pattern (init/submit/flush) for all hashing algorithms and a multibinary dispatcher to select the optimal SIMD variant at runtime. Extensive test suites (standard vectors, random, streaming, performance, fuzz) validate correctness against OpenSSL and NIST vectors. The library is actively maintained, supports multiple build systems (autotools, cmake, nmake), and includes CI for Linux, Windows, ARM64, and RISC-V. While the code is professionally engineered with high performance as the primary goal, it suffers from significant duplication across hash algorithms and ISA variants, making maintenance and extraction of individual components non-trivial. It is not a general-purpose crypto library but specifically targets scenarios requiring maximum throughput on Intel and ARM processors, making it ideal for integration into storage appliances, network appliances, and DPDK-based packet processing.
The LLM identified 6 files worth highlighting for reuse:
Provides a set of highly optimized inline memcpy and memclr functions for small constant sizes (from 1 byte to 256 bytes) using SSE/AVX intrinsics. The functions are parameterized by block size and templated to generate the optimal copy loop. This is a self-contained utility that can be extracted and reused in any performance-sensitive C/C++ project needing fast small copies or clears, without pulling in any other ISA-L dependencies.
Implements portable, compiler-optimized endianness helpers (ntoh, hton, byteswap for 16/32/64 bits) via GCC/Clang builtins and MSVC intrinsics. The macros are lightweight, header-only, and have no external dependencies. This is a clean, reusable component for any project that needs cross-platform endian handling without heavy dependencies like Boost or platform-specific code.
Defines assembly macros (`mbin_interface`, `mbin_dispatch_init`) for implementing multibinary dispatch routines. These macros generate stubs that call a dispatcher function for the first invocation (to detect CPU features and select the best SSE/AVX/AVX512 variant) then call the cached implementation on subsequent calls. The pattern is used across all cipher and hash modules in ISA-L but is defined generically, making it reusable for any SIMD-optimized library that needs runtime code selection.
Provides assembly macros (`clear_xmm`, `clear_ymm`, `clear_zmm`, `clear_gpr`) to zero out register state after cryptographic operations, preventing leakage of sensitive data. The macros support clearing both x86 general-purpose and SIMD registers and are conditionally included when `SAFE_DATA` is defined. This is a small but security-critical reusable component that can be inserted into any assembly code path to meet data sanitization requirements.
Implements a rolling hash algorithm (polynomial rolling hash with configurable window size) for content-defined chunking, used in deduplication and data partitioning. Provides an API to initialize (`isal_rolling_hash2_init`), ingest data (`isal_rolling_hash2_run`), and detect chunk boundaries based on a mask/trigger pattern. This is a standalone module with its own headers and tests; it can be extracted and reused in any system needing sliding-window fingerprinting, independent of the rest of ISA-L Crypto.
Defines common test infrastructure: `perf` structure with `perf_start/stop/print` for timing, `CHECK_RETURN_GOTO` macro for error handling, and `WARM_TEST`/`COLD_TEST` pattern macros for cache-aware benchmarking. These are self-contained and used across all ISA-L test files, but could be extracted into any project needing simple microbenchmarking utilities without external dependencies.