From: Dr. David von Oheimb Date: Mon, 21 Jun 2021 12:15:13 +0000 (+0200) Subject: cmp_client.c: Print checkAfter value from pollRep before it may get modified X-Git-Tag: openssl-3.0.0-beta2~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c28aa85e7a21db044a5e1a094805402e2fd6490;p=thirdparty%2Fopenssl.git cmp_client.c: Print checkAfter value from pollRep before it may get modified Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/15848) --- diff --git a/crypto/cmp/cmp_client.c b/crypto/cmp/cmp_client.c index e7761ae7d94..ea6ca39fb33 100644 --- a/crypto/cmp/cmp_client.c +++ b/crypto/cmp/cmp_client.c @@ -295,18 +295,6 @@ static int poll_for_response(OSSL_CMP_CTX *ctx, int sleep, int rid, ERR_add_error_data(1, str); goto err; } - if (ctx->total_timeout > 0) { /* timeout is not infinite */ - const int exp = 5; /* expected max time per msg round trip */ - int64_t time_left = (int64_t)(ctx->end_time - exp - time(NULL)); - - if (time_left <= 0) { - ERR_raise(ERR_LIB_CMP, CMP_R_TOTAL_TIMEOUT); - goto err; - } - if (time_left < check_after) - check_after = time_left; - /* poll one last time just when timeout was reached */ - } if (pollRep->reason == NULL || (len = BIO_snprintf(str, OSSL_CMP_PKISI_BUFLEN, @@ -326,6 +314,19 @@ static int poll_for_response(OSSL_CMP_CTX *ctx, int sleep, int rid, "received polling response%s; checkAfter = %ld seconds", str, check_after); + if (ctx->total_timeout > 0) { /* timeout is not infinite */ + const int exp = 5; /* expected max time per msg round trip */ + int64_t time_left = (int64_t)(ctx->end_time - exp - time(NULL)); + + if (time_left <= 0) { + ERR_raise(ERR_LIB_CMP, CMP_R_TOTAL_TIMEOUT); + goto err; + } + if (time_left < check_after) + check_after = time_left; + /* poll one last time just when timeout was reached */ + } + OSSL_CMP_MSG_free(preq); preq = NULL; OSSL_CMP_MSG_free(prep);