Skip to content

Commit

Permalink
[core] Fixed suspicious (HCRYPT_CTX_F_ENCRYPT & ctx->flags ? ..).
Browse files Browse the repository at this point in the history
 Using parentheses to clarify the code.
  • Loading branch information
maxsharabayko committed Jun 16, 2022
1 parent 04407e6 commit 6a489e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions haicrypt/hcrypt_sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int hcryptCtx_SetSecret(hcrypt_Session *crypto, hcrypt_Ctx *ctx, const HaiCrypt_
ctx->cfg.pwd_len = 0;
/* KEK: Key Encrypting Key */
if (0 > (iret = crypto->cryspr->km_setkey(crypto->cryspr_cb,
(HCRYPT_CTX_F_ENCRYPT & ctx->flags ? true : false),
((HCRYPT_CTX_F_ENCRYPT & ctx->flags) ? true : false),
secret->str, secret->len))) {
HCRYPT_LOG(LOG_ERR, "km_setkey(pdkek[%zd]) failed (rc=%d)\n", secret->len, iret);
return(-1);
Expand Down Expand Up @@ -87,7 +87,7 @@ int hcryptCtx_GenSecret(hcrypt_Session *crypto, hcrypt_Ctx *ctx)
HCRYPT_PRINTKEY(kek, kek_len, "kek");

/* KEK: Key Encrypting Key */
if (0 > (iret = crypto->cryspr->km_setkey(crypto->cryspr_cb, (HCRYPT_CTX_F_ENCRYPT & ctx->flags ? true : false), kek, kek_len))) {
if (0 > (iret = crypto->cryspr->km_setkey(crypto->cryspr_cb, ((HCRYPT_CTX_F_ENCRYPT & ctx->flags) ? true : false), kek, kek_len))) {
HCRYPT_LOG(LOG_ERR, "km_setkey(pdkek[%zd]) failed (rc=%d)\n", kek_len, iret);
return(-1);
}
Expand Down

0 comments on commit 6a489e1

Please sign in to comment.