Skip to content

Commit 198be4c

Browse files
committed
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
1 parent d6d4461 commit 198be4c

27 files changed

+1182
-448
lines changed

.pipelines/OneBranch.WindowsUndocked.Official.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ trigger:
2525
- publish
2626

2727
schedules:
28-
- cron: "0 8 * * *" # Daily at 1am UTC (midnight PST/1am PDT)
28+
- cron: "0 8 * * *" # Daily at 8am UTC (midnight PST/1am PDT)
2929
displayName: Daily build
3030
branches:
3131
include:
@@ -80,12 +80,13 @@ extends:
8080
- template: .pipelines/templates/build-windows-undocked.yml@self
8181
parameters:
8282
sln: symcrypt.sln
83-
buildSuffix: '-official'
83+
buildType: 'official'
8484
# Package args
8585
package: ${{ parameters.package }}
8686
name: 'SymCrypt'
8787
description: 'SymCrypt cryptographic library'
8888
89+
sign: true
8990
# Windows ingestion args
9091
# ingest: ${{ parameters.ingest }}
9192
# osPath: 'onecore/ds/security/symcrypt'

.pipelines/OneBranch.WindowsUndocked.PullRequest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ extends:
4646
- template: .pipelines/templates/build-windows-undocked.yml@self
4747
parameters:
4848
sln: SymCrypt.sln
49-
buildSuffix: '-pr'
49+
buildType: 'pr'

.pipelines/templates/build-windows-undocked.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ parameters:
88
config: 'Debug,Release'
99
platform: 'x86,x64,arm64'
1010
nativeCompiler: true
11-
buildSuffix: '-private'
11+
buildType: 'private'
1212
sign: false # Only signs UM binaries, for external (to Windows repo) release
1313
# Packaging args
1414
package: false
@@ -127,7 +127,7 @@ jobs:
127127
configuration: $(ob_build_config)
128128
maximumCpuCount: true
129129
restoreNugetPackages: ${{ parameters.restoreNugetPackages }}
130-
msbuildArgs: '-p:UndockedOfficial=${{ parameters.nativeCompiler }} -p:UndockedBuildId=$(Build.BuildId) -p:VER_BUILD_ID=$(Build.BuildId) -p:VER_SUFFIX=${{ parameters.buildSuffix }} -p:SymCryptTestLegacyImpl=true ${{ parameters.msbuildArgs }}'
130+
msbuildArgs: '-p:UndockedOfficial=${{ parameters.nativeCompiler }} -p:UndockedBuildId=$(Build.BuildId) -p:VER_BUILD_ID=$(Build.BuildId) -p:VER_SUFFIX=${{ parameters.buildType }} -p:SymCryptTestLegacyImpl=true ${{ parameters.msbuildArgs }}'
131131

132132
# Overwrite default artifact publishing with our copy (enables publishing binaries for failed runs)
133133
- task: PowerShell@2
@@ -148,14 +148,23 @@ jobs:
148148
workingDirectory: $(Build.SourcesDirectory)
149149

150150
- task: PythonScript@0
151-
displayName: 'Run dynamic unit tests'
151+
displayName: 'Run dynamic unit tests (test module)'
152152
condition: or(eq(variables['ob_build_platform'], 'x64'), eq(variables['ob_build_platform'], 'x86'))
153153
inputs:
154154
scriptSource: 'filePath'
155155
scriptPath: scripts\test.py
156156
arguments: 'build\bin dynamic:build\bin\$(ob_build_platform_win)$(ob_build_config_win)\dll\symcrypttestmodule.dll noperftests'
157157
workingDirectory: $(Build.SourcesDirectory)
158158

159+
- task: PythonScript@0
160+
displayName: 'Run dynamic unit tests (prod module)'
161+
condition: and(eq('${{ parameters.buildType }}', 'official'), or(eq(variables['ob_build_platform'], 'x64'), eq(variables['ob_build_platform'], 'x86')))
162+
inputs:
163+
scriptSource: 'filePath'
164+
scriptPath: scripts\test.py
165+
arguments: 'build\bin dynamic:build\bin\$(ob_build_platform_win)$(ob_build_config_win)\dll\symcrypt.dll noperftests'
166+
workingDirectory: $(Build.SourcesDirectory)
167+
159168
- task: onebranch.pipeline.signing@1 # https://aka.ms/obpipelines/signing
160169
displayName: 'Sign Binaries'
161170
condition: eq('${{ parameters.sign }}', true)

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
New changes will be listed here as they are developed. The version number is determined
44
prior to the creation of a new release, based on the changes contained in that release.
55

6+
# Version 103.4.2
7+
68
- Add SymCryptEntropyAccumulator to Windows kernel module
79
- Fix tweak lower 64 bit overflow calculation in SYMCRYPT_XtsAesXxx
810
- Add OpenSSL implementation for XtsAes to symcryptunittest
11+
- Add Windows user mode DLL
912

1013
# Version 103.4.1
1114
- Add retpoline guard flags for undocked Windows build
15+
- Add Windows kernel mode DLL
1216
- Support ARM32 for Linux
1317

1418
# Version 103.4.0

SymCrypt.sln

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,39 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.4.33213.308
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypt", "lib\symcrypt.vcxproj", "{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}"
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypt.lib", "lib\symcrypt.vcxproj", "{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}"
77
EndProject
8-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptunittest_lib", "unittest\lib\symcryptunittest_lib.vcxproj", "{1146804C-B04F-43F1-83B0-081A5187BA02}"
8+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptunittest.lib", "unittest\lib\symcryptunittest_lib.vcxproj", "{1146804C-B04F-43F1-83B0-081A5187BA02}"
99
EndProject
10-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptunittest", "unittest\exe_test\symcryptunittest.vcxproj", "{1651C608-DD2F-4D18-8E5B-E3C1D11BD7B9}"
10+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptunittest.exe", "unittest\exe_test\symcryptunittest.vcxproj", "{1651C608-DD2F-4D18-8E5B-E3C1D11BD7B9}"
1111
ProjectSection(ProjectDependencies) = postProject
1212
{1146804C-B04F-43F1-83B0-081A5187BA02} = {1146804C-B04F-43F1-83B0-081A5187BA02}
1313
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
1414
EndProjectSection
1515
EndProject
16-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypttestmodule", "unittest\module_windows\symcrypttestmodule.vcxproj", "{E5919189-A4AF-40C4-81CB-A3685485276E}"
16+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypttestmodule.dll", "unittest\module_windows\symcrypttestmodule.vcxproj", "{E5919189-A4AF-40C4-81CB-A3685485276E}"
1717
ProjectSection(ProjectDependencies) = postProject
1818
{1146804C-B04F-43F1-83B0-081A5187BA02} = {1146804C-B04F-43F1-83B0-081A5187BA02}
1919
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
2020
EndProjectSection
2121
EndProject
22-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SymCryptKernelTestModule", "unittest\module_windows_sys_km\SymCryptKernelTestModule.vcxproj", "{0C2652ED-2CCD-4FAF-910B-74FB90E0C31C}"
22+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SymCryptKernelTestModule.sys", "unittest\module_windows_sys_km\SymCryptKernelTestModule.vcxproj", "{0C2652ED-2CCD-4FAF-910B-74FB90E0C31C}"
2323
ProjectSection(ProjectDependencies) = postProject
2424
{1146804C-B04F-43F1-83B0-081A5187BA02} = {1146804C-B04F-43F1-83B0-081A5187BA02}
2525
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
2626
EndProjectSection
2727
EndProject
28-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SymCryptKernelTestModule_UM", "unittest\module_windows_sys_um\SymCryptKernelTestModule_UM.vcxproj", "{07DBF66B-64EA-4D2C-9182-9C6E2D89C7DB}"
28+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SymCryptKernelTestModule.dll", "unittest\module_windows_sys_um\SymCryptKernelTestModule_UM.vcxproj", "{07DBF66B-64EA-4D2C-9182-9C6E2D89C7DB}"
2929
ProjectSection(ProjectDependencies) = postProject
3030
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
3131
EndProjectSection
3232
EndProject
33-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptk", "modules\windows\kernel\symcryptk.vcxproj", "{5A666AF4-35C9-42FE-817D-9D9A07AAF253}"
33+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptk.dll", "modules\windows\kernel\symcryptk.vcxproj", "{5A666AF4-35C9-42FE-817D-9D9A07AAF253}"
34+
ProjectSection(ProjectDependencies) = postProject
35+
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
36+
EndProjectSection
37+
EndProject
38+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypt.dll", "modules\windows\user\symcrypt.vcxproj", "{c75bcb09-00b2-4008-9700-e3b5e7391c69}"
3439
ProjectSection(ProjectDependencies) = postProject
3540
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
3641
EndProjectSection
@@ -212,6 +217,31 @@ Global
212217

213218
{5A666AF4-35C9-42FE-817D-9D9A07AAF253}.Release|x86.ActiveCfg = Release|Win32
214219

220+
# symcrypt.dll
221+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|ARM64.ActiveCfg = Debug|ARM64
222+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|ARM64.Build.0 = Debug|ARM64
223+
224+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|ARM64EC.ActiveCfg = Debug|ARM64EC
225+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|ARM64EC.Build.0 = Debug|ARM64EC
226+
227+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|x64.ActiveCfg = Debug|x64
228+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|x64.Build.0 = Debug|x64
229+
230+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|x86.ActiveCfg = Debug|Win32
231+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|x86.Build.0 = Debug|Win32
232+
233+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|ARM64.ActiveCfg = Release|ARM64
234+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|ARM64.Build.0 = Release|ARM64
235+
236+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|ARM64EC.ActiveCfg = Release|ARM64EC
237+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|ARM64EC.Build.0 = Release|ARM64EC
238+
239+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|x64.ActiveCfg = Release|x64
240+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|x64.Build.0 = Release|x64
241+
242+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|x86.ActiveCfg = Release|Win32
243+
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|x86.Build.0 = Release|Win32
244+
215245

216246
EndGlobalSection
217247
GlobalSection(SolutionProperties) = preSolution

SymCryptPackage.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@
8787
"dest" : "lib/symcrypt.lib",
8888
"platform" : "win32"
8989
},
90+
{
91+
"source" : "${BIN_DIR}/dll/symcrypt.dll",
92+
"dest" : "dll/symcrypt.dll",
93+
"platform" : "win32"
94+
},
95+
{
96+
"source" : "${BIN_DIR}/dll/symcrypt.lib",
97+
"dest" : "dll/symcrypt.lib",
98+
"platform" : "win32"
99+
},
90100
{
91101
"source" : "${BIN_DIR}/kmdll/symcryptk.dll",
92102
"dest" : "dll/symcryptk.dll",
@@ -121,6 +131,11 @@
121131
"dest" : "test/symcryptunittest.exe",
122132
"platform" : "win32"
123133
},
134+
{
135+
"source" : "${BIN_DIR}/dll/symcrypt.pdb",
136+
"dest" : "dll/symcrypt.pdb",
137+
"platform" : "win32"
138+
},
124139
{
125140
"source" : "${BIN_DIR}/kmdll/symcryptk.pdb",
126141
"dest" : "dll/symcryptk.pdb",

inc/symcrypt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5605,7 +5605,7 @@ SymCryptRngAesFips140_2Uninstantiate(
56055605
// Internal RNG functions
56065606
//
56075607
// To satisfy FIPS 140-3 and SP 800-90B, certain modules of SymCrypt may set up internal
5608-
// RNG state(s) to keep random bit generation behind the module security boundary.
5608+
// RNG state(s) to keep random bit generation behind the module's FIPS boundary.
56095609
// These functions allow the caller to get random bits and provide entropy, respectively,
56105610
// to SymCrypt's internal RNG state(s).
56115611
// Implementation is module dependent, and these functions may not be defined

inc/symcrypt.rc.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#endif
1616

1717
#ifndef VER_SUFFIX
18-
#define VER_SUFFIX -private
18+
#define VER_SUFFIX private
1919
#endif
2020

2121
//
@@ -33,7 +33,7 @@
3333
#define VER_FILEVERSION VER_MAJOR,VER_MINOR,VER_PATCH,0
3434
#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD_ID) "\0"
3535

36-
#define VER_PRODUCTVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD_ID) STR(VER_SUFFIX) "\0"
36+
#define VER_PRODUCTVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD_ID) "-" STR(VER_SUFFIX) "\0"
3737

3838
VS_VERSION_INFO VERSIONINFO
3939
FILEVERSION VER_FILEVERSION

inc/symcrypt_internal_shared.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
#define SYMCRYPT_CODE_VERSION_API 103
2626
#define SYMCRYPT_CODE_VERSION_MINOR 4
27-
#define SYMCRYPT_CODE_VERSION_PATCH 1
27+
#define SYMCRYPT_CODE_VERSION_PATCH 2
2828
2929
#if defined(DBG)
3030
#define SYMCRYPT_DEBUG 1

modules/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ if(NOT WIN32 AND NOT CMAKE_BUILD_TYPE MATCHES Sanitize)
44
add_subdirectory(linux)
55
endif()
66

7-
# Placeholder: CMake can't build Windows kernel drivers, and we don't currently have a
8-
# Windows user-mode DLL
9-
# if(WIN32)
10-
# add_subdirectory(windows)
11-
# endif()
7+
if(WIN32)
8+
add_subdirectory(windows)
9+
endif()

0 commit comments

Comments
 (0)