Skip to content

Commit

Permalink
Fix aes-cbc failure issue in testapp.
Browse files Browse the repository at this point in the history
Testapp will set the ENGINE to NULL if this algorithm is disabled
in configuration or disabled by Co-existence bitmap.

Signed-off-by: Zhu, Guodong <[email protected]>
Signed-off-by: Yogaraj Alamenda <[email protected]>
  • Loading branch information
Zhu, Guodong authored and Yogaraj-Alamenda committed Jul 22, 2022
1 parent cb3db21 commit a530427
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/tests_aes_cbc_hmac_sha.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static inline int set_pkt_threshold(ENGINE *e, const char* cipher, int thr)
ret = ENGINE_ctrl_cmd(e, "SET_CRYPTO_SMALL_PACKET_OFFLOAD_THRESHOLD",
0, (void *)thr_str, NULL, 0);
if (ret != 1)
WARN("Not able to set threshold %d for cipher %s\n", thr, cipher);
FAIL_MSG("Failed to set threshold %d for cipher %s\n", thr, cipher);

return ret;
}
Expand Down Expand Up @@ -1137,6 +1137,14 @@ static int run_aes_cbc_hmac_sha(void *pointer)
*/
ti.e = args->e;

if (ti.e) {
EVP_CIPHER *cipher = (EVP_CIPHER *)ENGINE_get_cipher(ti.e, NID_aes_256_cbc_hmac_sha256);
/* Set Engine to NULL if this algorithm is disabled in configuration or
disabled by the co-existence algorithm bitmap. */
if (cipher == NULL || cipher == EVP_aes_256_cbc_hmac_sha256())
ti.e = NULL;
}

/*
* For the qat engine, offload all packet sizes to engine
* by setting the threshold sizes to 0 for the cipher under test.
Expand All @@ -1145,11 +1153,8 @@ static int run_aes_cbc_hmac_sha(void *pointer)
ret = set_pkt_threshold(ti.e, ti.c->name, 0);
/* Set engine to NULL as threshhold will fail if NID not supported*/
if (ret != 1) {
ti.e = NULL;
ret = 1;
}
if (ret != 1)
return 0;
}
}

if (args->performance) {
Expand Down

0 comments on commit a530427

Please sign in to comment.