Граф коммитов

27 Коммитов

Автор SHA1 Сообщение Дата
Samuel Lee 977ec1e5f0 Merged PR 11273883: Implement ML-KEM
## Description:

+ Adds ML-KEM API surface
+ Implements the API with initial C implementation, with sprinkling of SSE/NEON for (I)NTT
+ Adds low level ML-KEM polynomial arithmetic testing which tests self-consistency and exercises internal assertion in debug builds
+ Adds multi-implementation functionality testing to enable comparative functionality and performance testing on E2E functionality
  + For now, comparison testing is just between SymCrypt static and dynamic, with 3rd party comparison with libcrux disabled until they publish a final ML-KEM implementation
+ Adds ML-KEM KATs from NIST

Related work items: #50913735
2024-08-31 02:53:41 +00:00
Mitch Lindgren 🦎 3b4cad7a6a Merged PR 11324214: FIPS 140-3 CASTs for RSA, DSA, ECDSA
This change adds additional Cryptographic Algorithm Self-Tests (CASTs) for RSA, DSA and ECDSA. as required by FIPS 140-3. Specifically, it adds explicit Known Answer Tests (KATs), as the Pairwise Consistency Tests (PCTs) that we were using previously are no longer considered sufficient for CASTs.

Also adds pairwise consistency tests on key import for RSA and DSA, per recent changes in the FIPS 140-3 implementation guidance. ECDSA PCTs continue to be run prior to signing or key export, as a performance optimization. ECDH and DH do not have explicit PCTs, but they include the required checks specified in SP 800-56A rev 3.

Related work items: #53481333
2024-08-30 05:26:38 +00:00
Cagdas Calik 15d0779214 Merged PR 10817310: Add XMSS and XMSS^MT implementations
## Description:

Adds support for stateful hash-based signatures XMSS and XMSS^MT per RFC 8391 and NIST SP800-208.

## Admin Checklist:
- [ ] You have updated documentation in symcrypt.h to reflect any changes in behavior
- [ ] You have updated CHANGELOG.md to reflect any changes in behavior
- [ ] You have updated symcryptunittest to exercise any new functionality
- [ ] If you have introduced any symbols in symcrypt.h you have updated production and test dynamic export symbols (exports.ver / exports.def / symcrypt.src) and tested the updated dynamic modules with symcryptunittest
- [ ] If you have introduced functionality that varies based on CPU features, you have manually tested with and without relevant features
- [ ] If you have made significant changes to a particular algorithm, you have checked that performance numbers reported by symcryptunittest are in line with expectations
- [ ] If you have added new algorithms/modes, you have updated the status indicator text for the associated modules if necessary

Related work items: #52453903
2024-08-13 18:14:13 +00:00
Maxwell Moyer-McKee f89cbf36c3 Merged PR 11087190: SSKDF implementation
## Description:
SSKDF implementation and unit tests.
 
## Admin Checklist:
- [x] You have updated documentation in symcrypt.h to reflect any changes in behavior
- [x] You have updated CHANGELOG.md to reflect any changes in behavior
- [x] You have updated symcryptunittest to exercise any new functionality
- [x] If you have introduced any symbols in symcrypt.h you have updated production and test dynamic export symbols (exports.ver / exports.def / symcrypt.src) and tested the updated dynamic modules with symcryptunittest
- [x] If you have introduced functionality that varies based on CPU features, you have manually tested with and without relevant features
- [X] If you have made significant changes to a particular algorithm, you have checked that performance numbers reported by symcryptunittest are in line with expectations
- [X] If you have added new algorithms/modes, you have updated the status indicator text for the associated modules if necessary

Related work items: #51795170
2024-08-12 22:55:13 +00:00
Samuel Lee fcea477bd6 Merged PR 11162679: Fix DATA annotations on Windows .def files
## Description:

+ Add DATA annotation to data exports in symcrypt.dll .def file, and to a few data exports missed from symcrypttestmodule.dll. This primarily fixes use of Arm64X .dlls when loaded from an emulated AMD64 process.
+ Remove outdated DH comment (today we do input validation when importing DH keys unless the caller explicitly opts out of doing those validations)

Related work items: #50915485
2024-07-26 23:17:23 +00:00
Samuel Lee c2cd679a41 Merged PR 10740690: Fixes for various build issues
+ Enable Arm64 Windows build with CMake (not production build as it is
  missing support for Arm64X)
+ Avoid naming collision in macros between test code and product code,
  enabling inclusion of sc_lib.h in test_lib.h
+ Remove sc_lib-testhooks.h
2024-05-10 06:48:11 +00:00
Mitch Lindgren 🦎 198be4c6b7 Merged PR 10493895: Add Windows user mode module
This change adds a new Windows user-mode module, symcrypt.dll. We plan to integrate this module into a future release of Windows as our primary FIPS-certified cryptographic module. Until that happens, we're making the module publicly available for the convenience of other projects that build on top of SymCrypt, such as our [rust-symcrypt crate](https://github.com/microsoft/rust-symcrypt).

Tested: dynamic unit tests run locally against the new module, ADO pipeline CI tests
2024-03-30 01:10:14 +00:00
Mitch Lindgren 🦎 d6d4461829 Merged PR 10523737: Remove Razzle + scbuild files
The time has come! Now that we've fully transitioned to building in the Windows undocked pipeline with MSBuild, there's no longer any reason to retain the old Razzle dirs/sources files or scbuild scripts.

I left the sources files in `gen` and `test/indirect_call_perf` since we don't have CMake or MSBuild files for those. Since they're used extremely rarely, there's no urgency in supporting them in the new build system.
2024-03-29 19:55:17 +00:00
Mitch Lindgren 🦎 88481f7916 Merged PR 10509720: Make msbignum and rsa32 optional for MSBuild
This change updates the MSBuild projects to make the inclusion of msbignum and rsa32 optional. This will allow external users to more easily use MSBuild, and also unblock testing potential future changes to undocked pipelines.
2024-03-27 19:51:04 +00:00
Samuel Lee 22d48621ae Merged PR 10332702: Prepare SymCrypt undocked build for undocked LKG which specifies most kernel mode flags
## Description:

+ Remove many workarounds in SymCrypt undocked props files for missing flags
+ Explicitly build SymCryptK.dll with no entrypoint, remove the fake entry point from code, and call `__security_init_cookie` in `SymCryptModuleInit` to prevent binskim errors.
+ Remove reference to memset in `SymCryptEntropyAccumulatorAccumulateSample` to reduce size and complexity of resulting SymCryptK.dll with real build environment (memset is not inlined as expected).

## Admin Checklist:
- [X] You have updated documentation in symcrypt.h to reflect any changes in behavior
- [X] You have updated CHANGELOG.md to reflect any changes in behavior
- [X] You have updated symcryptunittest to exercise any new functionality
- [X] If you have introduced any symbols in symcrypt.h you have updated production and test dynamic export symbols (exports.ver / exports.def / symcrypt.src) and tested the updated dynamic modules with symcryptunittest
- [X] If you have introduced functionality that varies based on CPU features, you have manually tested with and without relevant features
- [X] If you have made significant changes to a particular algorithm, you have checked that performance numbers reported by symcryptunittest are in line with expectations
- [X] If you have added new algorithms/modes, you have updated the status indicator text for the associated modules if necessary

Related work items: #49010014
2024-02-26 22:53:09 +00:00
Cagdas Calik fb337b0bec Merged PR 9834558: Add FIPS Status Indicator
## Description:
This PR addresses the FIPS 140-3 requirement for crypto modules to support an approved services status indicator function.
 
## Admin Checklist:
- [X] You have updated documentation in symcrypt.h to reflect any changes in behavior
- [X] You have updated CHANGELOG.md to reflect any changes in behavior
- [X] You have updated symcryptunittest to exercise any new functionality
- [X] If you have introduced any symbols in symcrypt.h you have updated production and test dynamic export symbols (exports.ver / exports.def / symcrypt.src) and tested the updated dynamic modules with symcryptunittest
- [ ] If you have introduced functionality that varies based on CPU features, you have manually tested with and without relevant features
- [ ] If you have made significant changes to a particular algorithm, you have checked that performance numbers reported by symcryptunittest are in line with expectations

Related work items: #47548894
2023-11-13 21:32:26 +00:00
Samuel Lee ffbb5939a3 Merged PR 9759115: Adding support for salt length detection in RSA-PSS verification
Adding support for salt length detection in RSA-PSS verification

+ Add SYMCRYPT_FLAG_RSA_PSS_VERIFY_WITH_MINIMUM_SALT flag to
  SymCryptRsaPssVerify and SymCryptRsaPssVerifySignaturePadding
+ When verifying a PSS signature with this flag specified, allow salt
  length >= the caller specified cbSalt
+ In symcryptunittest, test that verification succeeds and fails w.r.t. the cbSalt
 and flag in the correct way
+ Some small unrelated changes

Related work items: #33692439
2023-10-27 22:46:31 +00:00
Samuel Lee 4425e78d9d Merged PR 9685563: Extend XTS-AES for SCOSSL and SymCrypt FIPS
+ Add SymCryptXtsAes(En|De)cryptEx to induce XTS-AES with 128b tweak
+ Add SymCryptXtsAesExpandKeyEx to do FIPS IG check for non-equal
 halves of XTS key
+ Refactor Multi-DataUnit logic to reduce code duplication using
 new xtsaes_pattern.c file to instantiate the logic with various
 specializations
+ Add support for ciphertext stealing in both old and new API surface,
  allowing data unit sizes which are not a multiple of 16 bytes
+ Add IEEE test vectors for odd data unit sizes
+ Update randomized tests to exercise both 64-bit and 128-bit tweak
  interfaces, and new supported data unit sizes
+ Update XTS tests to allow CNG to fail with unsupported parameters
+ Update XTS FIPS self-test to use FIPS-approved key expansion function
+ Fix a couple of typos found while making changes

Related work items: #43854713
2023-10-19 23:17:23 +00:00
Mitch Lindgren 🦎 17360b237b Merged PR 9671493: Fix build issues with newest compiler package
This change sets the `UndockedKernelModeBuild` property for our kernel-mode components, to fix linking issues that arose from the latest compiler package.
2023-10-04 21:55:16 +00:00
Mitch Lindgren 🦎 b4f07a34bd Merged PR 9504829: Fix ARM64X build
This change fixes the ARM64 build to properly support ARM64X, which is required for linking to Windows components.

- Add `<BuildAsX>true</BuildAsX>` to MSBuild properties
- Add `-machine arm64ec` arg when assembling for ARM64EC
- Fix non-standard SEH keywords in cpuid.c (not supported by ARM64EC compiler)
- Remove ARM32 support since build tools no longer support it

Related work items: #42154581
2023-08-31 00:25:12 +00:00
Mitch Lindgren 🦎 9b760abcf3 Merged PR 9200816: Add support for Windows undocked pipeline build
This PR adds the necessary YAML pipeline files for building SymCrypt via the Windows undocked pipeline. It also includes minor changes to existing files to support the tooling used by the pipeline. Currently, the pipeline only exists for pull requests. The next step is to create an official pipeline, including the option to package the binaries and ingest them into Windows. This will come in a subsequent PR.
2023-06-28 20:38:13 +00:00
Mitch Lindgren 🦎 6fca352c3e Merged PR 8797661: Add MSBuild solution and project files for SymCrypt
This pull request adds MSBuild solution and project files so that SymCrypt can be built using the undocked OneBranch pipeline, including the kernel mode components. See the SymCrypt EO Compliance document for more information on why this is being done, and the high-level overview of how it will be accomplished.

In addition to adding the MSBuild files, I removed a bunch of files that were no longer being used, such as the iOS workspace and project files, old kernel test drivers that are not used in the RI-TP, etc.

Related work items: #42154697
2023-05-23 08:11:33 +00:00
Samuel Lee 00bd38df56 Merged PR 8952367: Export Variables with DATA keyword in SymCryptTestModule.dll
+ This is required to enable AMD64 symcryptunittest.exe running emulated
  on Arm64 to dynamically load Arm64X symcrypttestmodule.dll, as without
  the DATA keyword the variables are exported as functions with an AMD64
  to ARM64EC shim

Related work items: #44587958
2023-05-11 00:54:56 +00:00
Samuel Lee 877abe0790 Merged PR 8705505: Fix flaky initialization in Windows test modules
+ 1 in 256 times the Windows test modules set g_bAllocFill to 0
  and subsequently fail in SymCryptCallbackAlloc
2023-03-24 00:56:38 +00:00
Cagdas Calik ef2e54a42d Merged PR 8399946: Add HMAC support for SHA-3
Add HMAC-SHA3-256, HMAC-SHA3-384, HMAC-SHA3-512 implementations.

Other changes:
- Add generic HMAC API
- Introduce a unique state for each of the Keccak based algorithms
- Convert tabs to spaces in symcryptasm files

Related work items: #41559779
2023-01-26 01:04:50 +00:00
Cagdas Calik d026121894 Merged PR 8234403: Add SHA-3 based algorithms: SHAKE, cSHAKE, and KMAC
This PR adds the following algorithm implementations to SymCrypt:
- Extendable-output functions (XOFs)
  - SHAKE128
  - SHAKE256
- Customizable XOFs
  - cSHAKE128
  - cSHAKE256
- Keccak Message Authentication Code (KMAC)
  - KMAC128
  - KMAC256

Related work items: #41559779
2023-01-17 23:54:37 +00:00
Samuel Lee 0502eaf171 Merged PR 8363553: Remove outdated includes
Related work items: #38706387
2023-01-13 21:10:16 +00:00
Mitch Lindgren 🦎 515bc99971 Merged PR 8235253: Enable OneBranch pipelines
This change rewrites our Azure DevOps pipelines to be compatible with OneBranch pipelines. It also adds new scripts to help with building, testing and packaging SymCrypt. These scripts replicate some of the functionality of `scbuild` but are also compatible with Linux builds. They can be used directly on the command line by developers, but the OneBranch pipeline also uses them to move as much as possible of the "business logic" of building SymCrypt out of the YAML templates and into Python scripts.

Also includes various reorganization and small fixes.
2023-01-12 00:52:49 +00:00
Samuel Lee b8a005237c Merged PR 8152559: Introduce SymCryptKernelTestModule
+ New dynamic module SymCryptKernelTestModule_UM.dll and kernel driver
  SymCryptKernelTestModule.sys which enable unit tests to call into
  driver using the existing SymCrypt dynamic module flow
+ Update a few places in tests which assume objects created by module
  under test can have their internals inspected (which is not the case
  when the object lives in kernel and the unit tests are running in user
  mode)
+ SymCryptKernelTestModule.sys tracks all allocations it makes and ensures it
 frees everything when it is unloaded

Related work items: #38706387
2022-12-16 22:58:09 +00:00
Cagdas Calik 93a82712df Merged PR 7979179: Add SHA-3 implementations
This update adds C implementations of SHA-3-256, SHA-3-384, and SHA-3-512 hash functions per FIPS 202.

Related work items: #41559779
2022-10-25 20:39:41 +00:00
Cagdas Calik bc66c79cde Merged PR 7810991: Add SRTP-KDF and SSH-KDF implementations
- Add SRTP-KDF and SSH-KDF implementations
- Update `SYMCRYPT_HASH` structure to contain hash state copying function member

Related work items: #38101963, #38102026
2022-09-19 20:13:04 +00:00
Samuel Lee ea3b8b1958 Merged PR 7672902: Create and test against simple SymCrypt Windows test module (dll)
+ Builds in both CMake and Razzle, and test in CI pipeline

Related work items: #38706387
2022-08-16 06:55:18 +00:00