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

67 Коммитов

Автор SHA1 Сообщение Дата
Mitch Lindgren 🦎 635d6fd65e Merged PR 11444026: Deleted old, unused test code
This pull request removes outdated and unused test files to simplify the unit test codebase.
2024-09-17 02:53:14 +00:00
Samuel Lee 2b82f03465 Merged PR 11375621: Fix outstanding Prefast warnings
+ Fixing various Prefast warnings to get us clean w.r.t. Prefast
  + Enable Prefast failures to break PR builds
+ Reduce noisy build warnings
+ Unpin Windows container images as using old images

Related work items: #52514550, #52514551, #52514554, #52514555, #52514556, #52514557, #52514559, #52514560, #52514561, #52514562, #52514632, #52514633, #52514634, #53004108, #53004109, #53130817
2024-09-05 23:26:39 +00:00
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
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
Mitch Lindgren 🦎 9531d00a19 Merged PR 10935012: Add support for multi-line KATs, reformat existing KATs
Since the KATs for some of the PQC algorithms have very long data values, it's convenient to be able to split the data across multiple lines to avoid having excessively long lines. This change adds support for that in the KAT parser (via escaping the newline with `\`), and adds a Python script that automatically reformats existing KATs with lines that are too long.

Tested: unit tests
2024-06-14 22:17:15 +00:00
Mitch Lindgren 95ab1338d5 Squashing previous commits:
- Clean up files that were added accidentally
- MacOS build working again
- Unit test fixes
- Cleanup, address comments, add Mac pipeline
- Windows and Linux build fixes
- Publish pipeline artifacts
- More Windows build fixes
- Add macOS build to official pipeline
- More pipeline fiddling
- Generate symbols for unit test
- Workaround for speculative load hardening bug on Clang 12+. Updated documentation
- Test availability of macOS 14 ARM64 agent
- Revert change to pipeline; macos-14-arm64 doesn't work in ADO. Add skeleton CMakePresets.json file for work to be continued on newer Mac
- ARM64 build fixes
- Pipeline changes
- Fix PublishPipelineArtifact name
- Address comments
2024-06-04 13:39:46 -07:00
Josh Aas dac1fa2833 Initial macOS on Apple Silicon support.
Get rid of misleading comment.

First step towards turning the linux build path into a generic unix build path that supports Linux and macOS.

Make a build check that is already effectively for Linux only explicitly for Linux.

Remove unnecessary/breaking Apple includes.

test_lib.h: Generally use gnuc definitions on macOS but define GENRANDOM separately for macOS and Linux.

Define GET_PERF_CLOCK on macOS/ARM

Define body of getTimeInMs on macOS

We need C++17, and in order for CMake to set that properly on macOS we need to explicitly set the compilers to clang/clang++.

Use arc4random in unittest code on macOS.

build changes
2024-05-30 19:10:55 -07: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
Changyu Li baba9d3983 Merged PR 10636483: Add OpenSSL implementation for SHA2 and SHA3 algorithms
## Description:

Add OpenSSL implementation for SHA2 and SHA3 algorithms

## 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
2024-05-01 23:46:15 +00:00
Changyu Li 60abd9e61c Merged PR 10540579: Add OpenSSL implementation for RSA PSS test
## Description:

## 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
2024-04-12 00:00:10 +00:00
Mitch Lindgren 🦎 d02569c366 Merged PR 10544147: Remove SymCryptWipeKnownSize from Windows module exports
This change fixes a build break in the CMake pipeline by removing `SymCryptWipeKnownSize` from the exports for both the kernel and user mode modules. Since `SymCryptWipeKnownSize` is marked `FORCEINLINE`, it should be inlined everywhere and thus cannot be exported. (It's not clear why this didn't break the Windows Undocked Pipeline build--probably some difference in flags.)

In the future we'll remove this function from the Linux module exports as well. We have already documented that as an upcoming breaking change in `doc/breaking_changes.md`. Since the Windows modules haven't shipped yet, we don't have to consider this a breaking change for those modules.

Tested: unit tests with user mode + kernel mode dynamic modules
2024-04-04 02:14:53 +00:00
Changyu Li 7c1f6b4143 Merged PR 10481180: Add OpenSSL implementation for AesGcm test
## Description:

## 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

Add OpenSSL implementation for AesGcm test
2024-03-29 03:39:59 +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
Changyu Li b893aa9d20 Merged PR 10406838: Add OpenSSL implementation for XtsAes test
## Description:

We add OpenSSL as submodule to 3rdparty and link symcryptunittest to it so we can compare the SymCrypt implementation. We add perf and functional test for XtsAes as well.

## 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: #49347468
2024-03-16 00:10:00 +00:00
Maxwell McKee b3496da520 Merged PR 10154765: Fix builds for Mariner 3
## Description:
- Updates version.py to optionally accept git commit timestamp, commit ID, and branch name from the environment. SymCrypt is built from a source tarball in Mariner and cannot get this information from from git.
- Fixed build warnings encountered in Mariner build system

## 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
2024-01-25 23:40:05 +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
Samuel Lee 5b81251aa1 Merged PR 9623348: Add (EC)DH PCTs on key generation
+ Run eagerly because it makes code simpler
+ Add performance test for EckeySetRandom
2023-09-25 23:08:33 +00:00
Samuel Lee 894c6540ca Merged PR 9286503: Optimize ECC NIST Prime curve formulae
+ Separate out SYMCRYPT_INTERNAL_ECURVE_TYPE representing the types that
  SymCrypt can use for an Ecurve object at runtime from
  SYMCRYPT_ECURVE_TYPE representing the types that callers can specify a
  curve to be in curve parameters
+ Create a new SYMCRYPT_INTERNAL_ECURVE_TYPE which represents a Short-Weierstrass
  curve with A == -3 (the form of all NIST prime curves)
+ Recognise A == -3 in Ecurve creation, and set the Ecurve type
  appropriately
+ For NIST prime curves, dispatch to specialized EcPointDouble function
  which uses fewer Modular operations
+ Add W25519 and W448 as test cases to exercise non-NIST prime Short
  Weierstrass point doubling function. Just include these in test
  binaries, rather than in production modules, we do not want to
  encourage external callers to use these curves (they can specify the
  ECC parameters themselves if they really need them, but callers almost
  certainly should be using Montgomery or Twisted Edwards forms of these
  curves)

Related work items: #45077527, #45539705
2023-07-18 17:22:22 +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 7abb5ddb44 Merged PR 8726189: Ensure __cpuidex is not builtin before defining our own
+ Remove use of __cpuid
2023-03-28 20:50:03 +00:00
Samuel Lee 6976cb4e92 Merged PR 8523841: Add Shake, CShake, and KMAC symbols to kernel test module
+ Add missing symbols required for testing all Keccak-based algorithms in Windows Kernel Test Module
2023-02-16 01:54:01 +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
Samuel Lee 3668fd56b3 Merged PR 8395382: Fix Windows unit test for IvyBridge
+ In Windows unit test environment only fatal when SymCrypt reports a vector extension as available when Windows does not report the register set is available
+ Previously would fatal when SymCrypt detected AVX2 not available when Windows reports AVX registers available, or AVX512 not available when Windows reports AVX512 registers available, causing a crash on IvyBridge or Knights Landing processors respectively
+ Also dump CPUID info on fatal error in unit tests to help debug this kind of issue in future

Related work items: #38706387
2023-01-24 01:58:17 +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
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
Samuel Lee 07a5bf94d0 Merged PR 8176148: Linux RNG perf testing and improvements
+ Enable measurements of Linux RNG system
+ Make various performance improvements to defer costly calls into JitterEntropy until they are strictly required,
and reduce cost of calls when they are made.

Related work items: #42441472, #42441492
2022-12-02 20:11:46 +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
Samuel Lee 832546a10f Merged PR 7902733: Fix Razzle build
+ Do not use git status in createBuildString.cmd, it writes
all of the git lock files, which breaks Razzle build (ABT3101)
+ Do not include selftests that need allocations in the list
used by kernel test; there is no SymCryptCallbackAlloc/Free
defined there, so we have a link error.
2022-09-27 03:14:18 +00:00
Mitch Lindgren 🦎 9ab13e21bc Merged PR 7872479: Fix DSA selftest perf. Add perf measurements to selftest execution in unit tests.
`SymCryptDsaSelftest` was passing the `SYMCRYPT_DLGROUP_FIPS_LATEST` flag when calling `SymCryptDlgroupSetValue`, which causes that function to regenerate the primes P and Q and perform Rabin-Miller primality tests on them. This is very computationally expensive, to the point that running the DSA selftest caused significant performance problems in some scenarios.

The fix is to instead use `SYMCRYPT_DLGROUP_FIPS_NONE`; since we're using a hardcoded, known-good key, we do not need to perform the additional validation on it.

Also added error injection to selftests that were missing it, and added basic performance measurement to the selftests when they are run as part of the unit test, so that we can catch selftest performance issues more easily.
2022-09-20 18:21:54 +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 d1d4572f31 Merged PR 7594329: Enable SymCrypt unit tests to drive a dynamic module
+ Just targeting Linux modules for now as we do not yet have a Windows SymCrypt module
+ At the command line when running symcryptunittest add option to load and test a dynamic SymCrypt module from a path
+ Enable a shim layer in our test code calling SymCrypt functions, and based on the template specialization or a global variable (depending upon the context of the function being called), the shim directs the function call to different places
+ Rework the multi-implementation part of the code handling SymCrypt's implementation (sc_imp*) to enable multiple SymCrypt implementations to coexist
  + The pre-existing ImpSc's shim is augmented to always add vector register save/restore testing around every call into the statically linked SymCrypt function. All previous test calls for vector register testing are removed. We may add other tests here in future (i.e. checking the contents of the stack are clean on SymCrypt function return?).
  + The new ImpScStatic implementation directly calls the statically linked SymCrypt function. This is used in performance tests
  + The new ImpScDynamic implementation uses a static variable in a lambda function to store dynamic symbol pointers that are looked up (once per lambda function) at runtime using dlsym. These pointers are then used to test the dynamic module directly (i.e. without any unit-test specific environment). This enables both comparative functional testing with static and dynamic SymCrypt, and realistic performance testing of the dynamic SymCrypt module
+ Also tests directly calling the SymCrypt APIs (not all tests calling low-level SymCrypt APIs) to shim to static or dynamic versions

Related work items: #38706387
2022-08-05 20:01:21 +00:00
Samuel Lee cc2148e4d0 Merged PR 7551174: Rejig CPUID logic for VAES and AVX*
+ Make VAES CPU feature depend only on VAES and VPCLMULQDQ
+ Make features for VAES_256 code depend on AVX2 feature and VAES (so
  disabling AVX2 will disable VAES_256)
+ Similarly make features for VAES_512 code depend on AVX512 feature
+ Check xgetbv correctly to enable/disable AVX512 appropriately based on
  OS support
+ Remove GetEnabledXStateFeatures logic from linux env file. For Windows
 unittest env, check if xgetbv result is different to GetEnabledXStateFeatures, as
that indicates an OS bug
  + This enables all AVX2 on Linux which can support it, rather than
    only supporting VAES_256 on Linux which supports AVX2 (the prior
    situation)
+ Reintroduce reduced Xmm save/restore testing on Windows AMD64 user
mode, to check that Xmm6-Xmm15 are correctly saved/restored in SymCrypt code
+ Introduce optional Ymm save/restore testing which can be run on Linux
successfully today using runtime options for telling glibc to not use AVX. This allows
us to test the SymCrypt[Save|Restore]Ymm logic (relevant to Windows kernel mode)
accurately in the SymCrypt ADO pipeline.

Related work items: #32997124
2022-07-12 11:50:20 +00:00
Samuel Lee d70e7f5c1f Merged PR 7061228: AES-GCM session implementation
Add AES-GCM session implementation

+ The GCM encryption session implementation enables FIPS certification of AES-GCM as the nonce generation is within the FIPS boundary
+ The GCM decryption session enables replay protection for callers. It is designed to be useful for fresh a higher level protocol like QCC

Related work items: #38643032
2022-03-26 22:08:37 +00:00
Samuel Lee 764e0720be Merged PR 6913343: Fixes for use of Ymm in AES code
+ Re-enable Ymm save/restore tests in Windows unit tests
+ Fix Ymm save/restore tests in all unit tests (previously would never
  trigger)
+ Add flag to skip Ymm verification if unit tests artificially fallback
  to non-Ymm SymCrypt code which can still lead to (volatile) Ymm
  registers being wiped with CRT functions
+ Opt-in to checking Ymm registers in unit tests for AES-GCM and AES-XTS
+ Add Save/Restore Ymm logic to AES-GCM and AES-XTS codepaths
+ Move GCM check for sufficient buffer length to use Ymm up a level to
  avoid saving/restoring Ymm state for small buffers

Related work items: #37812709
2022-02-03 08:01:40 +00:00
Samuel Lee c76ef864db Merged PR 6707894: Add SP800-108 self tests for HmacSha512 and tidy up KDF self tests
+ KMAN uses SP800-108 with HmacSha512 - we will need to certify this in the SymCrypt module for Overlake / Mariner, so add SelfTests for this combination.
+ Also tidy up some comments which are clearly copy-paste errors
+ Ignore build artifacts that are in the jitterentropy submodule

Related work items: #37166368
2021-12-09 13:05:29 +00:00
Samuel Lee 62b3f1dcd9 Fix SymCryptDlkeySizeofPrivateKey & add further tests 2021-11-30 10:03:24 -08:00
Samuel Lee 52e04d95e0 Add SP800-108 self tests for HmacSHA512 and tidy up KDF self tests 2021-11-26 05:51:22 -08:00
Samuel Lee 98dbd7203a Merged PR 6344016: Enable Native Arm64 Generic Linux build
+ Don't use x86/AMD64 specific timing functions in generic build
unit tests
+ Only include AMD64-specific files in AMD64 builds

Related work items: #35287257
2021-08-13 18:12:47 +00:00
Samuel Lee 0e232d4392 Merged PR 6315721: OACR fixups
+ Resolves all issues flagged by runoacr in symcrypt\lib
  + Leaves some oacr issues in test code
+ Also includes some unrelated fixes to typos etc.

Related work items: #35052770
2021-08-04 15:18:36 +00:00
Yuval Harpaz 2839a6d144 Adding Add/Remove Padding for PKCS7 2021-07-21 20:32:40 +03:00
Mitch Lindgren 🦎 5b1cfe0171 Merged PR 5935572: Create SymCrypt shared object module with integrity verification
This change adds a new SymCrypt shared object module for Linux. The shared object module implements integrity verification for FIPS compliance by reading its own memory at runtime, reversing any relocations, calculating the HMAC-SHA256 digest of the module contents in memory, and comparing the digest to a known-good value which is injected into the module (outside the FIPS boundary) post compilation by a Python script.

Related work items: #30397153, #30397542, #30397643, #30397707, #30397781, #32407416
2021-04-30 19:52:39 +00:00
Samuel Lee da2ca6f02a Merged PR 5798744: Linux: Fix performance measurements
+ Enable compiler optimizations (important for comparable perf with
  intrinsics)
  + On my devbox this has the added advantage of the runtime of the
  unit tests being "only" ~10 mins, so I suspect we can reenable running
  tests in the pipeline
+ Enable SYMCRYPT_NOINLINE macro for GCC/clang (I was worried
  measurements could be skewed if this macro isn't respected)
+ Also fix use of print with std::string rather than c_string in unit
  test

Related work items: #32141800
2021-03-17 11:00:03 +00:00
Mitch Lindgren 🦎 2beea4effd Merged PR 5697377: Enable compilation with intrinsics on Linux
This changes enables compiling for AMD64 on Linux with intrinsics. It does not include the ASM handwritten ASM.

Related work items: #31860169
2021-03-01 19:02:13 +00:00
Samuel Lee 2829fe90fb Merged PR 5689743: Changes for SP800-56arev3 FIPS 140-2 compliance
+ Add validation flags for DlKey and EcKey Import and Generate
  + Enables callers to perform the correct amount of validation to be compliant with SP800-56arev3
+ Add support for named safe-prime groups in DH, as shortest path to supporting compliance using FFC
  + This will enable BCrypt callers to explicitly or implicitly use named safe-prime groups groups and have the requisite validation, rather than having to create a new in-memory representation of DH keys to expose the prime Q
  + Add tests to for validity of the named safe-prime group constants, so the unit tests should pick up on inadvertent changes, or errors in definitions of new safe-prime groups if/when they may be added
+ Enable the strictest validation that makes sense in all existing tests to exercise validation code.
  + Also randomly exercise the use of all the different valid flag combinations in tests

Related work items: #26526301, #26527152, #31528841, #31528936, #31529044, #31782556
2021-02-20 00:08:55 +00:00
Samuel Lee 8d4e109955 Merged PR 5607908: Introduce mode to output cycle measurements for different DataSizes
+ A bit hacky but sharing for visibility on how I generated https://microsofteur-my.sharepoint.com//g/personal/saml_microsoft_com1/ERC3CXr-PzZIk7tSOGxURawBVu7D5NZQASnAqSZSWFUGlw?e=gzy790
+ Easy to import into excel with comma delimited values, and make a
  pivot table for analysis
+ Add some usage text to give an idea of how to use the new mode
2021-01-26 14:21:04 +00:00