From d24eb36d1e0930fe2f98c17d24a18653572c07b9 Mon Sep 17 00:00:00 2001 From: Maxwell Moyer-McKee Date: Mon, 16 Sep 2024 22:23:41 +0000 Subject: [PATCH] Make unset label a macro for readability --- SymCryptProvider/src/kdf/p_scossl_srtpkdf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SymCryptProvider/src/kdf/p_scossl_srtpkdf.c b/SymCryptProvider/src/kdf/p_scossl_srtpkdf.c index 95f0448..5e903d7 100644 --- a/SymCryptProvider/src/kdf/p_scossl_srtpkdf.c +++ b/SymCryptProvider/src/kdf/p_scossl_srtpkdf.c @@ -14,6 +14,8 @@ extern "C" { #define SCOSSL_SRTP_KDF_SALT_SIZE (112 / 8) +#define SCOSSL_SRTP_LABEL_NOT_SET (BYTE)-1 + typedef struct { BOOL isSrtcp; @@ -55,7 +57,7 @@ static SCOSSL_PROV_SRTPKDF_CTX *p_scossl_srtpkdf_newctx(ossl_unused void *provct if (ctx != NULL) { - ctx->label = (BYTE)-1; + ctx->label = SCOSSL_SRTP_LABEL_NOT_SET; } return ctx; @@ -67,7 +69,7 @@ static SCOSSL_PROV_SRTPKDF_CTX *p_scossl_srtcpkdf_newctx(ossl_unused void *provc if (ctx != NULL) { - ctx->label = (BYTE)-1; + ctx->label = SCOSSL_SRTP_LABEL_NOT_SET; ctx->isSrtcp = TRUE; } @@ -150,7 +152,7 @@ static SCOSSL_STATUS p_scossl_srtpkdf_reset(_Inout_ SCOSSL_PROV_SRTPKDF_CTX *ctx ctx->uKeyDerivationRate = 0; ctx->uIndex = 0; ctx->uIndexWidth = 0; - ctx->label = (BYTE)-1; + ctx->label = SCOSSL_SRTP_LABEL_NOT_SET; return SCOSSL_SUCCESS; } @@ -178,7 +180,7 @@ static SCOSSL_STATUS p_scossl_srtpkdf_derive(_In_ SCOSSL_PROV_SRTPKDF_CTX *ctx, return SCOSSL_FAILURE; } - if (ctx->label == (BYTE)-1) + if (ctx->label == SCOSSL_SRTP_LABEL_NOT_SET) { ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_TYPE); return SCOSSL_FAILURE;