diff options
author | Matt Caswell <matt@openssl.org> | 2017-06-21 12:17:30 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2017-06-21 14:45:36 +0100 |
commit | 72257204bd2a88773461150765dfd0e0a428ee86 (patch) | |
tree | 0f62189accc00c2b1e58de678a7e56c1a8748325 /test | |
parent | adfc37868e2dc406b80ab3111163eb475ef06975 (diff) |
PSK related tweaks based on review feedback
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3670)
Diffstat (limited to 'test')
-rw-r--r-- | test/sslapitest.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/test/sslapitest.c b/test/sslapitest.c index 7a2f9a410e..215035ae24 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -1938,19 +1938,23 @@ static int find_session_cb_cnt = 0; static int use_session_cb(SSL *ssl, const EVP_MD *md, const unsigned char **id, size_t *idlen, SSL_SESSION **sess) { - use_session_cb_cnt++; - - /* The first call should always have a NULL md */ - if (use_session_cb_cnt == 1 && md != NULL) - return 0; + switch (++use_session_cb_cnt) { + case 1: + /* The first call should always have a NULL md */ + if (md != NULL) + return 0; + break; - /* The second call should always have an md */ - if (use_session_cb_cnt == 2 && md == NULL) - return 0; + case 2: + /* The second call should always have an md */ + if (md == NULL) + return 0; + break; - /* We should only be called a maximum of twice */ - if (use_session_cb_cnt == 3) + default: + /* We should only be called a maximum of twice */ return 0; + } if (psk != NULL) SSL_SESSION_up_ref(psk); |