Skip to content

Commit 66abdaa

Browse files
committed
GCM: fix gcm parms checking for old gcm API
Routine check_gcm_parms is only used in the "old" gcm API that works on z13 and older machines. The length checks on S390_GCM_MAX_TEXT_LENGTH and S390_GCM_MAX_AAD_LENGTH do not make sense here, because they would only check the current input, but not the accumulated length values. And according to the data types (unsigned long) these max values cannot be reached anyway. Signed-off-by: Joerg Schmidbauer <jschmidb@de.ibm.com>
1 parent 25b397a commit 66abdaa

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

src/ica_api.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -258,24 +258,16 @@ static unsigned int check_gcm_parms(unsigned long text_length,
258258
const unsigned char *tag, unsigned int tag_length,
259259
unsigned int iv_length)
260260
{
261-
#ifdef __s390x__
262261
/*
263-
* The following comparisions are alaways false on s390 targets
264-
* due to limited range of data type.
265-
*/
266-
if ((text_length > S390_GCM_MAX_TEXT_LENGTH) ||
267-
(aad_length > S390_GCM_MAX_AAD_LENGTH))
268-
return EINVAL;
269-
#else
270-
(void)text_length; /* supporess unused param warning */
271-
(void)aad_length;
272-
#endif
273-
/*
274-
* The following check must be done but is commented out because
275-
* comparison is always false due to limited range of data type.
262+
* The following comparisons are always false due to limited
263+
* range of data types.
264+
*
265+
* if ((text_length > S390_GCM_MAX_TEXT_LENGTH) ||
266+
* (aad_length > S390_GCM_MAX_AAD_LENGTH))
267+
* return EINVAL;
276268
*
277-
* if (iv_length > S390_GCM_MAX_IV_LENGTH)
278-
* return EINVAL;
269+
* if (iv_length > S390_GCM_MAX_IV_LENGTH)
270+
* return EINVAL;
279271
*/
280272

281273
if (iv_length == 0)

0 commit comments

Comments
 (0)