Skip to content

Commit 819d711

Browse files
committed
Changed the return code being checked for unsupported algorithms in aes_test.cpp
1 parent c18af74 commit 819d711

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

TESTS/mbedtls/config/aes_test.cpp

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ int mbedtls_aes_ecb_test_mbedos(int verbose)
129129
* there is an alternative underlying implementation i.e. when
130130
* MBEDTLS_AES_ALT is defined.
131131
*/
132-
if (ret == MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE && keybits == 192) {
132+
if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) {
133133
printf("skipped\n");
134134
continue;
135135
} else if (ret != 0) {
@@ -138,7 +138,11 @@ int mbedtls_aes_ecb_test_mbedos(int verbose)
138138

139139
for (int j = 0; j < 10000; j++) {
140140
ret = mbedtls_aes_crypt_ecb(&ctx, mode, buf, buf);
141-
if (ret != 0) {
141+
if(ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED)
142+
{
143+
break;
144+
}
145+
else if (ret != 0) {
142146
goto exit;
143147
}
144148
}
@@ -205,7 +209,7 @@ int mbedtls_aes_cbc_test_mbedos(int verbose)
205209
* there is an alternative underlying implementation i.e. when
206210
* MBEDTLS_AES_ALT is defined.
207211
*/
208-
if (ret == MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE && keybits == 192) {
212+
if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) {
209213
printf("skipped\n");
210214
continue;
211215
} else if (ret != 0) {
@@ -222,7 +226,11 @@ int mbedtls_aes_cbc_test_mbedos(int verbose)
222226
}
223227

224228
ret = mbedtls_aes_crypt_cbc(&ctx, mode, 16, iv, buf, buf);
225-
if (ret != 0) {
229+
if(ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED)
230+
{
231+
break;
232+
}
233+
else if (ret != 0) {
226234
goto exit;
227235
}
228236

@@ -356,7 +364,7 @@ int mbedtls_aes_cfb_test_mbedos(int verbose)
356364
* there is an alternative underlying implementation i.e. when
357365
* MBEDTLS_AES_ALT is defined.
358366
*/
359-
if (ret == MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE && keybits == 192) {
367+
if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) {
360368
printf("skipped\n");
361369
continue;
362370
} else if (ret != 0) {
@@ -372,7 +380,11 @@ int mbedtls_aes_cfb_test_mbedos(int verbose)
372380
}
373381

374382
ret = mbedtls_aes_crypt_cfb128(&ctx, mode, 64, &offset, iv, buf, buf);
375-
if (ret != 0) {
383+
if(ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED)
384+
{
385+
break;
386+
}
387+
else if (ret != 0) {
376388
goto exit;
377389
}
378390

@@ -507,7 +519,11 @@ int mbedtls_aes_ctr_test_mbedos(int verbose)
507519
memcpy(key, aes_test_ctr_key[u], 16);
508520

509521
offset = 0;
510-
if ((ret = mbedtls_aes_setkey_enc(&ctx, key, 128)) != 0) {
522+
ret = mbedtls_aes_setkey_enc(&ctx, key, 128);
523+
if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) {
524+
printf("skipped\n");
525+
continue;
526+
} else if (ret != 0) {
511527
goto exit;
512528
}
513529

@@ -523,6 +539,9 @@ int mbedtls_aes_ctr_test_mbedos(int verbose)
523539

524540
ret = mbedtls_aes_crypt_ctr(&ctx, len, &offset, nonce_counter,
525541
stream_block, buf, buf);
542+
if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) {
543+
continue;
544+
}
526545
if (ret != 0) {
527546
goto exit;
528547
}

0 commit comments

Comments
 (0)