You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merged PR 7775773: Fix integer truncation issue in 32-bit Linux builds
This change fixes an incorrect implementation of the `SYMCRYPT_MUL32x32TO64` when compiling for 32-bit architectures using gcc or clang. Previously the macro cast the input parameters to `unsigned long`, which is 32 bits on some platforms and 64 bits on others. This resulted in the multiplication truncating the top half of the word. The fix is to cast to UINT64 instead.
Also added 32-bit Linux unit tests to the Azure pipeline so it will be built and tested in our CI builds.
Related work items: #32615192
Copy file name to clipboardExpand all lines: README.md
+38-18Lines changed: 38 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Like any engineering project, SymCrypt is a compromise between conflicting requi
18
18
- Support FIPS 140-2 certification of products using SymCrypt.
19
19
- Provide high assurance in the proper functionality of the library.
20
20
21
-
# Clone the Repo
21
+
# Cloning the Repo
22
22
In some of our Linux modules, SymCrypt uses [Jitterentropy](https://github.com/smuellerDD/jitterentropy-library)
23
23
as a source of FIPS-certifiable entropy. To build these modules, you will need to ensure that the
24
24
jitterentropy-library submodule is also cloned. You can do this by running
@@ -30,36 +30,56 @@ publicly, so this submodule will only be cloneable by Microsoft employees with a
30
30
Azure DevOps repository. If you are external to Microsoft, you can ignore this submodule. It is only used in
31
31
the unit tests and does not change the behavior of the SymCrypt product code.
32
32
33
-
# Build and Test
33
+
# Building
34
+
## Prerequisites
34
35
SymCrypt can be compiled with CMake >= 3.13.0 and Visual Studio 2019 (with Windows 10 SDK version 18362) on Windows
35
-
or gcc 7.4.0 or clang 10.0.0 on Linux. Note that CMake ships with Visual Studio 2019.
36
+
or gcc 7.4.0 or clang 10.0.0 on Linux. Note that CMake ships with Visual Studio 2019; you can use Visual Studio's
37
+
included CMake by setting `$env:PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\;${env:PATH}"`.
36
38
37
-
Python3 is also required for translation of SymCryptAsm, and for building the SymCrypt module with integrity check.
39
+
Python 3 is also required for translation of SymCryptAsm, and for building the SymCrypt module with integrity check.
38
40
The integrity check additionally requires pip and pyelftools: `pip3 install -r ./scripts/requirements.txt`
39
41
40
-
1. Optionally use CMake from Visual Studio `$env:PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\;${env:PATH}"`
41
-
2. For Microsoft employees building the library internally, to include msbignum and RSA32 implementation benchmarks in the unit tests:
42
+
## Supported Configurations
43
+
SymCrypt has pure C implementations of all supported functionality. These "generic" implementations are designed to
44
+
be portable to various architectures. However, they do not offer optimal performance because they do not take
45
+
advantage of CPU-specific optimizations. To that end, we also have hand-written assembly implementations of
46
+
performance-critical internal functions. Our CMake build scripts do not currently support ASM optimizations on all
47
+
combinations of architectures and platforms; the Build Instructions section below lists some of the currently supported
48
+
combinations, and we're working on adding support for more.
49
+
50
+
The ability to build SymCrypt on any particular platform or architecture, with or without CPU optimizations, does not
51
+
imply that it has been tested for or is actively supported by Microsoft on that platform/architecture. While we make
52
+
every effort to ensure that SymCrypt is reliable, stable and bug-free on every platform we run on, the code in this
53
+
repository is provided *as is*, without warranty of any kind, express or implied, including but not limited to the
54
+
warranties of merchantability, fitness for a particular purpose and noninfringement (see our [LICENSE](./LICENSE)).
55
+
56
+
## Build Instructions
57
+
1. For Microsoft employees building the library internally, to include msbignum and RSA32 implementation benchmarks in the unit tests:
42
58
1. Make sure the SymCryptDependencies submodule is initialized by following the steps above (`git submodule update --init`)
43
-
2. In step 4 below, add the additional cmake argument `-DSYMCRYPT_INTERNAL_BUILD=1`
44
-
3.`mkdir bin; cd bin`
45
-
4. Configure CMake compilation:
46
-
* For x86 Windows targets: `cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake-toolchain/WindowsUserMode-X86.cmake" -A Win32`
59
+
1. In step 4 below, add the additional cmake argument `-DSYMCRYPT_INTERNAL_BUILD=1`
60
+
1.`mkdir bin; cd bin`
61
+
1. Use the appropriate CMake arguments to specify which architecture you want to compile for:
47
62
* For x86-64 Windows targets: `cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake-toolchain/WindowsUserMode-AMD64.cmake"`
63
+
* For x86 Windows targets: `cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake-toolchain/WindowsUserMode-X86.cmake" -A Win32`
48
64
* For x86-64 Linux targets: `cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake-toolchain/LinuxUserMode-AMD64.cmake"`
65
+
* For x86 Linux targets **no ASM optimizations**: `cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake-toolchain/LinuxUserMode-X86.cmake"`
49
66
* For ARM64 Linux targets: `cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake-toolchain/LinuxUserMode-ARM64.cmake"`
50
-
*For no CPU optimizations: `cmake ..`
67
+
*To use the host system architecture **with no ASM optimizations**: `cmake ..`
51
68
* Optionally, for a release build, specify `-DCMAKE_BUILD_TYPE=Release`
52
-
5.`cmake --build .`
69
+
1.`cmake --build .`
53
70
* Optionally, for a release build on Windows, specify `--config Release`
54
71
* Optionally specify `-jN` where N is the number of processes you wish to spawn for the build
55
72
56
-
If compilation succeeds, the output will be put in the `exe` subdirectory relative to where compilation occurred
57
-
(i.e. `bin/exe` if you followed the instructions above).
73
+
After successful compilation, the generated binaries will be placed in the following directories relative
0 commit comments