Skip to content

Commit 2b8c5c8

Browse files
committed
IPP Crypto 2021.5
1 parent d74cc3b commit 2b8c5c8

File tree

134 files changed

+4622
-4996
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+4622
-4996
lines changed

BUILD.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,30 @@
2929

3030
### Linux* OS
3131
- [Common tools](#common-tools)
32-
- Intel® C++ Compiler 19.1 for Linux\* OS
32+
- Intel® C++ Compiler Classic 2021.3 for Linux\* OS
3333
- GCC 8.3
3434
- GCC 9.1
35+
- GCC 10.1
36+
- GCC 11.1
37+
- Clang 9.0
38+
- Clang 12.0
3539
- GNU binutils 2.32
3640
### Windows* OS
3741
- [Common tools](#common-tools)
38-
- Intel® C++ Compiler 19.1 for Windows\* OS
42+
- Intel® C++ Compiler Classic 2021.3 for Windows\* OS
3943
- Microsoft Visual C++ Compiler\* version 19.16 provided by Microsoft Visual Studio\* 2017 version 15.9
4044
> **NOTE:** Support for this compiler version will be removed from Intel IPP Cryptography starting 2021.4 release. If you use it for building Intel IPP Cryptography library, please plan on migrating to a newer supported version of Microsoft Visual C++ Compiler\*.
4145
- Microsoft Visual C++ Compiler\* version 19.24 provided by Microsoft Visual Studio\* 2019 version 16.4
4246
### macOS*
4347
- [Common tools](#common-tools)
44-
- Intel® C++ Compiler 19.1 for macOS\*
48+
- Intel® C++ Compiler Classic 2021.3 for macOS\*
4549
## Building Intel IPP Cryptography on Linux\* OS
4650

4751
The software was validated on:
4852

4953
- Red Hat\* Enterprise Linux\* 7
5054

51-
To build the Intel IPP Cryptography library on Linux\* OS, complete the following steps:
55+
To build the Intel IPP Cryptography library on Linux\* OS, complete the following steps:
5256
1. Clone the source code from GitHub\* as follows:
5357

5458
``` bash
@@ -117,7 +121,7 @@ To build the Intel IPP Cryptography library on Windows* OS, complete the followi
117121
For Intel® C++ Compiler and Visual Studio\* 2019:
118122

119123
``` bash
120-
cmake CMakeLists.txt -B_build -G"Visual Studio 16 2019" -T"Intel C++ Compiler 19.1" -Ax64
124+
cmake CMakeLists.txt -B_build -G"Visual Studio 16 2019" -T"Intel C++ Compiler 19.2" -Ax64
121125
```
122126

123127
For MSVC\* Compiler and Visual Studio\* 2019:
@@ -143,7 +147,7 @@ To build the Intel IPP Cryptography library on Windows* OS, complete the followi
143147

144148
The software was validated on:
145149

146-
- macOS\* 10.14
150+
- macOS\* 10.15
147151

148152
To build the Intel IPP Cryptography library on macOS*, complete the following steps:
149153

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
This is a list of notable changes to Intel(R) IPP Cryptography, in reverse chronological order.
44

5+
## Intel(R) IPP Cryptography 2021.5
6+
- Bugfixes.
7+
58
## Intel(R) IPP Cryptography 2021.4
69
- Crypto Multi buffer library was extended with ECB, CBC, CTR, OFB and CFB modes of SM4 algorithm.
710
- Crypto Multi buffer library was extended with EC SM2 public key generation, ECDHE and ECDSA (Sign and Verify) algorithms.

THIRD-PARTY-PROGRAMS.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ below.
99

1010
-------------------------------------------------------------
1111

12-
1. Intel(R) Multi-Buffer Crypto for IPsec Library
12+
1. Intel(R) Multi-Buffer Crypto for IPSec Library
1313

1414
Copyright (c) 2012-2021, Intel Corporation
1515

examples/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ set(IPPCP_EXAMPLES
2323
# AES examples
2424
aes/aes-256-ctr-encryption.cpp
2525
aes/aes-256-ctr-decryption.cpp
26+
# DSA
27+
dsa/dsa-dlp-sha-1-verification.cpp
28+
dsa/dsa-dlp-sha-256-verification.cpp
2629
# RSA SSA-PSS examples
2730
rsa/rsa-3k-pss-sha384-type1-signature.cpp
2831
rsa/rsa-1k-pss-sha1-verification.cpp

examples/dsa/categoryOptions.cmake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#===============================================================================
2+
# Copyright 2019-2021 Intel Corporation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#===============================================================================
16+
17+
set(dsa_CATEGORY_COMMON_SOURCES
18+
${CMAKE_CURRENT_SOURCE_DIR}/utils/bignum.cpp
19+
${CMAKE_CURRENT_SOURCE_DIR}/utils/utils.cpp
20+
)
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
/*******************************************************************************
2+
* Copyright 2021 Intel Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
17+
/*!
18+
*
19+
* \file
20+
*
21+
* \brief DSA-DLP verification scheme example
22+
*
23+
* This example demonstrates message verification according to
24+
* DSA-DLP scheme with (L = 1024, N = 160) DSA parameters and SHA-1 hash function.
25+
*
26+
* The DSA-DLP scheme is implemented according : Digital Signature Standard (DSS) (FIPS PUB 186-4) (July 2013)
27+
*
28+
* available at:
29+
*
30+
* http://dx.doi.org/10.6028/NIST.FIPS.186-4.
31+
*
32+
*/
33+
34+
#include <string.h>
35+
36+
#include "bignum.h"
37+
#include "examples_common.h"
38+
#include "ippcp.h"
39+
40+
/*! Parameters DSA-DLP scheme */
41+
static const int L_BIT = 1024;
42+
static const int N_BIT = 160;
43+
44+
/*! Message size in bytes */
45+
static const int MSG_LEN_BYTE = 6;
46+
47+
/*! Message text */
48+
static Ipp8u MSG[MSG_LEN_BYTE] = {0x31, 0x32, 0x33,
49+
0x34, 0x30, 0x30};
50+
51+
/*! The generator of the multiplicative subgroup */
52+
static const BigNumber G(
53+
"0x"
54+
"0835AA8C358BBF01A1846D1206323FABE408B0E98789FCC6239DA14D4B3F86C2"
55+
"76A8F48AA85A59507E620AD1BC745F0F1CBF63EC98C229C2610D77C634D1642E"
56+
"404354771655B2D5662F7A45227178CE3430AF0F6B3BB94B52F7F51E97BAD659"
57+
"B1BA0684E208BE624C28D82FB1162F18DD9DCE45216461654CF3374624D15A8D");
58+
59+
/*! The modulus p */
60+
static const BigNumber P(
61+
"0x"
62+
"B34CE9C1E78294D3258473842005D2A48C8C566CFCA8F84C0606F2529B59A6D3"
63+
"8AAE071B53BB2167EAA4FC3B01FE176E787E481B6037AAC62CBC3D089799536A"
64+
"869FA8CDFEA1E8B1FD2D1CD3A30350859A2CD6B3EC2F9BFBB68BB11B4BBE2ADA"
65+
"A18D64A93639543AE5E16293E311C0CF8C8D6E180DF05D08C2FD2D93D570751F");
66+
67+
/*! The order of the generator g */
68+
static const BigNumber Q("0xB90B38BA0A50A43EC6898D3F9B68049777F489B1");
69+
70+
/*! The public key value */
71+
static const BigNumber Y(
72+
"0x"
73+
"173931DDA31EFF32F24B383091BF77EACDC6EFD557624911D8E9B9DEBF0F256D"
74+
"0CFFAC5567B33F6EAAE9D3275BBED7EF9F5F94C4003C959E49A1ED3F58C31B21"
75+
"BACCC0ED8840B46145F121B8906D072129BAE01F071947997E8EF760D2D9EA21"
76+
"D08A5EB7E89390B21A85664713C549E25FEDA6E9E6C31970866BDFBC8FA981F6");
77+
78+
/*! R digital signature component */
79+
static const BigNumber sigR("0xAA6A258FBF7D90E15614676D377DF8B10E38DB4A");
80+
81+
/*! S digital signature component */
82+
static const BigNumber sigS("0x496D5220B5F67D3532D1F991203BC3523B964C3B");
83+
84+
int main(void) {
85+
/*! Internal function status */
86+
IppStatus status = ippStsNoErr;
87+
88+
/* Pointer to DSA DLP context structure */
89+
IppsDLPState* pDL = NULL;
90+
91+
/* Result verification DSA DLP */
92+
IppDLResult result = ippDLValid;
93+
94+
/* Size of DSA-DLP context structure. It will be set up in ippsDLPGetSize(). */
95+
int DLSize = 0;
96+
97+
/* Digest size */
98+
const int digestSizeBit = IPP_SHA1_DIGEST_BITSIZE;
99+
const int digestSizeByte = digestSizeBit / 8;
100+
/* Pointer to the SHA-1 hash method */
101+
const IppsHashMethod* hashMethod = ippsHashMethod_SHA1();
102+
103+
/*! Algorithm */
104+
do {
105+
/* 1. Create a digest by message */
106+
/*! Buffer create digest */
107+
Ipp8u md[digestSizeByte] = {};
108+
109+
/*! Create digest by message */
110+
status = ippsHashMessage_rmf(MSG,
111+
MSG_LEN_BYTE,
112+
md,
113+
hashMethod);
114+
/*! Check status create digest */
115+
if (ippStsNoErr != status)
116+
break;
117+
118+
/*!
119+
* (!) Allocate BigNumber container for the shrank message digest.
120+
* Note, the DSA algorithm uses only leftmost |minSizeDigestBit| bits of the original message digest
121+
*/
122+
const int minSizeDigestBit = IPP_MIN(N_BIT, digestSizeBit);
123+
BigNumber digest(NULL, bitSizeInWords(minSizeDigestBit));
124+
125+
/*! Set digest to BigNumber */
126+
status = ippsSetOctString_BN(md,
127+
bitSizeInBytes(minSizeDigestBit),
128+
digest);
129+
if (ippStsNoErr != status)
130+
break;
131+
132+
/* 2. Get size needed for DSA DLP context structure */
133+
status = ippsDLPGetSize(L_BIT, N_BIT,
134+
&DLSize);
135+
if (ippStsNoErr != status)
136+
break;
137+
138+
/* 3. Allocate memory for DSA DLP context structure */
139+
pDL = (IppsDLPState*)(new Ipp8u[DLSize]);
140+
if (NULL == pDL) {
141+
printf("ERROR: Cannot allocate memory (%d bytes) for DSA DLP context\n", DLSize);
142+
return -1;
143+
}
144+
145+
/* 4. Initialize DSA DLP context */
146+
status = ippsDLPInit(L_BIT, N_BIT,
147+
pDL);
148+
if (ippStsNoErr != status)
149+
break;
150+
151+
/* 5. Set DL Domain Parameters */
152+
status = ippsDLPSet(P, Q, G, pDL);
153+
if (ippStsNoErr != status)
154+
break;
155+
156+
/* 6. Set up Key Pair into the DL context */
157+
status = ippsDLPSetKeyPair(NULL, /* optional Private Key Set */
158+
Y,
159+
pDL);
160+
if (ippStsNoErr != status)
161+
break;
162+
163+
/* 7. Verify Signature DSA DLP */
164+
status = ippsDLPVerifyDSA(digest,
165+
sigR, sigS,
166+
&result,
167+
pDL);
168+
if (ippStsNoErr != status)
169+
break;
170+
if (ippDLValid != result)
171+
status = ippStsErr;
172+
173+
} while (0); /* end Algorithm */
174+
175+
/* 8. Remove secret and release resources */
176+
if (NULL != pDL)
177+
delete[](Ipp8u*) pDL;
178+
179+
PRINT_EXAMPLE_STATUS("ippsDLPVerifyDSA", "DSA-DLP Verification Hash Method Message SHA-1", ippStsNoErr == status);
180+
181+
return status;
182+
}

0 commit comments

Comments
 (0)