Skip to content

Commit 97d2971

Browse files
author
ipl_ci
committed
Intel(R) Integrated Performance Primitives Cryptography 2021.8
1 parent 47079e5 commit 97d2971

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

sources/ippcp/crypto_mb/include/crypto_mb/sm4.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
#include <crypto_mb/defs.h>
2323
#include <crypto_mb/status.h>
2424

25-
#define SM4_LINES (16) /* Max number of buffers */
26-
#define SM4_BLOCK_SIZE (16) /* SM4 data block size (bytes) */
27-
#define SM4_KEY_SIZE (16) /* SM4 key size (bytes) */
28-
#define SM4_ROUNDS (32) /* SM4 number of rounds */
25+
#define SM4_LINES (16) /* Max number of buffers */
26+
#define SM4_BLOCK_SIZE (16) /* SM4 data block size (bytes) */
27+
#define SM4_KEY_SIZE (16) /* SM4 key size (bytes) */
28+
#define SM4_ROUNDS (32) /* SM4 number of rounds */
29+
#define SM4_XTS_MAX_SIZE ((1 << 20) * SM4_BLOCK_SIZE) /* SM4 max buffer size (bytes) */
2930

3031
typedef int8u sm4_key[SM4_KEY_SIZE];
3132
typedef int8u sm4_xts_key[SM4_KEY_SIZE*2];

sources/ippcp/crypto_mb/src/sm4/sm4_xts_dec_mb16.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ mbx_status16 mbx_sm4_xts_decrypt_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_
4848
/* Do not process non-valid buffers */
4949
mb_mask &= ~(0x1 << buf_no);
5050
}
51+
if (len[buf_no] > SM4_XTS_MAX_SIZE) {
52+
status = MBX_SET_STS16(status, buf_no, MBX_STATUS_MISMATCH_PARAM_ERR);
53+
/* Do not process non-valid buffers */
54+
mb_mask &= ~(0x1 << buf_no);
55+
}
5156
}
5257

5358
if (MBX_IS_ANY_OK_STS16(status))

sources/ippcp/crypto_mb/src/sm4/sm4_xts_enc_mb16.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ mbx_status16 mbx_sm4_xts_encrypt_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_
4848
/* Do not process non-valid buffers */
4949
mb_mask &= ~(0x1 << buf_no);
5050
}
51+
if (len[buf_no] > SM4_XTS_MAX_SIZE) {
52+
status = MBX_SET_STS16(status, buf_no, MBX_STATUS_MISMATCH_PARAM_ERR);
53+
/* Do not process non-valid buffers */
54+
mb_mask &= ~(0x1 << buf_no);
55+
}
5156
}
5257

5358
if (MBX_IS_ANY_OK_STS16(status))

sources/ippcp/pcprsa_getdefmeth_priv.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
* Licensed under the Apache License, Version 2.0 (the 'License');
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing,
1111
* software distributed under the License is distributed on an 'AS IS' BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions
1414
* and limitations under the License.
15-
*
15+
*
1616
*******************************************************************************/
1717

1818
/*
@@ -56,12 +56,12 @@ static gsMethod_RSA* getDualExpMethod_RSA_private(int bitSizeDP, int bitSizeDQ)
5656
if ((bitSizeDP != bitSizeDQ) || (bitSizeDP == 0))
5757
return NULL;
5858

59-
gsMethod_RSA* m = NULL;
6059
#if(_IPP32E>=_IPP32E_K1)
60+
gsMethod_RSA* m = NULL;
6161
m = gsMethod_RSA_avx512_crt_private(bitSizeDP);
62-
#endif
6362
if (m && m->dualExpFun)
6463
return m;
64+
#endif
6565

6666
return NULL;
6767
}

0 commit comments

Comments
 (0)