mirror of https://github.com/openssl/openssl.git
style : fix some if(...
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/4457)
This commit is contained in:
parent
89635075d8
commit
f479eab227
|
@ -198,7 +198,7 @@ static int psk_use_session_cb(SSL *s, const EVP_MD *md,
|
||||||
|
|
||||||
if (key_len == EVP_MD_size(EVP_sha256()))
|
if (key_len == EVP_MD_size(EVP_sha256()))
|
||||||
cipher = SSL_CIPHER_find(s, tls13_aes128gcmsha256_id);
|
cipher = SSL_CIPHER_find(s, tls13_aes128gcmsha256_id);
|
||||||
else if(key_len == EVP_MD_size(EVP_sha384()))
|
else if (key_len == EVP_MD_size(EVP_sha384()))
|
||||||
cipher = SSL_CIPHER_find(s, tls13_aes256gcmsha384_id);
|
cipher = SSL_CIPHER_find(s, tls13_aes256gcmsha384_id);
|
||||||
|
|
||||||
if (cipher == NULL) {
|
if (cipher == NULL) {
|
||||||
|
|
|
@ -208,7 +208,7 @@ static int psk_find_session_cb(SSL *ssl, const unsigned char *identity,
|
||||||
|
|
||||||
if (key_len == EVP_MD_size(EVP_sha256()))
|
if (key_len == EVP_MD_size(EVP_sha256()))
|
||||||
cipher = SSL_CIPHER_find(ssl, tls13_aes128gcmsha256_id);
|
cipher = SSL_CIPHER_find(ssl, tls13_aes128gcmsha256_id);
|
||||||
else if(key_len == EVP_MD_size(EVP_sha384()))
|
else if (key_len == EVP_MD_size(EVP_sha384()))
|
||||||
cipher = SSL_CIPHER_find(ssl, tls13_aes256gcmsha384_id);
|
cipher = SSL_CIPHER_find(ssl, tls13_aes256gcmsha384_id);
|
||||||
|
|
||||||
if (cipher == NULL) {
|
if (cipher == NULL) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ _dopr(char **sbuffer,
|
||||||
if (ch == '%')
|
if (ch == '%')
|
||||||
state = DP_S_FLAGS;
|
state = DP_S_FLAGS;
|
||||||
else
|
else
|
||||||
if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
|
if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
|
||||||
return 0;
|
return 0;
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
break;
|
break;
|
||||||
|
@ -293,8 +293,8 @@ _dopr(char **sbuffer,
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
if(!doapr_outch(sbuffer, buffer, &currlen, maxlen,
|
if (!doapr_outch(sbuffer, buffer, &currlen, maxlen,
|
||||||
va_arg(args, int)))
|
va_arg(args, int)))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
|
@ -323,7 +323,7 @@ _dopr(char **sbuffer,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '%':
|
case '%':
|
||||||
if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
|
if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
|
@ -354,7 +354,7 @@ _dopr(char **sbuffer,
|
||||||
if (*truncated)
|
if (*truncated)
|
||||||
currlen = *maxlen - 1;
|
currlen = *maxlen - 1;
|
||||||
}
|
}
|
||||||
if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0'))
|
if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0'))
|
||||||
return 0;
|
return 0;
|
||||||
*retlen = currlen - 1;
|
*retlen = currlen - 1;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -392,19 +392,19 @@ fmtstr(char **sbuffer,
|
||||||
padlen = -padlen;
|
padlen = -padlen;
|
||||||
|
|
||||||
while ((padlen > 0) && (max < 0 || cnt < max)) {
|
while ((padlen > 0) && (max < 0 || cnt < max)) {
|
||||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
||||||
return 0;
|
return 0;
|
||||||
--padlen;
|
--padlen;
|
||||||
++cnt;
|
++cnt;
|
||||||
}
|
}
|
||||||
while (strln > 0 && (max < 0 || cnt < max)) {
|
while (strln > 0 && (max < 0 || cnt < max)) {
|
||||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++))
|
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++))
|
||||||
return 0;
|
return 0;
|
||||||
--strln;
|
--strln;
|
||||||
++cnt;
|
++cnt;
|
||||||
}
|
}
|
||||||
while ((padlen < 0) && (max < 0 || cnt < max)) {
|
while ((padlen < 0) && (max < 0 || cnt < max)) {
|
||||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
||||||
return 0;
|
return 0;
|
||||||
++padlen;
|
++padlen;
|
||||||
++cnt;
|
++cnt;
|
||||||
|
@ -472,19 +472,19 @@ fmtint(char **sbuffer,
|
||||||
|
|
||||||
/* spaces */
|
/* spaces */
|
||||||
while (spadlen > 0) {
|
while (spadlen > 0) {
|
||||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
|
||||||
return 0;
|
return 0;
|
||||||
--spadlen;
|
--spadlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sign */
|
/* sign */
|
||||||
if (signvalue)
|
if (signvalue)
|
||||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
|
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* prefix */
|
/* prefix */
|
||||||
while (*prefix) {
|
while (*prefix) {
|
||||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix))
|
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix))
|
||||||
return 0;
|
return 0;
|
||||||
prefix++;
|
prefix++;
|
||||||
}
|
}
|
||||||
|
@ -492,7 +492,7 @@ fmtint(char **sbuffer,
|
||||||
/* zeros */
|
/* zeros */
|
||||||
if (zpadlen > 0) {
|
if (zpadlen > 0) {
|
||||||
while (zpadlen > 0) {
|
while (zpadlen > 0) {
|
||||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
|
if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
|
||||||
return 0;
|
return 0;
|
||||||
--zpadlen;
|
--zpadlen;
|
||||||
}
|
}
|
||||||
|
@ -758,8 +758,8 @@ fmtfp(char **sbuffer,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (fplace > 0) {
|
while (fplace > 0) {
|
||||||
if(!doapr_outch(sbuffer, buffer, currlen, maxlen,
|
if (!doapr_outch(sbuffer, buffer, currlen, maxlen,
|
||||||
fconvert[--fplace]))
|
fconvert[--fplace]))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -913,7 +913,7 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
|
||||||
size_t retlen;
|
size_t retlen;
|
||||||
int truncated;
|
int truncated;
|
||||||
|
|
||||||
if(!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args))
|
if (!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (truncated)
|
if (truncated)
|
||||||
|
|
|
@ -265,7 +265,7 @@ int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert)
|
||||||
return (ASN1_STRING_length(respid->value.byKey) == SHA_DIGEST_LENGTH)
|
return (ASN1_STRING_length(respid->value.byKey) == SHA_DIGEST_LENGTH)
|
||||||
&& (memcmp(ASN1_STRING_get0_data(respid->value.byKey), md,
|
&& (memcmp(ASN1_STRING_get0_data(respid->value.byKey), md,
|
||||||
SHA_DIGEST_LENGTH) == 0);
|
SHA_DIGEST_LENGTH) == 0);
|
||||||
} else if(respid->type == V_OCSP_RESPID_NAME) {
|
} else if (respid->type == V_OCSP_RESPID_NAME) {
|
||||||
if (respid->value.byName == NULL)
|
if (respid->value.byName == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -437,8 +437,8 @@ static void dummy_pause_job(void) {
|
||||||
#endif
|
#endif
|
||||||
*writefd = pipefds[1];
|
*writefd = pipefds[1];
|
||||||
|
|
||||||
if(!ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_dasync_id, pipefds[0],
|
if (!ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_dasync_id, pipefds[0],
|
||||||
writefd, wait_cleanup)) {
|
writefd, wait_cleanup)) {
|
||||||
wait_cleanup(waitctx, engine_dasync_id, pipefds[0], writefd);
|
wait_cleanup(waitctx, engine_dasync_id, pipefds[0], writefd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -920,8 +920,8 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
||||||
* This will be at most one cipher block or the tag length if using
|
* This will be at most one cipher block or the tag length if using
|
||||||
* AEAD. SSL_RT_MAX_CIPHER_BLOCK_SIZE covers either case.
|
* AEAD. SSL_RT_MAX_CIPHER_BLOCK_SIZE covers either case.
|
||||||
*/
|
*/
|
||||||
if(!WPACKET_reserve_bytes(thispkt, SSL_RT_MAX_CIPHER_BLOCK_SIZE,
|
if (!WPACKET_reserve_bytes(thispkt, SSL_RT_MAX_CIPHER_BLOCK_SIZE,
|
||||||
NULL)
|
NULL)
|
||||||
/*
|
/*
|
||||||
* We also need next the amount of bytes written to this
|
* We also need next the amount of bytes written to this
|
||||||
* sub-packet
|
* sub-packet
|
||||||
|
|
|
@ -448,7 +448,7 @@ int tls1_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
|
||||||
*/
|
*/
|
||||||
if (!ssl3_digest_cached_records(s, 1))
|
if (!ssl3_digest_cached_records(s, 1))
|
||||||
return 0;
|
return 0;
|
||||||
if(!ssl_handshake_hash(s, hash, sizeof(hash), &hashlen))
|
if (!ssl_handshake_hash(s, hash, sizeof(hash), &hashlen))
|
||||||
return 0;
|
return 0;
|
||||||
#ifdef SSL_DEBUG
|
#ifdef SSL_DEBUG
|
||||||
fprintf(stderr, "Handshake hashes:\n");
|
fprintf(stderr, "Handshake hashes:\n");
|
||||||
|
|
|
@ -282,7 +282,7 @@ void test_perror(const char *s);
|
||||||
* a default description that indicates the file and line number of the error.
|
* a default description that indicates the file and line number of the error.
|
||||||
*
|
*
|
||||||
* The following macros guarantee to evaluate each argument exactly once.
|
* The following macros guarantee to evaluate each argument exactly once.
|
||||||
* This allows constructs such as: if(!TEST_ptr(ptr = OPENSSL_malloc(..)))
|
* This allows constructs such as: if (!TEST_ptr(ptr = OPENSSL_malloc(..)))
|
||||||
* to produce better contextual output than:
|
* to produce better contextual output than:
|
||||||
* ptr = OPENSSL_malloc(..);
|
* ptr = OPENSSL_malloc(..);
|
||||||
* if (!TEST_ptr(ptr))
|
* if (!TEST_ptr(ptr))
|
||||||
|
|
Loading…
Reference in New Issue