Skip to content

Commit 261c6f3

Browse files
author
ipl_ci
committed
[SB][Library][Fix] Fix shift issue in sha3 kernel
1 parent 5ab2f49 commit 261c6f3

19 files changed

+139
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This is a list of notable changes to Intel® Cryptography Primitives Library, in
77
- Added support for HKDF, Hashed Message Authentication Code (HMAC)-based key derivation function as defined by RFC-5869.
88
- Added key and signature generations for the eXtended Merkle Signature Scheme (XMSS) algorithm.
99
- Minimal supported BoringSSL version was increased to [0.20250114.0](https://github.com/google/boringssl/releases/tag/0.20250114.0) tag.
10+
- Added support for SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE128 and SHAKE256 hash algorithms as defined by FIPS PUB 202.
1011

1112
## Intel(R) Cryptography Primitives Library 1.1.0
1213

doc/source/bibliography.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ to you in using cryptography functions of Intel® Cryptography Primitives Librar
111111
198*. The Key-Hash Message Authentication Code (HMAC), July 2008.
112112
Available from http://csrc.nist.gov/publications/.
113113

114+
115+
.. _fips-pub-202:
116+
117+
[FIPS PUB 202]
118+
*Federal Information Processing Standards Publications, FIPS PUB
119+
202*. SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions, August 2015.
120+
Available from http://csrc.nist.gov/publications/.
121+
122+
114123
.. _ieee-p1363a:
115124

116125
[IEEE P1363A]

doc/source/gfpecsetpointhash-gfpecsetpointhashbackcompatible.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ Return Values
104104
- Indicates an error condition if msgLen is negative.
105105
* - ippStsQuadraticNonResidueErr
106106
- Indicates an error condition if the square of the ``Y``-coordinate of the point is a quadratic non-residue modulo ``p``.
107+
* - ippStsNotSupportedModeErr
108+
- Indicates an error condition if the provided hash algorithm identifier is not supported.
109+
* - ippStsMemAllocErr
110+
- An internal functional error. If this output status appears, update to the latest version of the library or contact `Intel <https://github.com/intel/cryptography-primitives/issues>`_.
107111

108112

109113

doc/source/hashduplicate.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ Return Values
7676
- Indicates an error condition if any of the specified pointers is NULL.
7777
* - ippStsContextMatchErr
7878
- Indicates an error condition if any of the context parameters does not match the operation.
79+
* - ippStsNotSupportedModeErr
80+
- Indicates an error condition if the provided hash algorithm identifier is not supported.
7981

8082

8183

doc/source/hashfinal.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Return Values
7575
- Indicates an error condition if any of the specified pointers is NULL.
7676
* - ippStsContextMatchErr
7777
- Indicates an error condition if the context parameter does not match the operation.
78-
78+
* - ippStsNotSupportedModeErr
79+
- Indicates an error condition if the provided hash algorithm identifier is not supported.
7980

8081

doc/source/hashgetsize.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ IppStatus ippsHashGetSize(int \*pSize);
1919
IppStatus ippsHashGetSize_rmf(int \*pSize);
2020

2121

22+
IppStatus ippsHashGetSizeOptimal_rmf(int \*pSize, IppsHashMethod\* pMethod);
23+
24+
2225
Include Files
2326
-------------
2427

@@ -35,6 +38,8 @@ Parameters
3538

3639
* - pSize
3740
- Pointer to the value of the IppsHashState or IppsHashState_rmf context size.
41+
* - IppsHashMethod\*
42+
- Pointer to the hash method.
3843

3944

4045

@@ -48,8 +53,10 @@ Description
4853
ippsHashGetSize function is deprecated. Please refer to :ref:`Deprecated Functions <appendix-b-deprecated-functions>`
4954
section for the recommendations for transition.
5055

51-
The function gets the size of the IppsHashState or IppsHashState_rmf
52-
context in bytes and stores it in \*pSize.
56+
The functions get the size of the IppsHashState or IppsHashState_rmf
57+
context in bytes and stores it in \*pSize. ippsHashGetSize and ippsHashGetSize_rmf are universal for supported hash methods
58+
and provide a size sufficient for the largest method. ippsHashGetSizeOptimal_rmf provides the minimum size required
59+
for a particular method and can be used to reduce memory consumption.
5360

5461

5562
.. note::

doc/source/hashgettag.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ Return Values
8484
- Indicates an error condition if tagLen < 1 or tagLen exceeds the maximal length of a particular digest.
8585
* - ippStsContextMatchErr
8686
- Indicates an error condition if the context parameter does not match the operation.
87+
* - ippStsNotSupportedModeErr
88+
- Indicates an error condition if the provided hash algorithm identifier is not supported.
8789

8890

8991

doc/source/hashmethod.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,40 @@ const IppsHashMethod\* ippsHashMethod_SM3_NI(void);
8585
const IppsHashMethod\* ippsHashMethod_SM3_TT(void);
8686

8787

88+
const IppsHashMethod\* ippsHashMethod_SHA3_224(void);
89+
90+
const IppsHashMethod\* ippsHashMethod_SHA3_256(void);
91+
92+
const IppsHashMethod\* ippsHashMethod_SHA3_384(void);
93+
94+
const IppsHashMethod\* ippsHashMethod_SHA3_512(void);
95+
96+
97+
const IppsHashMethod\* ippsHashMethod_SHAKE128(int digestBitsize);
98+
99+
const IppsHashMethod\* ippsHashMethod_SHAKE256(int digestBitsize);
100+
88101
Include Files
89102
-------------
90103

91104

92105
``ippcp.h``
93106

94107

108+
109+
Parameters
110+
----------
111+
112+
113+
.. list-table::
114+
:header-rows: 0
115+
116+
* - digestBitsize
117+
- The size of output digest in bits. Should be positive multiple of 8 integer.
118+
119+
120+
121+
95122
Description
96123
-----------
97124

@@ -122,6 +149,8 @@ Return Values
122149

123150
* - const ippsHashMethod\*
124151
- Pointer to the particular hash method.
152+
* - ``NULL``
153+
- digestBitsize is not positive multiple of 8 integer.
125154

126155

127156

doc/source/hashmethodset.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ const IppStatus ippsHashMethodSet_SM3_NI(IppsHashMethod\* pMethod);
8686
const IppStatus ippsHashMethodSet_SM3_TT(IppsHashMethod\* pMethod);
8787

8888

89+
const IppStatus ippsHashMethodSet_SHA3_224(IppsHashMethod\* pMethod);
90+
91+
const IppStatus ippsHashMethodSet_SHA3_256(IppsHashMethod\* pMethod);
92+
93+
const IppStatus ippsHashMethodSet_SHA3_384(IppsHashMethod\* pMethod);
94+
95+
const IppStatus ippsHashMethodSet_SHA3_512(IppsHashMethod\* pMethod);
96+
97+
98+
const IppStatus ippsHashMethodSet_SHAKE128(IppsHashMethod\* pMethod, int digestBitsize);
99+
100+
const IppStatus ippsHashMethodSet_SHAKE256(IppsHashMethod\* pMethod, int digestBitsize);
101+
89102
Include Files
90103
-------------
91104

@@ -102,6 +115,8 @@ Parameters
102115

103116
* - IppsHashMethod\*
104117
- Pointer to the uninitialized hash method.
118+
* - digestBitsize
119+
- The size of output digest in bits. Should be positive multiple of 8 integer.
105120

106121

107122

@@ -139,6 +154,8 @@ Return Values
139154
- Indicates no errors. Any other value indicates an error or warning.
140155
* - ippStsNullPtrErr
141156
- Indicates an error condition if any of the specified pointers is NULL.
157+
* - ippStsOutOfRangeErr
158+
- Indicates an error condition if digestBitsize is not positive multiple of 8 integer.
142159

143160

144161

doc/source/hashpack-hashunpack.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ Return Values
102102
- Indicates an error condition in a ippsHashPack_rmf call if the context parameter does not match the operation.
103103
* - ippStsNoMem
104104
- Indicates an error condition if the value of bufferSize is less than the size of the IppsHashState_rmf context.
105+
* - ippStsNotSupportedModeErr
106+
- Indicates an error condition if the provided hash algorithm identifier is not supported.
105107

106108

107109

0 commit comments

Comments
 (0)