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
This commit is contained in:
Mitch Lindgren 🦎 2024-03-30 01:10:14 +00:00
Родитель d6d4461829
Коммит 198be4c6b7
27 изменённых файлов: 1184 добавлений и 450 удалений

Просмотреть файл

@ -25,7 +25,7 @@ trigger:
- publish
schedules:
- cron: "0 8 * * *" # Daily at 1am UTC (midnight PST/1am PDT)
- cron: "0 8 * * *" # Daily at 8am UTC (midnight PST/1am PDT)
displayName: Daily build
branches:
include:
@ -80,12 +80,13 @@ extends:
- template: .pipelines/templates/build-windows-undocked.yml@self
parameters:
sln: symcrypt.sln
buildSuffix: '-official'
buildType: 'official'
# Package args
package: ${{ parameters.package }}
name: 'SymCrypt'
description: 'SymCrypt cryptographic library'
owner: 'ensciacrypto@microsoft.com'
sign: true
# Windows ingestion args
# ingest: ${{ parameters.ingest }}
# osPath: 'onecore/ds/security/symcrypt'

Просмотреть файл

@ -46,4 +46,4 @@ extends:
- template: .pipelines/templates/build-windows-undocked.yml@self
parameters:
sln: SymCrypt.sln
buildSuffix: '-pr'
buildType: 'pr'

Просмотреть файл

@ -8,7 +8,7 @@ parameters:
config: 'Debug,Release'
platform: 'x86,x64,arm64'
nativeCompiler: true
buildSuffix: '-private'
buildType: 'private'
sign: false # Only signs UM binaries, for external (to Windows repo) release
# Packaging args
package: false
@ -127,7 +127,7 @@ jobs:
configuration: $(ob_build_config)
maximumCpuCount: true
restoreNugetPackages: ${{ parameters.restoreNugetPackages }}
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 }}'
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 }}'
# Overwrite default artifact publishing with our copy (enables publishing binaries for failed runs)
- task: PowerShell@2
@ -148,7 +148,7 @@ jobs:
workingDirectory: $(Build.SourcesDirectory)
- task: PythonScript@0
displayName: 'Run dynamic unit tests'
displayName: 'Run dynamic unit tests (test module)'
condition: or(eq(variables['ob_build_platform'], 'x64'), eq(variables['ob_build_platform'], 'x86'))
inputs:
scriptSource: 'filePath'
@ -156,6 +156,15 @@ jobs:
arguments: 'build\bin dynamic:build\bin\$(ob_build_platform_win)$(ob_build_config_win)\dll\symcrypttestmodule.dll noperftests'
workingDirectory: $(Build.SourcesDirectory)
- task: PythonScript@0
displayName: 'Run dynamic unit tests (prod module)'
condition: and(eq('${{ parameters.buildType }}', 'official'), or(eq(variables['ob_build_platform'], 'x64'), eq(variables['ob_build_platform'], 'x86')))
inputs:
scriptSource: 'filePath'
scriptPath: scripts\test.py
arguments: 'build\bin dynamic:build\bin\$(ob_build_platform_win)$(ob_build_config_win)\dll\symcrypt.dll noperftests'
workingDirectory: $(Build.SourcesDirectory)
- task: onebranch.pipeline.signing@1 # https://aka.ms/obpipelines/signing
displayName: 'Sign Binaries'
condition: eq('${{ parameters.sign }}', true)

Просмотреть файл

@ -3,12 +3,16 @@
New changes will be listed here as they are developed. The version number is determined
prior to the creation of a new release, based on the changes contained in that release.
# Version 103.4.2
- Add SymCryptEntropyAccumulator to Windows kernel module
- Fix tweak lower 64 bit overflow calculation in SYMCRYPT_XtsAesXxx
- Add OpenSSL implementation for XtsAes to symcryptunittest
- Add Windows user mode DLL
# Version 103.4.1
- Add retpoline guard flags for undocked Windows build
- Add Windows kernel mode DLL
- Support ARM32 for Linux
# Version 103.4.0

Просмотреть файл

@ -3,34 +3,39 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypt", "lib\symcrypt.vcxproj", "{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypt.lib", "lib\symcrypt.vcxproj", "{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptunittest_lib", "unittest\lib\symcryptunittest_lib.vcxproj", "{1146804C-B04F-43F1-83B0-081A5187BA02}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptunittest.lib", "unittest\lib\symcryptunittest_lib.vcxproj", "{1146804C-B04F-43F1-83B0-081A5187BA02}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptunittest", "unittest\exe_test\symcryptunittest.vcxproj", "{1651C608-DD2F-4D18-8E5B-E3C1D11BD7B9}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptunittest.exe", "unittest\exe_test\symcryptunittest.vcxproj", "{1651C608-DD2F-4D18-8E5B-E3C1D11BD7B9}"
ProjectSection(ProjectDependencies) = postProject
{1146804C-B04F-43F1-83B0-081A5187BA02} = {1146804C-B04F-43F1-83B0-081A5187BA02}
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypttestmodule", "unittest\module_windows\symcrypttestmodule.vcxproj", "{E5919189-A4AF-40C4-81CB-A3685485276E}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypttestmodule.dll", "unittest\module_windows\symcrypttestmodule.vcxproj", "{E5919189-A4AF-40C4-81CB-A3685485276E}"
ProjectSection(ProjectDependencies) = postProject
{1146804C-B04F-43F1-83B0-081A5187BA02} = {1146804C-B04F-43F1-83B0-081A5187BA02}
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SymCryptKernelTestModule", "unittest\module_windows_sys_km\SymCryptKernelTestModule.vcxproj", "{0C2652ED-2CCD-4FAF-910B-74FB90E0C31C}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SymCryptKernelTestModule.sys", "unittest\module_windows_sys_km\SymCryptKernelTestModule.vcxproj", "{0C2652ED-2CCD-4FAF-910B-74FB90E0C31C}"
ProjectSection(ProjectDependencies) = postProject
{1146804C-B04F-43F1-83B0-081A5187BA02} = {1146804C-B04F-43F1-83B0-081A5187BA02}
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SymCryptKernelTestModule_UM", "unittest\module_windows_sys_um\SymCryptKernelTestModule_UM.vcxproj", "{07DBF66B-64EA-4D2C-9182-9C6E2D89C7DB}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SymCryptKernelTestModule.dll", "unittest\module_windows_sys_um\SymCryptKernelTestModule_UM.vcxproj", "{07DBF66B-64EA-4D2C-9182-9C6E2D89C7DB}"
ProjectSection(ProjectDependencies) = postProject
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptk", "modules\windows\kernel\symcryptk.vcxproj", "{5A666AF4-35C9-42FE-817D-9D9A07AAF253}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcryptk.dll", "modules\windows\kernel\symcryptk.vcxproj", "{5A666AF4-35C9-42FE-817D-9D9A07AAF253}"
ProjectSection(ProjectDependencies) = postProject
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symcrypt.dll", "modules\windows\user\symcrypt.vcxproj", "{c75bcb09-00b2-4008-9700-e3b5e7391c69}"
ProjectSection(ProjectDependencies) = postProject
{7C3BD5D2-7213-4CFA-B6CB-EB41623601BC} = {7C3BD5D2-7213-4CFA-B6CB-EB41623601BC}
EndProjectSection
@ -212,6 +217,31 @@ Global
{5A666AF4-35C9-42FE-817D-9D9A07AAF253}.Release|x86.ActiveCfg = Release|Win32
# symcrypt.dll
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|ARM64.ActiveCfg = Debug|ARM64
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|ARM64.Build.0 = Debug|ARM64
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|ARM64EC.ActiveCfg = Debug|ARM64EC
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|ARM64EC.Build.0 = Debug|ARM64EC
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|x64.ActiveCfg = Debug|x64
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|x64.Build.0 = Debug|x64
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|x86.ActiveCfg = Debug|Win32
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Debug|x86.Build.0 = Debug|Win32
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|ARM64.ActiveCfg = Release|ARM64
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|ARM64.Build.0 = Release|ARM64
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|ARM64EC.ActiveCfg = Release|ARM64EC
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|ARM64EC.Build.0 = Release|ARM64EC
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|x64.ActiveCfg = Release|x64
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|x64.Build.0 = Release|x64
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|x86.ActiveCfg = Release|Win32
{c75bcb09-00b2-4008-9700-e3b5e7391c69}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution

Просмотреть файл

@ -87,6 +87,16 @@
"dest" : "lib/symcrypt.lib",
"platform" : "win32"
},
{
"source" : "${BIN_DIR}/dll/symcrypt.dll",
"dest" : "dll/symcrypt.dll",
"platform" : "win32"
},
{
"source" : "${BIN_DIR}/dll/symcrypt.lib",
"dest" : "dll/symcrypt.lib",
"platform" : "win32"
},
{
"source" : "${BIN_DIR}/kmdll/symcryptk.dll",
"dest" : "dll/symcryptk.dll",
@ -121,6 +131,11 @@
"dest" : "test/symcryptunittest.exe",
"platform" : "win32"
},
{
"source" : "${BIN_DIR}/dll/symcrypt.pdb",
"dest" : "dll/symcrypt.pdb",
"platform" : "win32"
},
{
"source" : "${BIN_DIR}/kmdll/symcryptk.pdb",
"dest" : "dll/symcryptk.pdb",

Просмотреть файл

@ -5605,7 +5605,7 @@ SymCryptRngAesFips140_2Uninstantiate(
// Internal RNG functions
//
// To satisfy FIPS 140-3 and SP 800-90B, certain modules of SymCrypt may set up internal
// RNG state(s) to keep random bit generation behind the module security boundary.
// RNG state(s) to keep random bit generation behind the module's FIPS boundary.
// These functions allow the caller to get random bits and provide entropy, respectively,
// to SymCrypt's internal RNG state(s).
// Implementation is module dependent, and these functions may not be defined

Просмотреть файл

@ -15,7 +15,7 @@
#endif
#ifndef VER_SUFFIX
#define VER_SUFFIX -private
#define VER_SUFFIX private
#endif
//
@ -33,7 +33,7 @@
#define VER_FILEVERSION VER_MAJOR,VER_MINOR,VER_PATCH,0
#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD_ID) "\0"
#define VER_PRODUCTVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD_ID) STR(VER_SUFFIX) "\0"
#define VER_PRODUCTVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD_ID) "-" STR(VER_SUFFIX) "\0"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION

Просмотреть файл

@ -24,7 +24,7 @@
#define SYMCRYPT_CODE_VERSION_API 103
#define SYMCRYPT_CODE_VERSION_MINOR 4
#define SYMCRYPT_CODE_VERSION_PATCH 1
#define SYMCRYPT_CODE_VERSION_PATCH 2
#if defined(DBG)
#define SYMCRYPT_DEBUG 1

Просмотреть файл

@ -4,8 +4,6 @@ if(NOT WIN32 AND NOT CMAKE_BUILD_TYPE MATCHES Sanitize)
add_subdirectory(linux)
endif()
# Placeholder: CMake can't build Windows kernel drivers, and we don't currently have a
# Windows user-mode DLL
# if(WIN32)
# add_subdirectory(windows)
# endif()
if(WIN32)
add_subdirectory(windows)
endif()

Просмотреть файл

@ -1,6 +1,6 @@
//
// module.c
// Main file for SymCrypt DLL/shared object library
// Main file for SymCrypt shared object libraries on Linux-based systems
//
// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
//

Просмотреть файл

@ -0,0 +1 @@
add_subdirectory(user)

Просмотреть файл

@ -1,153 +1,130 @@
//
// main.c
// Main file for symcryptk.dll
//
// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
//
#include <ntddk.h>
#include <ntstrsafe.h>
#include <windef.h>
#include <symcrypt.h>
#include <symcrypt_low_level.h>
SYMCRYPT_ENVIRONMENT_WINDOWS_KERNELMODE_LATEST;
#define SYMCRYPT_FIPS_STATUS_INDICATOR
#define FIPS_SERVICE_DESC_ENTROPY_SOURCE
#define FIPS_SERVICE_DESC_SELF_TESTS
#define FIPS_SERVICE_DESC_SHOW_STATUS
#define FIPS_SERVICE_DESC_SHOW_VERSION
#include "../lib/status_indicator.h"
// Our DriverEntry function is not used, as this module acts as an export driver which is linked
// directly to the kernel. In other words, it's not initialized by WDF, and we don't create any
// device objects or use other WDF functions. However, we need to define an entrypoint, or
// secure kernel will be unable to load the module.
NTSTATUS
DriverEntry(
_In_ struct _DRIVER_OBJECT* DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
{
UNREFERENCED_PARAMETER( DriverObject );
UNREFERENCED_PARAMETER( RegistryPath );
return STATUS_SUCCESS;
}
void __cdecl __security_init_cookie(void);
VOID SYMCRYPT_CALL SymCryptModuleInit(UINT32 api, UINT32 minor)
{
// Initialize the /GS flag stack overflow cookie
__security_init_cookie();
if (api != SYMCRYPT_CODE_VERSION_API ||
(api == SYMCRYPT_CODE_VERSION_API && minor > SYMCRYPT_CODE_VERSION_MINOR))
{
SymCryptFatal('vers');
}
SymCryptInit();
}
PVOID
SYMCRYPT_CALL
SymCryptCallbackAlloc(SIZE_T nBytes)
{
PBYTE p, res = NULL;
ULONG offset;
p = (PBYTE) ExAllocatePoolZero(NonPagedPoolNx, nBytes + SYMCRYPT_ASYM_ALIGN_VALUE + 4, 'cmyS');
if (!p)
{
goto cleanup;
}
res = (PBYTE) (((ULONG_PTR)p + 4 + SYMCRYPT_ASYM_ALIGN_VALUE - 1) & ~(SYMCRYPT_ASYM_ALIGN_VALUE - 1));
offset = (ULONG)(res - p);
*(ULONG *) &res[-4] = offset;
cleanup:
return res;
}
VOID
SYMCRYPT_CALL
SymCryptCallbackFree(PVOID ptr)
{
PBYTE p;
ULONG offset;
p = (PBYTE) ptr;
offset = *(ULONG *) &p[-4];
ExFreePoolWithTag(p - offset, 'cmyS');
}
VOID
SYMCRYPT_CALL
SymCryptProvideEntropy(
_In_reads_(cbEntropy) PCBYTE pbEntropy,
SIZE_T cbEntropy )
{
UNREFERENCED_PARAMETER(pbEntropy);
UNREFERENCED_PARAMETER(cbEntropy);
}
VOID
SYMCRYPT_CALL
SymCryptRandom(
_Out_writes_bytes_( cbBuffer ) PBYTE pbBuffer,
SIZE_T cbBuffer )
{
UNREFERENCED_PARAMETER( pbBuffer );
UNREFERENCED_PARAMETER( cbBuffer );
// No one should be using this yet
SymCryptFatal( 'rnd1' );
}
SYMCRYPT_ERROR
SYMCRYPT_CALL
SymCryptCallbackRandom(
_Out_writes_bytes_( cbBuffer ) PBYTE pbBuffer,
SIZE_T cbBuffer )
{
UNREFERENCED_PARAMETER( pbBuffer );
UNREFERENCED_PARAMETER( cbBuffer );
// No one should be using this yet
SymCryptFatal( 'rnd2' );
}
PVOID
SYMCRYPT_CALL
SymCryptCallbackAllocateMutexFastInproc()
{
PFAST_MUTEX pFastMutex = (PFAST_MUTEX) ExAllocatePoolZero( NonPagedPoolNx, sizeof(FAST_MUTEX), 'uMCS' );
ExInitializeFastMutex(pFastMutex);
return (PVOID)pFastMutex;
}
VOID
SYMCRYPT_CALL
SymCryptCallbackFreeMutexFastInproc( PVOID pMutex )
{
ExFreePoolWithTag( (PBYTE)pMutex, 'uMCS' );
}
VOID
SYMCRYPT_CALL
SymCryptCallbackAcquireMutexFastInproc( PVOID pMutex )
{
ExAcquireFastMutex((PFAST_MUTEX)pMutex);
}
VOID
SYMCRYPT_CALL
SymCryptCallbackReleaseMutexFastInproc( PVOID pMutex )
{
ExReleaseFastMutex((PFAST_MUTEX)pMutex);
}
//
// module.c
// Main file for SymCrypt Windows kernel mode module, symcryptk.dll
//
// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
//
#include <ntddk.h>
#include <ntstrsafe.h>
#include <windef.h>
#include <symcrypt.h>
#include <symcrypt_low_level.h>
SYMCRYPT_ENVIRONMENT_WINDOWS_KERNELMODE_LATEST;
#define SYMCRYPT_FIPS_STATUS_INDICATOR
#define FIPS_SERVICE_DESC_ENTROPY_SOURCE
#define FIPS_SERVICE_DESC_SELF_TESTS
#define FIPS_SERVICE_DESC_SHOW_STATUS
#define FIPS_SERVICE_DESC_SHOW_VERSION
#include "../lib/status_indicator.h"
// Our DriverEntry function is not used, as this module acts as an export driver which is linked
// directly to the kernel. In other words, it's not initialized by WDF, and we don't create any
// device objects or use other WDF functions. However, we need to define an entrypoint, or
// secure kernel will be unable to load the module.
NTSTATUS
DriverEntry(
_In_ struct _DRIVER_OBJECT* DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
{
UNREFERENCED_PARAMETER( DriverObject );
UNREFERENCED_PARAMETER( RegistryPath );
return STATUS_SUCCESS;
}
void __cdecl __security_init_cookie(void);
VOID SYMCRYPT_CALL SymCryptModuleInit(UINT32 api, UINT32 minor)
{
// Initialize the /GS flag stack overflow cookie
__security_init_cookie();
if (api != SYMCRYPT_CODE_VERSION_API ||
(api == SYMCRYPT_CODE_VERSION_API && minor > SYMCRYPT_CODE_VERSION_MINOR))
{
SymCryptFatal('vers');
}
SymCryptInit();
}
PVOID
SYMCRYPT_CALL
SymCryptCallbackAlloc(SIZE_T nBytes)
{
PBYTE p, res = NULL;
ULONG offset;
p = (PBYTE) ExAllocatePoolZero(NonPagedPoolNx, nBytes + SYMCRYPT_ASYM_ALIGN_VALUE + 4, 'cmyS');
if (!p)
{
goto cleanup;
}
res = (PBYTE) (((ULONG_PTR)p + 4 + SYMCRYPT_ASYM_ALIGN_VALUE - 1) & ~(SYMCRYPT_ASYM_ALIGN_VALUE - 1));
offset = (ULONG)(res - p);
*(ULONG *) &res[-4] = offset;
cleanup:
return res;
}
VOID
SYMCRYPT_CALL
SymCryptCallbackFree(PVOID ptr)
{
PBYTE p;
ULONG offset;
p = (PBYTE) ptr;
offset = *(ULONG *) &p[-4];
ExFreePoolWithTag(p - offset, 'cmyS');
}
SYMCRYPT_ERROR
SYMCRYPT_CALL
SymCryptCallbackRandom(
_Out_writes_bytes_( cbBuffer ) PBYTE pbBuffer,
SIZE_T cbBuffer )
{
UNREFERENCED_PARAMETER( pbBuffer );
UNREFERENCED_PARAMETER( cbBuffer );
// No one should be using this yet
SymCryptFatal( 'rnd2' );
}
PVOID
SYMCRYPT_CALL
SymCryptCallbackAllocateMutexFastInproc()
{
PFAST_MUTEX pFastMutex = (PFAST_MUTEX) ExAllocatePoolZero( NonPagedPoolNx, sizeof(FAST_MUTEX), 'uMCS' );
ExInitializeFastMutex(pFastMutex);
return (PVOID)pFastMutex;
}
VOID
SYMCRYPT_CALL
SymCryptCallbackFreeMutexFastInproc( PVOID pMutex )
{
ExFreePoolWithTag( (PBYTE)pMutex, 'uMCS' );
}
VOID
SYMCRYPT_CALL
SymCryptCallbackAcquireMutexFastInproc( PVOID pMutex )
{
ExAcquireFastMutex((PFAST_MUTEX)pMutex);
}
VOID
SYMCRYPT_CALL
SymCryptCallbackReleaseMutexFastInproc( PVOID pMutex )
{
ExReleaseFastMutex((PFAST_MUTEX)pMutex);
}

Просмотреть файл

@ -51,6 +51,20 @@ EXPORTS
; SymCryptChaCha20Poly1305Selftest
; SymCryptChaCha20Selftest
; SymCryptChaCha20SetOffset
; SymCryptCShake128
; SymCryptCShake128Append
; SymCryptCShake128Extract
; SymCryptCShake128Init
; SymCryptCShake128Result
; SymCryptCShake128Selftest
; SymCryptCShake128StateCopy
; SymCryptCShake256
; SymCryptCShake256Append
; SymCryptCShake256Extract
; SymCryptCShake256Init
; SymCryptCShake256Result
; SymCryptCShake256Selftest
; SymCryptCShake256StateCopy
; SymCryptCtrMsb64
; SymCryptDesBlockCipher
; SymCryptDesDecrypt
@ -78,6 +92,7 @@ EXPORTS
; SymCryptDlkeyAllocate
; SymCryptDlkeyCopy
; SymCryptDlkeyCreate
; SymCryptDlkeyExtendKeyUsage
; SymCryptDlkeyFree
; SymCryptDlkeyGenerate
; SymCryptDlkeyGetGroup
@ -91,16 +106,17 @@ EXPORTS
; SymCryptDsaSelftest
; SymCryptDsaSign
; SymCryptDsaVerify
; SymCryptEcbDecrypt
; SymCryptEcbEncrypt
; SymCryptEcDhSecretAgreement
; SymCryptEcDhSecretAgreementSelftest
; SymCryptEcDsaSelftest
; SymCryptEcDsaSign
; SymCryptEcDsaVerify
; SymCryptEcbDecrypt
; SymCryptEcbEncrypt
; SymCryptEckeyAllocate
; SymCryptEckeyCopy
; SymCryptEckeyCreate
; SymCryptEckeyExtendKeyUsage
; SymCryptEckeyFree
; SymCryptEckeyGetValue
; SymCryptEckeyHasPrivateKey
@ -183,6 +199,33 @@ EXPORTS
; SymCryptHmacSha256Result
; SymCryptHmacSha256Selftest
; SymCryptHmacSha256StateCopy
; SymCryptHmacSha3_256
; SymCryptHmacSha3_256Algorithm
; SymCryptHmacSha3_256Append
; SymCryptHmacSha3_256ExpandKey
; SymCryptHmacSha3_256Init
; SymCryptHmacSha3_256KeyCopy
; SymCryptHmacSha3_256Result
; SymCryptHmacSha3_256Selftest
; SymCryptHmacSha3_256StateCopy
; SymCryptHmacSha3_384
; SymCryptHmacSha3_384Algorithm
; SymCryptHmacSha3_384Append
; SymCryptHmacSha3_384ExpandKey
; SymCryptHmacSha3_384Init
; SymCryptHmacSha3_384KeyCopy
; SymCryptHmacSha3_384Result
; SymCryptHmacSha3_384Selftest
; SymCryptHmacSha3_384StateCopy
; SymCryptHmacSha3_512
; SymCryptHmacSha3_512Algorithm
; SymCryptHmacSha3_512Append
; SymCryptHmacSha3_512ExpandKey
; SymCryptHmacSha3_512Init
; SymCryptHmacSha3_512KeyCopy
; SymCryptHmacSha3_512Result
; SymCryptHmacSha3_512Selftest
; SymCryptHmacSha3_512StateCopy
; SymCryptHmacSha384
; SymCryptHmacSha384Algorithm
; SymCryptHmacSha384Append
@ -201,10 +244,37 @@ EXPORTS
; SymCryptHmacSha512Result
; SymCryptHmacSha512Selftest
; SymCryptHmacSha512StateCopy
; SymCryptKmac128
; SymCryptKmac128Algorithm
; SymCryptKmac128Append
; SymCryptKmac128Ex
; SymCryptKmac128ExpandKey
; SymCryptKmac128ExpandKeyEx
; SymCryptKmac128Extract
; SymCryptKmac128Init
; SymCryptKmac128KeyCopy
; SymCryptKmac128Result
; SymCryptKmac128ResultEx
; SymCryptKmac128Selftest
; SymCryptKmac128StateCopy
; SymCryptKmac256
; SymCryptKmac256Algorithm
; SymCryptKmac256Append
; SymCryptKmac256Ex
; SymCryptKmac256ExpandKey
; SymCryptKmac256ExpandKeyEx
; SymCryptKmac256Extract
; SymCryptKmac256Init
; SymCryptKmac256KeyCopy
; SymCryptKmac256Result
; SymCryptKmac256ResultEx
; SymCryptKmac256Selftest
; SymCryptKmac256StateCopy
; SymCryptLoadLsbFirstUint32
; SymCryptLoadLsbFirstUint64
; SymCryptLoadMsbFirstUint32
; SymCryptLoadMsbFirstUint64
; SymCryptMapUint32
; SymCryptMarvin32
; SymCryptMarvin32Append
; SymCryptMarvin32DefaultSeed
@ -242,7 +312,8 @@ EXPORTS
; SymCryptMd5StateCopy
; SymCryptMd5StateExport
; SymCryptMd5StateImport
SymCryptModuleInit
; SymCryptPaddingPkcs7Add
; SymCryptPaddingPkcs7Remove
; SymCryptParallelSha256Init
; SymCryptParallelSha256Process
; SymCryptParallelSha256Selftest
@ -253,10 +324,10 @@ EXPORTS
; SymCryptParallelSha512Process
; SymCryptParallelSha512Selftest
; SymCryptPbkdf2
; SymCryptPbkdf2Derive
; SymCryptPbkdf2ExpandKey
; SymCryptPbkdf2_HmacSha1SelfTest
; SymCryptPbkdf2_HmacSha256SelfTest
; SymCryptPbkdf2Derive
; SymCryptPbkdf2ExpandKey
; SymCryptPoly1305
; SymCryptPoly1305Append
; SymCryptPoly1305Init
@ -284,18 +355,9 @@ EXPORTS
; SymCryptRngAesReseed
; SymCryptRngAesReseedSelftest
; SymCryptRngAesUninstantiate
; SymCryptRsaOaepDecrypt
; SymCryptRsaOaepEncrypt
; SymCryptRsaSelftest
; SymCryptRsaPkcs1Decrypt
; SymCryptRsaPkcs1Encrypt
; SymCryptRsaPkcs1Sign
; SymCryptRsaPkcs1Verify
; SymCryptRsaPssSign
; SymCryptRsaPssVerify
; SymCryptRsaRawDecrypt
; SymCryptRsaRawEncrypt
; SymCryptRsakeyAllocate
; SymCryptRsakeyCreate
; SymCryptRsakeyExtendKeyUsage
; SymCryptRsakeyFree
; SymCryptRsakeyGenerate
; SymCryptRsakeyGetCrtValue
@ -309,6 +371,22 @@ EXPORTS
; SymCryptRsakeySizeofPrime
; SymCryptRsakeySizeofPublicExponent
; SymCryptRsakeyWipe
; SymCryptRsaOaepDecrypt
; SymCryptRsaOaepEncrypt
; SymCryptRsaPkcs1Decrypt
; SymCryptRsaPkcs1Encrypt
; SymCryptRsaPkcs1Sign
; SymCryptRsaPkcs1Verify
; SymCryptRsaPssSign
; SymCryptRsaPssVerify
; SymCryptRsaRawDecrypt
; SymCryptRsaRawEncrypt
; SymCryptRsaSelftest
; SymCryptSessionDestroy
; SymCryptSessionGcmDecrypt
; SymCryptSessionGcmEncrypt
; SymCryptSessionReceiverInit
; SymCryptSessionSenderInit
; SymCryptSha1
; SymCryptSha1Algorithm
; SymCryptSha1Append
@ -329,26 +407,6 @@ EXPORTS
; SymCryptSha256StateCopy
; SymCryptSha256StateExport
; SymCryptSha256StateImport
; SymCryptSha384
; SymCryptSha384Algorithm
; SymCryptSha384Append
; SymCryptSha384Init
; SymCryptSha384OidList
; SymCryptSha384Result
; SymCryptSha384Selftest
; SymCryptSha384StateCopy
; SymCryptSha384StateExport
; SymCryptSha384StateImport
; SymCryptSha512
; SymCryptSha512Algorithm
; SymCryptSha512Append
; SymCryptSha512Init
; SymCryptSha512OidList
; SymCryptSha512Result
; SymCryptSha512Selftest
; SymCryptSha512StateCopy
; SymCryptSha512StateExport
; SymCryptSha512StateImport
; SymCryptSha3_256
; SymCryptSha3_256Algorithm
; SymCryptSha3_256Append
@ -376,75 +434,64 @@ EXPORTS
; SymCryptSha3_512StateCopy
; SymCryptSha3_512StateExport
; SymCryptSha3_512StateImport
; SymCryptShake128HashAlgorithm
; SymCryptSha384
; SymCryptSha384Algorithm
; SymCryptSha384Append
; SymCryptSha384Init
; SymCryptSha384OidList
; SymCryptSha384Result
; SymCryptSha384Selftest
; SymCryptSha384StateCopy
; SymCryptSha384StateExport
; SymCryptSha384StateImport
; SymCryptSha512
; SymCryptSha512Algorithm
; SymCryptSha512Append
; SymCryptSha512Init
; SymCryptSha512OidList
; SymCryptSha512Result
; SymCryptSha512Selftest
; SymCryptSha512StateCopy
; SymCryptSha512StateExport
; SymCryptSha512StateImport
; SymCryptShake128
; SymCryptShake128Extract
; SymCryptShake128Default
; SymCryptShake128Init
; SymCryptShake128Append
; SymCryptShake128Default
; SymCryptShake128Extract
; SymCryptShake128HashAlgorithm
; SymCryptShake128Init
; SymCryptShake128Result
; SymCryptShake128StateCopy
; SymCryptShake128Selftest
; SymCryptShake256HashAlgorithm
; SymCryptShake128StateCopy
; SymCryptShake256
; SymCryptShake256Extract
; SymCryptShake256Default
; SymCryptShake256Init
; SymCryptShake256Append
; SymCryptShake256Default
; SymCryptShake256Extract
; SymCryptShake256HashAlgorithm
; SymCryptShake256Init
; SymCryptShake256Result
; SymCryptShake256StateCopy
; SymCryptShake256Selftest
; SymCryptCShake128
; SymCryptCShake128Init
; SymCryptCShake128Append
; SymCryptCShake128Result
; SymCryptCShake128Extract
; SymCryptCShake128StateCopy
; SymCryptCShake128Selftest
; SymCryptCShake256
; SymCryptCShake256Init
; SymCryptCShake256Append
; SymCryptCShake256Result
; SymCryptCShake256Extract
; SymCryptCShake256StateCopy
; SymCryptCShake256Selftest
; SymCryptKmac128Algorithm
; SymCryptKmac128
; SymCryptKmac128Ex
; SymCryptKmac128ExpandKey
; SymCryptKmac128ExpandKeyEx
; SymCryptKmac128Init
; SymCryptKmac128Append
; SymCryptKmac128Result
; SymCryptKmac128ResultEx
; SymCryptKmac128Extract
; SymCryptKmac128KeyCopy
; SymCryptKmac128StateCopy
; SymCryptKmac128Selftest
; SymCryptKmac256Algorithm
; SymCryptKmac256
; SymCryptKmac256Ex
; SymCryptKmac256ExpandKey
; SymCryptKmac256ExpandKeyEx
; SymCryptKmac256Init
; SymCryptKmac256Append
; SymCryptKmac256Result
; SymCryptKmac256ResultEx
; SymCryptKmac256Extract
; SymCryptKmac256KeyCopy
; SymCryptKmac256StateCopy
; SymCryptKmac256Selftest
; SymCryptShake256StateCopy
; SymCryptSizeofDlgroupFromBitsizes
; SymCryptSizeofDlkeyFromDlgroup
; SymCryptSizeofEckeyFromCurve
; SymCryptSizeofRsakeyFromParams
; SymCryptSp800_108
; SymCryptSp800_108Derive
; SymCryptSp800_108ExpandKey
; SymCryptSp800_108_HmacSha1SelfTest
; SymCryptSp800_108_HmacSha256SelfTest
; SymCryptSp800_108_HmacSha384SelfTest
; SymCryptSp800_108_HmacSha512SelfTest
; SymCryptSp800_108Derive
; SymCryptSp800_108ExpandKey
; SymCryptSrtpKdf
; SymCryptSrtpKdfDerive
; SymCryptSrtpKdfExpandKey
; SymCryptSrtpKdfSelfTest
; SymCryptSshKdf
; SymCryptSshKdfDerive
; SymCryptSshKdfExpandKey
; SymCryptSshKdfSha256SelfTest
; SymCryptSshKdfSha512SelfTest
; SymCryptStoreLsbFirstUint32
; SymCryptStoreLsbFirstUint64
; SymCryptStoreMsbFirstUint32
@ -458,20 +505,12 @@ EXPORTS
; SymCryptTlsPrf1_2Derive
; SymCryptTlsPrf1_2ExpandKey
; SymCryptTlsPrf1_2SelfTest
; SymCryptSrtpKdf
; SymCryptSrtpKdfExpandKey
; SymCryptSrtpKdfDerive
; SymCryptSrtpKdfSelfTest
; SymCryptSshKdf
; SymCryptSshKdfExpandKey
; SymCryptSshKdfDerive
; SymCryptSshKdfSha256SelfTest
; SymCryptSshKdfSha512SelfTest
; SymCryptUint32Bitsize
; SymCryptUint32Bytesize
; SymCryptUint64Bitsize
; SymCryptUint64Bytesize
; SymCryptWipe
; SymCryptWipeKnownSize
; SymCryptXorBytes
; SymCryptXtsAesDecrypt
; SymCryptXtsAesDecryptWith128bTweak
@ -481,176 +520,12 @@ EXPORTS
; SymCryptXtsAesExpandKeyEx
; SymCryptXtsAesKeyCopy
; SymCryptXtsAesSelftest
; SymCryptSessionDestroy
; SymCryptSessionGcmDecrypt
; SymCryptSessionGcmEncrypt
; SymCryptSessionReceiverInit
; SymCryptSessionSenderInit
; SymCryptDlkeyExtendKeyUsage
; SymCryptEckeyExtendKeyUsage
; SymCryptRsakeyExtendKeyUsage
; SymCryptRsakeyCreate
; SymCryptDigitsFromBits
; SymCryptIntAllocate
; SymCryptIntFree
; SymCryptSizeofIntFromDigits
; SymCryptIntCreate
; SymCryptIntWipe
; SymCryptIntCopy
; SymCryptIntMaskedCopy
; SymCryptIntConditionalCopy
; SymCryptIntConditionalSwap
; SymCryptIntBitsizeOfObject
; SymCryptIntDigitsizeOfObject
; SymCryptDivisorAllocate
; SymCryptDivisorFree
; SymCryptSizeofDivisorFromDigits
; SymCryptDivisorCreate
; SymCryptDivisorWipe
; SymCryptDivisorCopy
; SymCryptDivisorDigitsizeOfObject
; SymCryptModulusAllocate
; SymCryptModulusFree
; SymCryptSizeofModulusFromDigits
; SymCryptModulusCreate
; SymCryptModulusWipe
; SymCryptModulusCopy
; SymCryptModulusDigitsizeOfObject
; SymCryptModElementAllocate
; SymCryptModElementFree
; SymCryptSizeofModElementFromModulus
; SymCryptModElementCreate
; SymCryptModElementWipe
; SymCryptModElementCopy
; SymCryptModElementMaskedCopy
; SymCryptModElementConditionalSwap
; SymCryptEcpointAllocate
; SymCryptEcpointFree
; SymCryptSizeofEcpointFromCurve
; SymCryptEcpointCreate
; SymCryptEcpointRetrieveHandle
; SymCryptEcpointWipe
; SymCryptEcpointCopy
; SymCryptEcpointMaskedCopy
; SymCryptIntCopyMixedSize
; SymCryptIntBitsizeOfValue
; SymCryptIntSetValueUint32
; SymCryptIntSetValueUint64
; SymCryptIntSetValue
; SymCryptIntGetValue
; SymCryptIntGetValueLsbits32
; SymCryptIntGetValueLsbits64
; SymCryptIntIsEqualUint32
; SymCryptIntIsEqual
; SymCryptIntIsLessThan
; SymCryptIntAddUint32
; SymCryptIntAddSameSize
; SymCryptIntAddMixedSize
; SymCryptIntSubUint32
; SymCryptIntSubSameSize
; SymCryptIntSubMixedSize
; SymCryptIntNeg
; SymCryptIntMulPow2
; SymCryptIntDivPow2
; SymCryptIntShr1
; SymCryptIntModPow2
; SymCryptIntGetBit
; SymCryptIntGetBits
; SymCryptIntSetBits
; SymCryptIntMulUint32
; SymCryptIntMulSameSize
; SymCryptIntSquare
; SymCryptIntMulMixedSize
; SymCryptIntFromDivisor
; SymCryptIntToDivisor
; SymCryptIntDivMod
; SymCryptIntExtendedGcd
; SymCryptUint64Gcd
; SymCryptCrtGenerateInverses
; SymCryptCrtSolve
; SymCryptCreateTrialDivisionContext
; SymCryptFreeTrialDivisionContext
; SymCryptIntFindSmallDivisor
; SymCryptIntMillerRabinPrimalityTest
; SymCryptIntGenerateRandomPrime
; SymCryptDivisorFromModulus
; SymCryptIntFromModulus
; SymCryptIntToModulus
; SymCryptIntToModElement
; SymCryptModElementToInt
; SymCryptModElementSetValue
; SymCryptModElementSetValueUint32
; SymCryptModElementSetValueNegUint32
; SymCryptModElementGetValue
; SymCryptModElementIsEqual
; SymCryptModElementIsZero
; SymCryptModSetRandom
; SymCryptModNeg
; SymCryptModAdd
; SymCryptModSub
; SymCryptModMul
; SymCryptModSquare
; SymCryptModDivPow2
; SymCryptModInv
; SymCryptModExp
; SymCryptModMultiExp
; SymCryptScsTableInit
; SymCryptScsTableSetBuffer
; SymCryptScsTableStore
; SymCryptScsTableLoad
; SymCryptScsTableWipe
; SymCryptScsRotateBuffer
; SymCryptScsCopy
; SymCryptMapUint32
; SymCryptMask32IsZeroU31
; SymCryptMask32IsNonzeroU31
; SymCryptMask32EqU32
; SymCryptMask32NeqU31
; SymCryptMask32LtU31
; SymCryptPaddingPkcs7Add
; SymCryptPaddingPkcs7Remove
; SymCryptRoundUpPow2Sizet
; SymCryptRsaPkcs1ApplyEncryptionPadding
; SymCryptRsaPkcs1RemoveEncryptionPadding
; SymCryptRsaOaepApplyEncryptionPadding
; SymCryptRsaOaepRemoveEncryptionPadding
; SymCryptRsaPkcs1ApplySignaturePadding
; SymCryptRsaPkcs1VerifySignaturePadding
; SymCryptRsaPssApplySignaturePadding
; SymCryptRsaPssVerifySignaturePadding
; SymCryptEcurveGroupOrder
; SymCryptEcurveDigitsofScalarMultiplier
; SymCryptEcurveDigitsofFieldElement
; SymCryptEcpointSetValue
; SymCryptEcpointGetValue
; SymCryptEcpointSetZero
; SymCryptEcpointSetDistinguishedPoint
; SymCryptEcpointIsEqual
; SymCryptEcpointIsZero
; SymCryptEcpointOnCurve
; SymCryptEcpointAdd
; SymCryptEcpointAddDiffNonZero
; SymCryptEcpointDouble
; SymCryptEcpointNegate
; SymCryptEcpointSetRandom
; SymCryptEcpointScalarMul
; SymCryptEcpointMultiScalarMul
; SymCryptEcDsaSignEx
; SymCrypt802_11SaeGetGroupSizes
; SymCrypt802_11SaeCustomInit
; SymCrypt802_11SaeCustomCreatePT
; SymCrypt802_11SaeCustomCreatePTGeneric
; SymCrypt802_11SaeCustomInitH2E
; SymCrypt802_11SaeCustomInitH2EGeneric
; SymCrypt802_11SaeCustomCommitCreate
; SymCrypt802_11SaeCustomCommitCreateGeneric
; SymCrypt802_11SaeCustomCommitProcess
; SymCrypt802_11SaeCustomCommitProcessGeneric
; SymCrypt802_11SaeCustomDestroy
SymCryptFipsGetSelftestsPerformed
SymCryptDeprecatedStatusIndicator
SymCryptEntropyAccumulatorInit0
SymCryptEntropyAccumulatorInit1
SymCryptEntropyAccumulatorAccumulateSample
SymCryptEntropyAccumulatorGlobalInitFromRegistry
SymCryptEntropyAccumulatorGlobalSetCallbackProvideEntropyFn
SymCryptFipsGetSelftestsPerformed
SymCryptModuleInit

Просмотреть файл

@ -47,7 +47,6 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_WINDOWS;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>..\..\..\inc;..\..\..\lib;</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:strictStrings- %(AdditionalOptions)</AdditionalOptions>
<WholeProgramOptimization>true</WholeProgramOptimization>
@ -66,13 +65,13 @@
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="main.c" />
<ClCompile Include="module.c" />
<ClCompile Include="entropy_accumulator.c" />
</ItemGroup>
<!-- Default properties for ResourceCompile in case they're not set -->
<PropertyGroup>
<VER_BUILD_ID Condition="'$(VER_BUILD_ID)' == ''">0</VER_BUILD_ID>
<VER_SUFFIX Condition="'$(VER_SUFFIX)' == ''">-private</VER_SUFFIX>
<VER_SUFFIX Condition="'$(VER_SUFFIX)' == ''">private</VER_SUFFIX>
</PropertyGroup>
<ItemGroup>
<ResourceCompile Include="symcryptk.rc">
@ -80,7 +79,7 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="symcrypt.def" />
<None Include="symcryptk.def" />
</ItemGroup>
<PropertyGroup>
<!--

Просмотреть файл

@ -0,0 +1,18 @@
set(SOURCES
module.c
symcrypt.def
symcrypt.rc)
include_directories(${CMAKE_SOURCE_DIR}/inc)
add_library(symcrypt_usermode_dll SHARED ${SOURCES})
target_link_libraries(symcrypt_usermode_dll symcrypt_usermodewin8_1 bcrypt.lib ntdll.lib)
add_dependencies(symcrypt_usermode_dll symcrypt_usermodewin8_1)
set_target_properties(symcrypt_usermode_dll PROPERTIES
OUTPUT_NAME "symcrypt"
PREFIX ""
SUFFIX ".dll"
IMPORT_SUFFIX ".lib")

Просмотреть файл

@ -0,0 +1,188 @@
//
// module.c
// Main file for SymCrypt Windows user-mode module, symcrypt.dll
//
// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
//
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
// Ensure that windows.h doesn't re-define the status_* symbols
#define WIN32_NO_STATUS
#include <windows.h>
#include <windef.h>
#include <bcrypt.h>
#include <symcrypt.h>
#include <symcrypt_low_level.h>
SYMCRYPT_ENVIRONMENT_WINDOWS_USERMODE_LATEST;
#define SYMCRYPT_FIPS_STATUS_INDICATOR
#include "../modules/statusindicator_common.h"
#include "../lib/status_indicator.h"
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
VOID
PerformStartupAlgorithmSelftests()
{
SymCrypt3DesSelftest();
SymCryptAesSelftest( SYMCRYPT_AES_SELFTEST_ALL );
SymCryptAesCmacSelftest();
SymCryptCcmSelftest();
SymCryptGcmSelftest();
SymCryptXtsAesSelftest();
SymCryptHmacSha1Selftest();
SymCryptHmacSha256Selftest();
SymCryptHmacSha384Selftest();
SymCryptHmacSha512Selftest();
SymCryptParallelSha256Selftest();
SymCryptParallelSha512Selftest();
SymCryptTlsPrf1_1SelfTest();
SymCryptTlsPrf1_2SelfTest();
SymCryptHkdfSelfTest();
SymCryptSp800_108_HmacSha1SelfTest();
SymCryptSp800_108_HmacSha256SelfTest();
SymCryptSp800_108_HmacSha384SelfTest();
SymCryptSp800_108_HmacSha512SelfTest();
SymCryptPbkdf2_HmacSha1SelfTest();
SymCryptSrtpKdfSelfTest();
SymCryptSshKdfSha256SelfTest();
SymCryptSshKdfSha512SelfTest();
SymCryptHmacSha3_256Selftest();
g_SymCryptFipsSelftestsPerformed |= SYMCRYPT_SELFTEST_ALGORITHM_STARTUP;
}
BOOL
WINAPI
DllMain(
_In_ HINSTANCE instance,
_In_ DWORD reason,
_In_ PVOID reserved)
{
UNREFERENCED_PARAMETER( reserved );
HMODULE hDummy = NULL;
if( reason == DLL_PROCESS_ATTACH )
{
DisableThreadLibraryCalls(instance);
// Take a reference to our own module so that we can't be unloaded. We don't want to be unloaded
// and reloaded, because this would cause the FIPS selftests to run repeatedly, which is expensive.
// Being unloaded can also cause problems in VTL1. Failure here is not fatal, though.
GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN,
(LPCWSTR) &DllMain,
&hDummy );
SymCryptInit();
// TODO: We should only run these selftests once per boot, when the first process loads the DLL
if( SYMCRYPT_DO_FIPS_SELFTESTS )
{
PerformStartupAlgorithmSelftests();
}
}
return TRUE;
}
PVOID
SYMCRYPT_CALL
SymCryptCallbackAlloc( SIZE_T nBytes )
{
return _aligned_malloc( nBytes, SYMCRYPT_ASYM_ALIGN_VALUE );
}
VOID
SYMCRYPT_CALL
SymCryptCallbackFree(PVOID ptr)
{
_aligned_free( ptr );
}
VOID
SYMCRYPT_CALL
SymCryptProvideEntropy(
_In_reads_(cbEntropy) PCBYTE pbEntropy,
SIZE_T cbEntropy )
{
UNREFERENCED_PARAMETER(pbEntropy);
UNREFERENCED_PARAMETER(cbEntropy);
}
VOID
SYMCRYPT_CALL
SymCryptRandom(
_Out_writes_bytes_( cbBuffer ) PBYTE pbBuffer,
SIZE_T cbBuffer )
{
NTSTATUS status = BCryptGenRandom( BCRYPT_RNG_ALG_HANDLE, pbBuffer, (ULONG) cbBuffer, 0 );
if (!NT_SUCCESS(status))
{
SymCryptFatal(status);
}
}
SYMCRYPT_ERROR
SYMCRYPT_CALL
SymCryptCallbackRandom(
_Out_writes_bytes_( cbBuffer ) PBYTE pbBuffer,
SIZE_T cbBuffer )
{
NTSTATUS status = BCryptGenRandom( BCRYPT_RNG_ALG_HANDLE, pbBuffer, (ULONG) cbBuffer, 0 );
return NT_SUCCESS( status ) ? SYMCRYPT_NO_ERROR : SYMCRYPT_EXTERNAL_FAILURE;
}
PVOID
SYMCRYPT_CALL
SymCryptCallbackAllocateMutexFastInproc()
{
LPCRITICAL_SECTION lpCriticalSection = malloc( sizeof(CRITICAL_SECTION) );
InitializeCriticalSection(lpCriticalSection);
return (PVOID)lpCriticalSection;
}
VOID
SYMCRYPT_CALL
SymCryptCallbackFreeMutexFastInproc( PVOID pMutex )
{
LPCRITICAL_SECTION lpCriticalSection = (LPCRITICAL_SECTION)pMutex;
DeleteCriticalSection(lpCriticalSection);
free(lpCriticalSection);
}
VOID
SYMCRYPT_CALL
SymCryptCallbackAcquireMutexFastInproc( PVOID pMutex )
{
EnterCriticalSection( (LPCRITICAL_SECTION) pMutex );
}
VOID
SYMCRYPT_CALL
SymCryptCallbackReleaseMutexFastInproc( PVOID pMutex )
{
LeaveCriticalSection( (LPCRITICAL_SECTION) pMutex );
}
VOID SYMCRYPT_CALL SymCryptModuleInit( UINT32 api, UINT32 minor )
{
if (api != SYMCRYPT_CODE_VERSION_API ||
(api == SYMCRYPT_CODE_VERSION_API && minor > SYMCRYPT_CODE_VERSION_MINOR) )
{
SymCryptFatal( 'vers' );
}
}

Просмотреть файл

@ -0,0 +1,525 @@
NAME symcrypt.dll
EXPORTS
SymCrypt3DesBlockCipher
SymCrypt3DesCbcDecrypt
SymCrypt3DesCbcEncrypt
SymCrypt3DesDecrypt
SymCrypt3DesEncrypt
SymCrypt3DesExpandKey
SymCrypt3DesSelftest
SymCryptAesBlockCipher
SymCryptAesCbcDecrypt
SymCryptAesCbcEncrypt
SymCryptAesCbcMac
SymCryptAesCmac
SymCryptAesCmacAlgorithm
SymCryptAesCmacAppend
SymCryptAesCmacExpandKey
SymCryptAesCmacInit
SymCryptAesCmacKeyCopy
SymCryptAesCmacResult
SymCryptAesCmacSelftest
SymCryptAesCmacStateCopy
SymCryptAesCtrMsb64
SymCryptAesDecrypt
SymCryptAesEcbDecrypt
SymCryptAesEcbEncrypt
SymCryptAesEncrypt
SymCryptAesExpandKey
SymCryptAesExpandKeyEncryptOnly
SymCryptAesKeyCopy
SymCryptAesSelftest
SymCryptCbcDecrypt
SymCryptCbcEncrypt
SymCryptCbcMac
SymCryptCcmDecrypt
SymCryptCcmDecryptFinal
SymCryptCcmDecryptPart
SymCryptCcmEncrypt
SymCryptCcmEncryptFinal
SymCryptCcmEncryptPart
SymCryptCcmInit
SymCryptCcmSelftest
SymCryptCcmValidateParameters
SymCryptCfbDecrypt
SymCryptCfbEncrypt
SymCryptChaCha20Crypt
SymCryptChaCha20Init
SymCryptChaCha20Poly1305Decrypt
SymCryptChaCha20Poly1305Encrypt
SymCryptChaCha20Poly1305Selftest
SymCryptChaCha20Selftest
SymCryptChaCha20SetOffset
SymCryptCShake128
SymCryptCShake128Append
SymCryptCShake128Extract
SymCryptCShake128Init
SymCryptCShake128Result
SymCryptCShake128Selftest
SymCryptCShake128StateCopy
SymCryptCShake256
SymCryptCShake256Append
SymCryptCShake256Extract
SymCryptCShake256Init
SymCryptCShake256Result
SymCryptCShake256Selftest
SymCryptCShake256StateCopy
SymCryptCtrMsb64
SymCryptDeprecatedStatusIndicator
SymCryptDesBlockCipher
SymCryptDesDecrypt
SymCryptDesEncrypt
SymCryptDesExpandKey
SymCryptDesSelftest
SymCryptDesxBlockCipher
SymCryptDesxDecrypt
SymCryptDesxEncrypt
SymCryptDesxExpandKey
SymCryptDesxSelftest
SymCryptDhSecretAgreement
SymCryptDhSecretAgreementSelftest
SymCryptDlgroupAllocate
SymCryptDlgroupCopy
SymCryptDlgroupCreate
SymCryptDlgroupFree
SymCryptDlgroupGenerate
SymCryptDlgroupGetSizes
SymCryptDlgroupGetValue
SymCryptDlgroupIsSame
SymCryptDlgroupSetValue
SymCryptDlgroupSetValueSafePrime
SymCryptDlgroupWipe
SymCryptDlkeyAllocate
SymCryptDlkeyCopy
SymCryptDlkeyCreate
SymCryptDlkeyExtendKeyUsage
SymCryptDlkeyFree
SymCryptDlkeyGenerate
SymCryptDlkeyGetGroup
SymCryptDlkeyGetValue
SymCryptDlkeyHasPrivateKey
SymCryptDlkeySetPrivateKeyLength
SymCryptDlkeySetValue
SymCryptDlkeySizeofPrivateKey
SymCryptDlkeySizeofPublicKey
SymCryptDlkeyWipe
SymCryptDsaSelftest
SymCryptDsaSign
SymCryptDsaVerify
SymCryptEcbDecrypt
SymCryptEcbEncrypt
SymCryptEcDhSecretAgreement
SymCryptEcDhSecretAgreementSelftest
SymCryptEcDsaSelftest
SymCryptEcDsaSign
SymCryptEcDsaVerify
SymCryptEckeyAllocate
SymCryptEckeyCopy
SymCryptEckeyCreate
SymCryptEckeyExtendKeyUsage
SymCryptEckeyFree
SymCryptEckeyGetValue
SymCryptEckeyHasPrivateKey
SymCryptEckeySetRandom
SymCryptEckeySetValue
SymCryptEckeySizeofPrivateKey
SymCryptEckeySizeofPublicKey
SymCryptEckeyWipe
SymCryptEcurveAllocate
SymCryptEcurveBitsizeofFieldModulus
SymCryptEcurveBitsizeofGroupOrder
SymCryptEcurveFree
SymCryptEcurveHighBitRestrictionNumOfBits
SymCryptEcurveHighBitRestrictionPosition
SymCryptEcurveHighBitRestrictionValue
SymCryptEcurveIsSame
SymCryptEcurveParamsCurve25519
SymCryptEcurveParamsNistP192
SymCryptEcurveParamsNistP224
SymCryptEcurveParamsNistP256
SymCryptEcurveParamsNistP384
SymCryptEcurveParamsNistP521
SymCryptEcurveParamsNumsP256t1
SymCryptEcurveParamsNumsP384t1
SymCryptEcurveParamsNumsP512t1
SymCryptEcurvePrivateKeyDefaultFormat
SymCryptEcurveSizeofFieldElement
SymCryptEcurveSizeofScalarMultiplier
SymCryptEqual
SymCryptFipsGetSelftestsPerformed
SymCryptGcmAuthPart
SymCryptGcmDecrypt
SymCryptGcmDecryptFinal
SymCryptGcmDecryptPart
SymCryptGcmEncrypt
SymCryptGcmEncryptFinal
SymCryptGcmEncryptPart
SymCryptGcmExpandKey
SymCryptGcmInit
SymCryptGcmKeyCopy
SymCryptGcmSelftest
SymCryptGcmStateCopy
SymCryptGcmValidateParameters
SymCryptHash
SymCryptHashAppend
SymCryptHashInit
SymCryptHashInputBlockSize
SymCryptHashResult
SymCryptHashResultSize
SymCryptHashStateSize
SymCryptHkdf
SymCryptHkdfDerive
SymCryptHkdfExpandKey
SymCryptHkdfExtractPrk
SymCryptHkdfPrkExpandKey
SymCryptHkdfSelfTest
SymCryptHmacMd5
SymCryptHmacMd5Algorithm
SymCryptHmacMd5Append
SymCryptHmacMd5ExpandKey
SymCryptHmacMd5Init
SymCryptHmacMd5KeyCopy
SymCryptHmacMd5Result
SymCryptHmacMd5Selftest
SymCryptHmacMd5StateCopy
SymCryptHmacSha1
SymCryptHmacSha1Algorithm
SymCryptHmacSha1Append
SymCryptHmacSha1ExpandKey
SymCryptHmacSha1Init
SymCryptHmacSha1KeyCopy
SymCryptHmacSha1Result
SymCryptHmacSha1Selftest
SymCryptHmacSha1StateCopy
SymCryptHmacSha256
SymCryptHmacSha256Algorithm
SymCryptHmacSha256Append
SymCryptHmacSha256ExpandKey
SymCryptHmacSha256Init
SymCryptHmacSha256KeyCopy
SymCryptHmacSha256Result
SymCryptHmacSha256Selftest
SymCryptHmacSha256StateCopy
SymCryptHmacSha3_256
SymCryptHmacSha3_256Algorithm
SymCryptHmacSha3_256Append
SymCryptHmacSha3_256ExpandKey
SymCryptHmacSha3_256Init
SymCryptHmacSha3_256KeyCopy
SymCryptHmacSha3_256Result
SymCryptHmacSha3_256Selftest
SymCryptHmacSha3_256StateCopy
SymCryptHmacSha3_384
SymCryptHmacSha3_384Algorithm
SymCryptHmacSha3_384Append
SymCryptHmacSha3_384ExpandKey
SymCryptHmacSha3_384Init
SymCryptHmacSha3_384KeyCopy
SymCryptHmacSha3_384Result
SymCryptHmacSha3_384Selftest
SymCryptHmacSha3_384StateCopy
SymCryptHmacSha3_512
SymCryptHmacSha3_512Algorithm
SymCryptHmacSha3_512Append
SymCryptHmacSha3_512ExpandKey
SymCryptHmacSha3_512Init
SymCryptHmacSha3_512KeyCopy
SymCryptHmacSha3_512Result
SymCryptHmacSha3_512Selftest
SymCryptHmacSha3_512StateCopy
SymCryptHmacSha384
SymCryptHmacSha384Algorithm
SymCryptHmacSha384Append
SymCryptHmacSha384ExpandKey
SymCryptHmacSha384Init
SymCryptHmacSha384KeyCopy
SymCryptHmacSha384Result
SymCryptHmacSha384Selftest
SymCryptHmacSha384StateCopy
SymCryptHmacSha512
SymCryptHmacSha512Algorithm
SymCryptHmacSha512Append
SymCryptHmacSha512ExpandKey
SymCryptHmacSha512Init
SymCryptHmacSha512KeyCopy
SymCryptHmacSha512Result
SymCryptHmacSha512Selftest
SymCryptHmacSha512StateCopy
SymCryptKmac128
SymCryptKmac128Algorithm
SymCryptKmac128Append
SymCryptKmac128Ex
SymCryptKmac128ExpandKey
SymCryptKmac128ExpandKeyEx
SymCryptKmac128Extract
SymCryptKmac128Init
SymCryptKmac128KeyCopy
SymCryptKmac128Result
SymCryptKmac128ResultEx
SymCryptKmac128Selftest
SymCryptKmac128StateCopy
SymCryptKmac256
SymCryptKmac256Algorithm
SymCryptKmac256Append
SymCryptKmac256Ex
SymCryptKmac256ExpandKey
SymCryptKmac256ExpandKeyEx
SymCryptKmac256Extract
SymCryptKmac256Init
SymCryptKmac256KeyCopy
SymCryptKmac256Result
SymCryptKmac256ResultEx
SymCryptKmac256Selftest
SymCryptKmac256StateCopy
SymCryptLoadLsbFirstUint32
SymCryptLoadLsbFirstUint64
SymCryptLoadMsbFirstUint32
SymCryptLoadMsbFirstUint64
SymCryptMapUint32
SymCryptMarvin32
SymCryptMarvin32Append
SymCryptMarvin32DefaultSeed
SymCryptMarvin32ExpandSeed
SymCryptMarvin32Init
SymCryptMarvin32Result
SymCryptMarvin32SeedCopy
SymCryptMarvin32Selftest
SymCryptMarvin32StateCopy
SymCryptMd2
SymCryptMd2Algorithm
SymCryptMd2Append
SymCryptMd2Init
SymCryptMd2Result
SymCryptMd2Selftest
SymCryptMd2StateCopy
SymCryptMd2StateExport
SymCryptMd2StateImport
SymCryptMd4
SymCryptMd4Algorithm
SymCryptMd4Append
SymCryptMd4Init
SymCryptMd4Result
SymCryptMd4Selftest
SymCryptMd4StateCopy
SymCryptMd4StateExport
SymCryptMd4StateImport
SymCryptMd5
SymCryptMd5Algorithm
SymCryptMd5Append
SymCryptMd5Init
SymCryptMd5OidList
SymCryptMd5Result
SymCryptMd5Selftest
SymCryptMd5StateCopy
SymCryptMd5StateExport
SymCryptMd5StateImport
SymCryptModuleInit
SymCryptPaddingPkcs7Add
SymCryptPaddingPkcs7Remove
SymCryptParallelSha256Init
SymCryptParallelSha256Process
SymCryptParallelSha256Selftest
SymCryptParallelSha384Init
SymCryptParallelSha384Process
SymCryptParallelSha384Selftest
SymCryptParallelSha512Init
SymCryptParallelSha512Process
SymCryptParallelSha512Selftest
SymCryptPbkdf2_HmacSha1SelfTest
SymCryptPbkdf2_HmacSha256SelfTest
SymCryptPbkdf2
SymCryptPbkdf2Derive
SymCryptPbkdf2ExpandKey
SymCryptPoly1305
SymCryptPoly1305Append
SymCryptPoly1305Init
SymCryptPoly1305Result
SymCryptPoly1305Selftest
SymCryptProvideEntropy
SymCryptRandom
SymCryptRc2BlockCipher
SymCryptRc2Decrypt
SymCryptRc2Encrypt
SymCryptRc2ExpandKey
SymCryptRc2ExpandKeyEx
SymCryptRc2Selftest
SymCryptRc4Crypt
SymCryptRc4Init
SymCryptRc4Selftest
SymCryptRngAesFips140_2Generate
SymCryptRngAesFips140_2Instantiate
SymCryptRngAesFips140_2Reseed
SymCryptRngAesFips140_2Uninstantiate
SymCryptRngAesGenerate
SymCryptRngAesGenerateSelftest
SymCryptRngAesInstantiate
SymCryptRngAesInstantiateSelftest
SymCryptRngAesReseed
SymCryptRngAesReseedSelftest
SymCryptRngAesUninstantiate
SymCryptRsakeyAllocate
SymCryptRsakeyCreate
SymCryptRsakeyExtendKeyUsage
SymCryptRsakeyFree
SymCryptRsakeyGenerate
SymCryptRsakeyGetCrtValue
SymCryptRsakeyGetNumberOfPrimes
SymCryptRsakeyGetNumberOfPublicExponents
SymCryptRsakeyGetValue
SymCryptRsakeyHasPrivateKey
SymCryptRsakeyModulusBits
SymCryptRsakeySetValue
SymCryptRsakeySizeofModulus
SymCryptRsakeySizeofPrime
SymCryptRsakeySizeofPublicExponent
SymCryptRsakeyWipe
SymCryptRsaOaepDecrypt
SymCryptRsaOaepEncrypt
SymCryptRsaPkcs1Decrypt
SymCryptRsaPkcs1Encrypt
SymCryptRsaPkcs1Sign
SymCryptRsaPkcs1Verify
SymCryptRsaPssSign
SymCryptRsaPssVerify
SymCryptRsaRawDecrypt
SymCryptRsaRawEncrypt
SymCryptRsaSelftest
SymCryptSessionDestroy
SymCryptSessionGcmDecrypt
SymCryptSessionGcmEncrypt
SymCryptSessionReceiverInit
SymCryptSessionSenderInit
SymCryptSha1
SymCryptSha1Algorithm
SymCryptSha1Append
SymCryptSha1Init
SymCryptSha1OidList
SymCryptSha1Result
SymCryptSha1Selftest
SymCryptSha1StateCopy
SymCryptSha1StateExport
SymCryptSha1StateImport
SymCryptSha256
SymCryptSha256Algorithm
SymCryptSha256Append
SymCryptSha256Init
SymCryptSha256OidList
SymCryptSha256Result
SymCryptSha256Selftest
SymCryptSha256StateCopy
SymCryptSha256StateExport
SymCryptSha256StateImport
SymCryptSha3_256
SymCryptSha3_256Algorithm
SymCryptSha3_256Append
SymCryptSha3_256Init
SymCryptSha3_256OidList
SymCryptSha3_256Result
SymCryptSha3_256StateCopy
SymCryptSha3_256StateExport
SymCryptSha3_256StateImport
SymCryptSha3_384
SymCryptSha3_384Algorithm
SymCryptSha3_384Append
SymCryptSha3_384Init
SymCryptSha3_384OidList
SymCryptSha3_384Result
SymCryptSha3_384StateCopy
SymCryptSha3_384StateExport
SymCryptSha3_384StateImport
SymCryptSha3_512
SymCryptSha3_512Algorithm
SymCryptSha3_512Append
SymCryptSha3_512Init
SymCryptSha3_512OidList
SymCryptSha3_512Result
SymCryptSha3_512StateCopy
SymCryptSha3_512StateExport
SymCryptSha3_512StateImport
SymCryptSha384
SymCryptSha384Algorithm
SymCryptSha384Append
SymCryptSha384Init
SymCryptSha384OidList
SymCryptSha384Result
SymCryptSha384Selftest
SymCryptSha384StateCopy
SymCryptSha384StateExport
SymCryptSha384StateImport
SymCryptSha512
SymCryptSha512Algorithm
SymCryptSha512Append
SymCryptSha512Init
SymCryptSha512OidList
SymCryptSha512Result
SymCryptSha512Selftest
SymCryptSha512StateCopy
SymCryptSha512StateExport
SymCryptSha512StateImport
SymCryptShake128
SymCryptShake128Append
SymCryptShake128Default
SymCryptShake128Extract
SymCryptShake128HashAlgorithm
SymCryptShake128Init
SymCryptShake128Result
SymCryptShake128Selftest
SymCryptShake128StateCopy
SymCryptShake256
SymCryptShake256Append
SymCryptShake256Default
SymCryptShake256Extract
SymCryptShake256HashAlgorithm
SymCryptShake256Init
SymCryptShake256Result
SymCryptShake256Selftest
SymCryptShake256StateCopy
SymCryptSizeofDlgroupFromBitsizes
SymCryptSizeofDlkeyFromDlgroup
SymCryptSizeofEckeyFromCurve
SymCryptSizeofRsakeyFromParams
SymCryptSp800_108_HmacSha1SelfTest
SymCryptSp800_108_HmacSha256SelfTest
SymCryptSp800_108_HmacSha384SelfTest
SymCryptSp800_108_HmacSha512SelfTest
SymCryptSp800_108
SymCryptSp800_108Derive
SymCryptSp800_108ExpandKey
SymCryptSrtpKdf
SymCryptSrtpKdfDerive
SymCryptSrtpKdfExpandKey
SymCryptSrtpKdfSelfTest
SymCryptSshKdf
SymCryptSshKdfDerive
SymCryptSshKdfExpandKey
SymCryptSshKdfSha256SelfTest
SymCryptSshKdfSha512SelfTest
SymCryptStoreLsbFirstUint32
SymCryptStoreLsbFirstUint64
SymCryptStoreMsbFirstUint32
SymCryptStoreMsbFirstUint64
SymCryptTlsCbcHmacVerify
SymCryptTlsPrf1_1
SymCryptTlsPrf1_1Derive
SymCryptTlsPrf1_1ExpandKey
SymCryptTlsPrf1_1SelfTest
SymCryptTlsPrf1_2
SymCryptTlsPrf1_2Derive
SymCryptTlsPrf1_2ExpandKey
SymCryptTlsPrf1_2SelfTest
SymCryptUint32Bitsize
SymCryptUint32Bytesize
SymCryptUint64Bitsize
SymCryptUint64Bytesize
SymCryptWipe
SymCryptWipeKnownSize
SymCryptXorBytes
SymCryptXtsAesDecrypt
SymCryptXtsAesDecryptWith128bTweak
SymCryptXtsAesEncrypt
SymCryptXtsAesEncryptWith128bTweak
SymCryptXtsAesExpandKey
SymCryptXtsAesExpandKeyEx
SymCryptXtsAesKeyCopy
SymCryptXtsAesSelftest

Просмотреть файл

@ -0,0 +1,14 @@
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
#include <windows.h>
#define VER_FILETYPE VFT_DLL
#define VER_FILESUBTYPE VFT2_UNKNOWN
#define VER_ORIGINALFILENAME_STR "symcrypt.dll"
#define VER_FILEDESCRIPTION_STR "Microsoft\256 SymCrypt Dynamic Library"
#define VER_INTERNALNAME_STR "symcrypt"
#include "symcrypt.rc.inc"

Просмотреть файл

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{c75bcb09-00b2-4008-9700-e3b5e7391c69}</ProjectGuid>
<TemplateGuid>{0a049372-4c4d-4ea0-a64e-dc6ad88ceca1}</TemplateGuid>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
<UseInternalMSUniCrtPackage>true</UseInternalMSUniCrtPackage>
<TargetName>symcrypt</TargetName>
<UndockedType>dll</UndockedType>
<UndockedDir>$(SolutionDir)msbuild\</UndockedDir>
<UndockedOut>$(SolutionDir)</UndockedOut>
</PropertyGroup>
<Import Project="$(UndockedDir)symcrypt.undocked.props" />
<ItemGroup>
<ProjectReference Include="..\..\..\lib\symcrypt.vcxproj">
<Project>{7c3bd5d2-7213-4cfa-b6cb-eb41623601bc}</Project>
</ProjectReference>
</ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_WINDOWS;_USRDLL;SYMCRYPT_DO_FIPS_SELFTESTS;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\..\inc;..\..\..\lib;</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:strictStrings- %(AdditionalOptions)</AdditionalOptions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Full</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>symcrypt.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<AdditionalDependencies>%(AdditionalDependencies);ntdll.lib;Bcrypt.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<PropertyGroup Label="DbgEng">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="module.c" />
</ItemGroup>
<!-- Default properties for ResourceCompile in case they're not set -->
<PropertyGroup>
<VER_BUILD_ID Condition="'$(VER_BUILD_ID)' == ''">0</VER_BUILD_ID>
<VER_SUFFIX Condition="'$(VER_SUFFIX)' == ''">private</VER_SUFFIX>
</PropertyGroup>
<ItemGroup>
<ResourceCompile Include="symcrypt.rc">
<PreprocessorDefinitions>VER_BUILD_ID=$(VER_BUILD_ID);VER_SUFFIX=$(VER_SUFFIX);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="symcrypt.def" />
</ItemGroup>
</Project>

Просмотреть файл

@ -24,6 +24,8 @@
C4324: structure was padded due to __declspec(align())
-->
<DisableSpecificWarnings>4456;4296;4324;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<BasicRuntimeChecks></BasicRuntimeChecks>

Просмотреть файл

@ -107,7 +107,7 @@
<!-- Official Windows compiler and linker settings -->
<PropertyGroup>
<IntDir>$(UndockedOut)build\obj\$(WinPlat)$(WinConfig)\$(ProjectName)\</IntDir>
<IntDir>$(UndockedOut)build\obj\$(WinPlat)$(WinConfig)\$(UndockedType)\$(ProjectName)\</IntDir>
<OutDir>$(UndockedOut)build\bin\$(WinPlat)$(WinConfig)\$(UndockedType)\</OutDir>
<UseDebugLibraries Condition="'$(Configuration)'=='Debug'">true</UseDebugLibraries>
<UseDebugLibraries Condition="'$(Configuration)'=='Release'">false</UseDebugLibraries>

Просмотреть файл

@ -23,7 +23,6 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>..\;..\inc;..\lib;..\SymCryptDependencies\inc;..\..\inc;</AdditionalIncludeDirectories>
<!--
Disable warnings

Просмотреть файл

@ -15,7 +15,6 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\;..\inc;..\SymCryptDependencies\inc;..\..\inc;..\..\lib;</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/Zc:strictStrings- /bigobj /wd5252 %(AdditionalOptions)</AdditionalOptions>
<WholeProgramOptimization>true</WholeProgramOptimization>

Просмотреть файл

@ -23,7 +23,6 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_WINDOWS;_USRDLL;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>..\;..\inc;..\lib;..\SymCryptDependencies\inc;..\..\inc;</AdditionalIncludeDirectories>
<!--
Disable warnings

Просмотреть файл

@ -24,7 +24,6 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_WINDOWS;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>..\;..\inc;..\lib;..\SymCryptDependencies\inc;..\..\inc;</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:strictStrings- %(AdditionalOptions)</AdditionalOptions>
<WholeProgramOptimization>true</WholeProgramOptimization>

Просмотреть файл

@ -20,7 +20,6 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_WINDOWS;_USRDLL;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>..\;..\inc;..\lib;..\SymCryptDependencies\inc;..\..\inc;</AdditionalIncludeDirectories>
<!--
Disable warnings