Skip to content

Commit 9b469c1

Browse files
author
ipl_ci
committed
Intel(R) Integrated Performance Primitives Cryptography 2021.12.0
1 parent 1f53a4f commit 9b469c1

File tree

130 files changed

+3804
-1178
lines changed

Some content is hidden

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

130 files changed

+3804
-1178
lines changed

BUILD.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- GCC 11.4
3636
- Clang 9.0
3737
- Clang 12.0
38+
- Clang 16.0
3839
- GNU binutils 2.32
3940
### Windows* OS
4041
- [Common tools](#common-tools)

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
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.12
6+
- Added single-buffer implementation of Leighton-Micali Hash-Based Signatures(LMS) algorithm, verification part.
7+
- Added support of Clang 16.0 compiler for Linux.
8+
- Added examples of AES-GCM Encryption/Decryption usage.
9+
- AES-GCM algorithm with Intel® Advanced Vector Extensions 2 (Intel® AVX2) vector extensions of Intel® AES New Instructions (Intel® AES-NI) was optimized.
10+
511
## Intel(R) IPP Cryptography 2021.11
612
- Minimal supported BoringSSL version was increased to [45cf810d](https://github.com/google/boringssl/archive/45cf810dbdbd767f09f8cb0b0fcccd342c39041f.tar.gz) tag.
713

LICENSE

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -173,62 +173,4 @@
173173
incurred by, or claims asserted against, such Contributor by reason
174174
of your accepting any such warranty or additional liability.
175175

176-
END OF TERMS AND CONDITIONS
177-
178-
APPENDIX: How to apply the Apache License to your work.
179-
180-
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "{}"
182-
replaced with your own identifying information. (Don't include
183-
the brackets!) The text should be enclosed in the appropriate
184-
comment syntax for the file format. We also recommend that a
185-
file or class name and description of purpose be included on the
186-
same "printed page" as the copyright notice for easier
187-
identification within third-party archives.
188-
189-
Copyright {yyyy} {name of copyright owner}
190-
191-
Licensed under the Apache License, Version 2.0 (the "License");
192-
you may not use this file except in compliance with the License.
193-
You may obtain a copy of the License at
194-
195-
http://www.apache.org/licenses/LICENSE-2.0
196-
197-
Unless required by applicable law or agreed to in writing, software
198-
distributed under the License is distributed on an "AS IS" BASIS,
199-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200-
See the License for the specific language governing permissions and
201-
limitations under the License.
202-
203-
CMake
204-
------------------------------
205-
CMake - Cross Platform Makefile Generator
206-
Copyright 2000-2021 Kitware, Inc. and Contributors
207-
All rights reserved.
208-
209-
Redistribution and use in source and binary forms, with or without
210-
modification, are permitted provided that the following conditions
211-
are met:
212-
213-
* Redistributions of source code must retain the above copyright
214-
notice, this list of conditions and the following disclaimer.
215-
216-
* Redistributions in binary form must reproduce the above copyright
217-
notice, this list of conditions and the following disclaimer in the
218-
documentation and/or other materials provided with the distribution.
219-
220-
* Neither the name of Kitware, Inc. nor the names of Contributors
221-
may be used to endorse or promote products derived from this
222-
software without specific prior written permission.
223-
224-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
225-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
226-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
227-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
228-
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
229-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
230-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
232-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
233-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
234-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
176+
END OF TERMS AND CONDITIONS

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The library provides a comprehensive set of routines commonly used for cryptogra
2626
- Finite Field Arithmetic Functions
2727
- Big Number Integer Arithmetic Functions
2828
- PRNG/TRNG and Prime Numbers Generation
29+
- Hash-based signature algorithms
2930

3031
## Reasons to Use Intel IPP Cryptography
3132
- Security (constant-time execution for secret processing functions)

README_FIPS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ In general, software may be certified at up to level 2.
2525

2626
Intel® Integrated Performance Primitives Cryptography (Intel(R) IPP Cryptography)
2727
provides building blocks of FIPS-mode API (such as self-tests, FIPS-approved
28-
functionality status query) which can help the end users to fullfill FIPS level 1 requirements.
28+
functionality status query) which can help the end users to fulfill FIPS level 1 requirements.
2929
Please, refer to [Covered Algorithms](#covered-algorithms) section for the full
3030
list of FIPS-Approved API which are covered with the selftests.
3131

@@ -41,7 +41,7 @@ Intel(R) IPP Cryptography may be built in FIPS-mode with IPPCP_FIPS_MODE=on
4141
configuration for ippcp and MBX_FIPS_MODE=on for crypto_MB (see details in [Build section](#build)).
4242

4343
Application, which uses Intel(R) IPP Cryptography may be **FIPS-Certified** by
44-
matching FIPS 140 requirement and obtaining NIST sertificate or also be **FIPS-Compliant** for their own customers.
44+
matching FIPS 140 requirement and obtaining NIST certificate or also be **FIPS-Compliant** for their own customers.
4545

4646
Please, refer to [Level 1 Specific Requirements](#level-1-specific-requirements)
4747
for the detailed description of what is done on Intel(R) IPP Cryptography-side
@@ -59,7 +59,7 @@ and what should be done by a more high-level application.
5959
| 6 | Run pairwise consistency selftest for newly generated RSA/ECC keypair | Intel(R) IPP Cryptography provides [fips_selftest_ippcp<algorithm name> API](#covered-algorithms) to run selftests |
6060
| 7 | Module to guarantee uniqueness of GSM key + IV | **User's application effort required** |
6161
| 8 | Module to guarantee XTS key1 != key2 | Intel(R) IPP Cryptography-side check |
62-
| 9 | (non-production) Extract raw noise source output samples of RBG for quality analysis | DBRNG is currenty out of the cryptography boundary |
62+
| 9 | (non-production) Extract raw noise source output samples of RBG for quality analysis | DBRNG is currently out of the cryptography boundary |
6363
| 10| (non-production) Run crypto algorithm testing with NIST-generated vectors | Done offline by Intel(R) IPP Cryptography for the [covered algorithms](#covered-algorithms) |
6464

6565
For the implementation details about the steps in [Level 1 Specific Requirements](#level-1-specific-requirements)
@@ -107,7 +107,7 @@ Configuration example for ippcp with Intel® C++ Compiler:
107107

108108
`CC=icc CXX=icpc cmake CMakeLists.txt -B_build -DARCH=intel64 -DIPPCP_FIPS_MODE:BOOL=on[-DIPPCP_SELFTEST_USE_MALLOC:BOOL=on]`
109109

110-
> Note: selftests with intenal memory allocation uses malloc, which introduces
110+
> Note: selftests with internal memory allocation uses malloc, which introduces
111111
a c runtime dependency.
112112
To avoid the dependency, use IPPCP_SELFTEST_USE_MALLOC:BOOL=off or do not specify
113113
it as this as the default. In this case, all self-tests will require external memory allocation.
@@ -186,7 +186,7 @@ mbx_nistp256_ecdh_mb8(sharedBA, prvB, pubAx, pubAy, pubAz_curr, 0);
186186
#### Intel(R) IPP Cryptography
187187

188188
Each API from the list is covered with the selftest fips_selftest_ipps<API_name>
189-
availible in Intel(R) IPP Cryptography build in FIPS mode.
189+
available in Intel(R) IPP Cryptography build in FIPS mode.
190190

191191
##### AES
192192

-51.6 KB
Loading

examples/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020

2121
# List of examples for targets generation
2222
set(IPPCP_EXAMPLES
23-
# AES examples
23+
# AES-CTR examples
2424
aes/aes-256-ctr-encryption.cpp
2525
aes/aes-256-ctr-decryption.cpp
26+
# AES-GCM examples
27+
aes/aes-128-gcm-encryption.cpp
28+
aes/aes-128-gcm-decryption.cpp
2629
# DSA
2730
dsa/dsa-dlp-sha-1-verification.cpp
2831
dsa/dsa-dlp-sha-256-verification.cpp
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
/*************************************************************************
2+
* Copyright (C) 2024 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 AES Galois Counter mode of operation (GCM) example
22+
*
23+
* This example demonstrates usage of AES block cipher with 128-bit key
24+
* run with GCM mode of operation. Decryption scheme.
25+
*
26+
* The GCM mode of operation is implemented according to the
27+
* "NIST Special Publication 800-38D: Recommendation for Block Cipher Modes of
28+
* Operation: Galois/Counter Mode (GCM) and GMAC" document:
29+
*
30+
* https://csrc.nist.gov/pubs/sp/800/38/d/final
31+
*
32+
*/
33+
34+
#include <cstring>
35+
36+
#include "ippcp.h"
37+
#include "examples_common.h"
38+
39+
/*! Key size in bytes */
40+
static const int KEY_SIZE = 16;
41+
42+
/*! Message size in bytes */
43+
static const int MSG_LEN = 60;
44+
45+
/*! Initialization vector size in bytes */
46+
static const int IV_LEN = 12;
47+
48+
/*! Tag size in bytes */
49+
static const int TAG_LEN = 16;
50+
51+
/*! Additional authenticated data size in bytes */
52+
static const int AAD_LEN = 20;
53+
54+
/*! 128-bit secret key */
55+
static Ipp8u key128[KEY_SIZE] = {
56+
0xfe,0xff,0xe9,0x92,0x86,0x65,0x73,0x1c,
57+
0x6d,0x6a,0x8f,0x94,0x67,0x30,0x83,0x08
58+
};
59+
60+
/*! Initialization vector */
61+
static const Ipp8u iv[IV_LEN] = {
62+
0xca,0xfe,0xba,0xbe,0xfa,0xce,0xdb,0xad,
63+
0xde,0xca,0xf8,0x88
64+
};
65+
66+
/*! Plain text */
67+
static Ipp8u plainText[MSG_LEN] = {
68+
0xd9,0x31,0x32,0x25,0xf8,0x84,0x06,0xe5,
69+
0xa5,0x59,0x09,0xc5,0xaf,0xf5,0x26,0x9a,
70+
0x86,0xa7,0xa9,0x53,0x15,0x34,0xf7,0xda,
71+
0x2e,0x4c,0x30,0x3d,0x8a,0x31,0x8a,0x72,
72+
0x1c,0x3c,0x0c,0x95,0x95,0x68,0x09,0x53,
73+
0x2f,0xcf,0x0e,0x24,0x49,0xa6,0xb5,0x25,
74+
0xb1,0x6a,0xed,0xf5,0xaa,0x0d,0xe6,0x57,
75+
0xba,0x63,0x7b,0x39
76+
};
77+
78+
/*! Cipher text */
79+
static Ipp8u cipherText[MSG_LEN] = {
80+
0x42,0x83,0x1e,0xc2,0x21,0x77,0x74,0x24,
81+
0x4b,0x72,0x21,0xb7,0x84,0xd0,0xd4,0x9c,
82+
0xe3,0xaa,0x21,0x2f,0x2c,0x02,0xa4,0xe0,
83+
0x35,0xc1,0x7e,0x23,0x29,0xac,0xa1,0x2e,
84+
0x21,0xd5,0x14,0xb2,0x54,0x66,0x93,0x1c,
85+
0x7d,0x8f,0x6a,0x5a,0xac,0x84,0xaa,0x05,
86+
0x1b,0xa3,0x0b,0x39,0x6a,0x0a,0xac,0x97,
87+
0x3d,0x58,0xe0,0x91
88+
};
89+
90+
/*! Tag */
91+
static const Ipp8u tag[TAG_LEN] = {
92+
0x5b,0xc9,0x4f,0xbc,0x32,0x21,0xa5,0xdb,
93+
0x94,0xfa,0xe9,0x5a,0xe7,0x12,0x1a,0x47
94+
};
95+
96+
/*! Additional authenticated data */
97+
static const Ipp8u aad[AAD_LEN] = {
98+
0xfe,0xed,0xfa,0xce,0xde,0xad,0xbe,0xef,
99+
0xfe,0xed,0xfa,0xce,0xde,0xad,0xbe,0xef,
100+
0xab,0xad,0xda,0xd2
101+
};
102+
103+
/*! Main function */
104+
int main(void)
105+
{
106+
/* Size of AES-GCM context structure. It will be set up in ippsAES_GCMGetSize(). */
107+
int AESGCMSize = 0;
108+
109+
/* Output plain text */
110+
Ipp8u pOutPlainText[MSG_LEN] = {};
111+
/* Output tag */
112+
Ipp8u pOutTag[TAG_LEN] = {};
113+
114+
/* Pointer to AES-GCM context structure */
115+
IppsAES_GCMState* pAESGCMState = 0;
116+
117+
/* Internal function status */
118+
IppStatus status = ippStsNoErr;
119+
120+
do {
121+
/* 1. Get size needed for AES-GCM context structure */
122+
status = ippsAES_GCMGetSize(&AESGCMSize);
123+
if (!checkStatus("ippsAES_GCMGetSize", ippStsNoErr, status))
124+
return status;
125+
126+
/* 2. Allocate memory for AES-GCM context structure */
127+
pAESGCMState = (IppsAES_GCMState*)(new Ipp8u[AESGCMSize]);
128+
if (NULL == pAESGCMState) {
129+
printf("ERROR: Cannot allocate memory (%d bytes) for AES-GCM state\n", AESGCMSize);
130+
return -1;
131+
}
132+
133+
/* 3. Initialize AES-GCM context */
134+
status = ippsAES_GCMInit(key128, KEY_SIZE, pAESGCMState, AESGCMSize);
135+
if (!checkStatus("ippsAES_GCMInit", ippStsNoErr, status))
136+
break;
137+
138+
/* 4. Decryption setup */
139+
status = ippsAES_GCMStart(iv, IV_LEN, aad, AAD_LEN, pAESGCMState);
140+
if (!checkStatus("ippsAES_GCMStart", ippStsNoErr, status))
141+
break;
142+
143+
/* 5.Decryption */
144+
status = ippsAES_GCMDecrypt(cipherText, pOutPlainText, MSG_LEN, pAESGCMState);
145+
if (!checkStatus("ippsAES_GCMDecrypt", ippStsNoErr, status))
146+
break;
147+
148+
/* 6. Get tag */
149+
status = ippsAES_GCMGetTag(pOutTag, TAG_LEN, pAESGCMState);
150+
if (!checkStatus("ippsAES_GCMGetTag", ippStsNoErr, status))
151+
break;
152+
153+
/* Compare output to known answer */
154+
if (0 != memcmp(pOutTag, tag, TAG_LEN)) {
155+
printf("ERROR: Output tag and reference tag do not match\n");
156+
break;
157+
}
158+
if (0 != memcmp(pOutPlainText, plainText, MSG_LEN)) {
159+
printf("ERROR: Decrypted and plain text do not match\n");
160+
break;
161+
}
162+
} while (0);
163+
164+
/* 7. Remove secret and release resources */
165+
ippsAES_GCMReset(pAESGCMState);
166+
if (pAESGCMState)
167+
delete [] (Ipp8u*)pAESGCMState;
168+
169+
PRINT_EXAMPLE_STATUS("ippsAES_GCMDecrypt", "AES-GCM 128 Decryption", !status)
170+
171+
return status;
172+
}

0 commit comments

Comments
 (0)