Skip to content

Commit

Permalink
Intel(R) Integrated Performance Primitives Cryptography 2021.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ipl_ci committed Jun 15, 2023
1 parent 47079e5 commit 97d2971
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
9 changes: 5 additions & 4 deletions sources/ippcp/crypto_mb/include/crypto_mb/sm4.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
#include <crypto_mb/defs.h>
#include <crypto_mb/status.h>

#define SM4_LINES (16) /* Max number of buffers */
#define SM4_BLOCK_SIZE (16) /* SM4 data block size (bytes) */
#define SM4_KEY_SIZE (16) /* SM4 key size (bytes) */
#define SM4_ROUNDS (32) /* SM4 number of rounds */
#define SM4_LINES (16) /* Max number of buffers */
#define SM4_BLOCK_SIZE (16) /* SM4 data block size (bytes) */
#define SM4_KEY_SIZE (16) /* SM4 key size (bytes) */
#define SM4_ROUNDS (32) /* SM4 number of rounds */
#define SM4_XTS_MAX_SIZE ((1 << 20) * SM4_BLOCK_SIZE) /* SM4 max buffer size (bytes) */

typedef int8u sm4_key[SM4_KEY_SIZE];
typedef int8u sm4_xts_key[SM4_KEY_SIZE*2];
Expand Down
5 changes: 5 additions & 0 deletions sources/ippcp/crypto_mb/src/sm4/sm4_xts_dec_mb16.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ mbx_status16 mbx_sm4_xts_decrypt_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_
/* Do not process non-valid buffers */
mb_mask &= ~(0x1 << buf_no);
}
if (len[buf_no] > SM4_XTS_MAX_SIZE) {
status = MBX_SET_STS16(status, buf_no, MBX_STATUS_MISMATCH_PARAM_ERR);
/* Do not process non-valid buffers */
mb_mask &= ~(0x1 << buf_no);
}
}

if (MBX_IS_ANY_OK_STS16(status))
Expand Down
5 changes: 5 additions & 0 deletions sources/ippcp/crypto_mb/src/sm4/sm4_xts_enc_mb16.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ mbx_status16 mbx_sm4_xts_encrypt_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_
/* Do not process non-valid buffers */
mb_mask &= ~(0x1 << buf_no);
}
if (len[buf_no] > SM4_XTS_MAX_SIZE) {
status = MBX_SET_STS16(status, buf_no, MBX_STATUS_MISMATCH_PARAM_ERR);
/* Do not process non-valid buffers */
mb_mask &= ~(0x1 << buf_no);
}
}

if (MBX_IS_ANY_OK_STS16(status))
Expand Down
10 changes: 5 additions & 5 deletions sources/ippcp/pcprsa_getdefmeth_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*
*
*******************************************************************************/

/*
Expand Down Expand Up @@ -56,12 +56,12 @@ static gsMethod_RSA* getDualExpMethod_RSA_private(int bitSizeDP, int bitSizeDQ)
if ((bitSizeDP != bitSizeDQ) || (bitSizeDP == 0))
return NULL;

gsMethod_RSA* m = NULL;
#if(_IPP32E>=_IPP32E_K1)
gsMethod_RSA* m = NULL;
m = gsMethod_RSA_avx512_crt_private(bitSizeDP);
#endif
if (m && m->dualExpFun)
return m;
#endif

return NULL;
}

0 comments on commit 97d2971

Please sign in to comment.