Skip to content

Commit f640b4b

Browse files
author
Andrey Marochko
committedDec 9, 2020
#50: Disabled SM algorithms in TpmProfile.h by default, and updated Readme.md.
1 parent 411239d commit f640b4b

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed
 

‎README.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ See the definition of the `SPEC_VERSION`, `SPEC_YEAR` and `SPEC_DAY_OF_YEAR` val
88

99
The reference implementation can be directly used via the [TPM 2.0 simulator](TPMCmd/Simulator) that emulates a TPM 2.0 device and can be accessed via a custom TCP based protocol. The simplest way to work with the simulator is to use a [TSS library](https://github.com/Microsoft/TSS.MSR) for the programming language of your choice - C#/.Net, C++, Java, Python, JavaScript/Node.js are currently supported. The C language TSS implementing the TCG's TSS API specifiaction is available [here](https://github.com/tpm2-software/tpm2-tss).
1010

11-
## Visual Studio build ##
11+
## Windows build ##
1212

13-
Before building the Visual Studio solution:
13+
Windows build is implemented as a Visual Studio 2017 solution. Before building it:
1414

1515
* Setup one or both of the following underlying cryptographic libraries:
1616

@@ -24,7 +24,7 @@ Before building the Visual Studio solution:
2424

2525
2. Create `TPMCmd/OsslInclude/openssl` folder and copy there the contents of the `openssl/include/openssl` folder in the OpenSSL source tree used to build the OpenSSL library.
2626

27-
If you do not disable SM{2,3,4} algorithms support either while building OpenSSL or in the simulator (see the Linux section below), the build may fail because of missing SM{2,3,4}.h headers, which is the result of an apparent bug/misconfiguration in the OpenSSL build tree/scrips. In this case you may also need to copy over the SM{2,3,4}.h headers from OpenSSL’s `include/crypt` folder.
27+
If you enable SM{2,3,4} algorithms in `TpmProfile.h`, the build may fail because of missing `SM{2,3,4}.h` headers. In this case you will need to manually copy them over from OpenSSL’s `include/crypt` folder.
2828

2929
3. Build the solution with either Debug or Release as the active configuration.
3030

@@ -49,7 +49,4 @@ Follows the common `./bootstrap && ./configure && make` convention.
4949

5050
Note that autotools scripts require the following prerequisite packages: `autoconf-archive`, `pkg-config`, and sometimes `build-essential` and `automake`. Their absence is not automatically detected. The build also needs `gcc` and `libssl-dev` packages.
5151

52-
In some Linux configurations linking may fail because of SM{2,3,4} routines missing in the the OpenSSL library. This is a bug in the OpenSSL configuration, as it is supposed to support SM algs since its initial 1.1.1 revision, and when it is built without them, its `opensslconf.h` has to define OPENSSL_NO_SM{2,3,4} macros. However, these macros are (or were) not defined in many official OpenSSL packages (such as libssl-dev). If you have this issue then several options exist:
53-
- Disable SM algorithms in `TpmProfile.h` (set `ALG_SM2`, `ALG_SM3_256`, `ALG_SM4` to `ALG_NO`);
54-
- Manually define `OPENSSL_NO_SM2`, `OPENSSL_NO_SM3`, `OPENSSL_NO_SM4` in `opensslconf.h`;
55-
- Use a custom buit OpenSSL library.
52+
Similarly to the Windows build, if you enable SM{2,3,4} algorithms in `TpmProfile.h`, the build may fail because of missing `SM{2,3,4}.h` headers. In this case you will need to manually copy them over from OpenSSL’s `include/crypt` folder.

‎TPMCmd/tpm/include/TpmProfile.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,13 @@
343343
#define ALG_SHA512 ALG_NO
344344
#endif
345345
#ifndef ALG_SM2
346-
#define ALG_SM2 (ALG_YES && ALG_ECC)
346+
#define ALG_SM2 (ALG_NO && ALG_ECC)
347347
#endif
348348
#ifndef ALG_SM3_256
349-
#define ALG_SM3_256 ALG_YES
349+
#define ALG_SM3_256 ALG_NO
350350
#endif
351351
#ifndef ALG_SM4
352-
#define ALG_SM4 ALG_YES
352+
#define ALG_SM4 ALG_NO
353353
#endif
354354
#ifndef ALG_SYMCIPHER
355355
#define ALG_SYMCIPHER ALG_YES

0 commit comments

Comments
 (0)