Fix miscellaneous clang-tidy warnings.

There are still a ton of them, almost exclusively complaints that
function declaration and definitions have different parameter names. I
just fixed a few randomly.

Change-Id: I1072f3dba8f63372cda92425aa94f4aa9e3911fa
Reviewed-on: https://boringssl-review.googlesource.com/18706
Reviewed-by: Steven Valdez <svaldez@google.com>
This commit is contained in:
David Benjamin
2017-07-31 19:09:42 -04:00
committed by Steven Valdez
parent 6c5454704c
commit 27e377ec65
20 changed files with 121 additions and 137 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ extern "C" {
/* Wrapper functions for time functions. */
/* OPENSSL_gmtime wraps |gmtime_r|. See the manual page for that function. */
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
struct tm *OPENSSL_gmtime(const time_t *time, struct tm *result);
/* OPENSSL_gmtime_adj updates |tm| by adding |offset_day| days and |offset_sec|
* seconds. */
+5 -5
View File
@@ -171,7 +171,7 @@ int OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec) {
return 1;
}
int OPENSSL_gmtime_diff(int *pday, int *psec, const struct tm *from,
int OPENSSL_gmtime_diff(int *out_days, int *out_secs, const struct tm *from,
const struct tm *to) {
int from_sec, to_sec, diff_sec;
long from_jd, to_jd, diff_day;
@@ -195,11 +195,11 @@ int OPENSSL_gmtime_diff(int *pday, int *psec, const struct tm *from,
diff_sec -= SECS_PER_DAY;
}
if (pday) {
*pday = (int)diff_day;
if (out_days) {
*out_days = (int)diff_day;
}
if (psec) {
*psec = diff_sec;
if (out_secs) {
*out_secs = diff_sec;
}
return 1;
+11 -13
View File
@@ -153,12 +153,12 @@ size_t BUF_MEM_grow_clean(BUF_MEM *buf, size_t len) {
return buf_mem_grow(buf, len, 1 /* clear old buffer contents. */);
}
char *BUF_strdup(const char *buf) {
if (buf == NULL) {
char *BUF_strdup(const char *str) {
if (str == NULL) {
return NULL;
}
return BUF_strndup(buf, strlen(buf));
return BUF_strndup(str, strlen(str));
}
size_t BUF_strnlen(const char *str, size_t max_len) {
@@ -173,15 +173,15 @@ size_t BUF_strnlen(const char *str, size_t max_len) {
return i;
}
char *BUF_strndup(const char *buf, size_t size) {
char *BUF_strndup(const char *str, size_t size) {
char *ret;
size_t alloc_size;
if (buf == NULL) {
if (str == NULL) {
return NULL;
}
size = BUF_strnlen(buf, size);
size = BUF_strnlen(str, size);
alloc_size = size + 1;
if (alloc_size < size) {
@@ -195,7 +195,7 @@ char *BUF_strndup(const char *buf, size_t size) {
return NULL;
}
OPENSSL_memcpy(ret, buf, size);
OPENSSL_memcpy(ret, str, size);
ret[size] = '\0';
return ret;
}
@@ -223,19 +223,17 @@ size_t BUF_strlcat(char *dst, const char *src, size_t dst_size) {
return l + BUF_strlcpy(dst, src, dst_size);
}
void *BUF_memdup(const void *data, size_t dst_size) {
void *ret;
if (dst_size == 0) {
void *BUF_memdup(const void *data, size_t size) {
if (size == 0) {
return NULL;
}
ret = OPENSSL_malloc(dst_size);
void *ret = OPENSSL_malloc(size);
if (ret == NULL) {
OPENSSL_PUT_ERROR(BUF, ERR_R_MALLOC_FAILURE);
return NULL;
}
OPENSSL_memcpy(ret, data, dst_size);
OPENSSL_memcpy(ret, data, size);
return ret;
}
+18 -18
View File
@@ -59,8 +59,8 @@
#include <openssl/bn.h>
int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) {
*ret = 0;
int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *out_flags) {
*out_flags = 0;
BN_CTX *ctx = BN_CTX_new();
if (ctx == NULL) {
@@ -77,7 +77,7 @@ int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) {
goto err;
}
if (BN_cmp(pub_key, tmp) <= 0) {
*ret |= DH_CHECK_PUBKEY_TOO_SMALL;
*out_flags |= DH_CHECK_PUBKEY_TOO_SMALL;
}
/* Check |pub_key| is less than |dh->p| - 1. */
@@ -86,7 +86,7 @@ int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) {
goto err;
}
if (BN_cmp(pub_key, tmp) >= 0) {
*ret |= DH_CHECK_PUBKEY_TOO_LARGE;
*out_flags |= DH_CHECK_PUBKEY_TOO_LARGE;
}
if (dh->q != NULL) {
@@ -97,7 +97,7 @@ int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) {
goto err;
}
if (!BN_is_one(tmp)) {
*ret |= DH_CHECK_PUBKEY_INVALID;
*out_flags |= DH_CHECK_PUBKEY_INVALID;
}
}
@@ -110,7 +110,7 @@ err:
}
int DH_check(const DH *dh, int *ret) {
int DH_check(const DH *dh, int *out_flags) {
/* Check that p is a safe prime and if g is 2, 3 or 5, check that it is a
* suitable generator where:
* for 2, p mod 24 == 11
@@ -123,7 +123,7 @@ int DH_check(const DH *dh, int *ret) {
BN_ULONG l;
BIGNUM *t1 = NULL, *t2 = NULL;
*ret = 0;
*out_flags = 0;
ctx = BN_CTX_new();
if (ctx == NULL) {
goto err;
@@ -140,16 +140,16 @@ int DH_check(const DH *dh, int *ret) {
if (dh->q) {
if (BN_cmp(dh->g, BN_value_one()) <= 0) {
*ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
*out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
} else if (BN_cmp(dh->g, dh->p) >= 0) {
*ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
*out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
} else {
/* Check g^q == 1 mod p */
if (!BN_mod_exp_mont(t1, dh->g, dh->q, dh->p, ctx, NULL)) {
goto err;
}
if (!BN_is_one(t1)) {
*ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
*out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
}
}
r = BN_is_prime_ex(dh->q, BN_prime_checks, ctx, NULL);
@@ -157,17 +157,17 @@ int DH_check(const DH *dh, int *ret) {
goto err;
}
if (!r) {
*ret |= DH_CHECK_Q_NOT_PRIME;
*out_flags |= DH_CHECK_Q_NOT_PRIME;
}
/* Check p == 1 mod q i.e. q divides p - 1 */
if (!BN_div(t1, t2, dh->p, dh->q, ctx)) {
goto err;
}
if (!BN_is_one(t2)) {
*ret |= DH_CHECK_INVALID_Q_VALUE;
*out_flags |= DH_CHECK_INVALID_Q_VALUE;
}
if (dh->j && BN_cmp(dh->j, t1)) {
*ret |= DH_CHECK_INVALID_J_VALUE;
*out_flags |= DH_CHECK_INVALID_J_VALUE;
}
} else if (BN_is_word(dh->g, DH_GENERATOR_2)) {
l = BN_mod_word(dh->p, 24);
@@ -175,7 +175,7 @@ int DH_check(const DH *dh, int *ret) {
goto err;
}
if (l != 11) {
*ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
*out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
}
} else if (BN_is_word(dh->g, DH_GENERATOR_5)) {
l = BN_mod_word(dh->p, 10);
@@ -183,10 +183,10 @@ int DH_check(const DH *dh, int *ret) {
goto err;
}
if (l != 3 && l != 7) {
*ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
*out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
}
} else {
*ret |= DH_CHECK_UNABLE_TO_CHECK_GENERATOR;
*out_flags |= DH_CHECK_UNABLE_TO_CHECK_GENERATOR;
}
r = BN_is_prime_ex(dh->p, BN_prime_checks, ctx, NULL);
@@ -194,7 +194,7 @@ int DH_check(const DH *dh, int *ret) {
goto err;
}
if (!r) {
*ret |= DH_CHECK_P_NOT_PRIME;
*out_flags |= DH_CHECK_P_NOT_PRIME;
} else if (!dh->q) {
if (!BN_rshift1(t1, dh->p)) {
goto err;
@@ -204,7 +204,7 @@ int DH_check(const DH *dh, int *ret) {
goto err;
}
if (!r) {
*ret |= DH_CHECK_P_NOT_SAFE_PRIME;
*out_flags |= DH_CHECK_P_NOT_SAFE_PRIME;
}
}
ok = 1;
+18 -18
View File
@@ -917,35 +917,35 @@ int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
return index;
}
int DSA_set_ex_data(DSA *d, int idx, void *arg) {
return CRYPTO_set_ex_data(&d->ex_data, idx, arg);
int DSA_set_ex_data(DSA *dsa, int idx, void *arg) {
return CRYPTO_set_ex_data(&dsa->ex_data, idx, arg);
}
void *DSA_get_ex_data(const DSA *d, int idx) {
return CRYPTO_get_ex_data(&d->ex_data, idx);
void *DSA_get_ex_data(const DSA *dsa, int idx) {
return CRYPTO_get_ex_data(&dsa->ex_data, idx);
}
DH *DSA_dup_DH(const DSA *r) {
DH *ret = NULL;
if (r == NULL) {
goto err;
DH *DSA_dup_DH(const DSA *dsa) {
if (dsa == NULL) {
return NULL;
}
ret = DH_new();
DH *ret = DH_new();
if (ret == NULL) {
goto err;
}
if (r->q != NULL) {
ret->priv_length = BN_num_bits(r->q);
if ((ret->q = BN_dup(r->q)) == NULL) {
if (dsa->q != NULL) {
ret->priv_length = BN_num_bits(dsa->q);
if ((ret->q = BN_dup(dsa->q)) == NULL) {
goto err;
}
}
if ((r->p != NULL && (ret->p = BN_dup(r->p)) == NULL) ||
(r->g != NULL && (ret->g = BN_dup(r->g)) == NULL) ||
(r->pub_key != NULL && (ret->pub_key = BN_dup(r->pub_key)) == NULL) ||
(r->priv_key != NULL && (ret->priv_key = BN_dup(r->priv_key)) == NULL)) {
goto err;
if ((dsa->p != NULL && (ret->p = BN_dup(dsa->p)) == NULL) ||
(dsa->g != NULL && (ret->g = BN_dup(dsa->g)) == NULL) ||
(dsa->pub_key != NULL && (ret->pub_key = BN_dup(dsa->pub_key)) == NULL) ||
(dsa->priv_key != NULL &&
(ret->priv_key = BN_dup(dsa->priv_key)) == NULL)) {
goto err;
}
return ret;
+4 -4
View File
@@ -100,19 +100,19 @@ TEST(CTRDRBGTest, TestVectors) {
CTR_DRBG_STATE drbg;
CTR_DRBG_init(&drbg, seed.data(),
personalisation.size() > 0 ? personalisation.data() : nullptr,
personalisation.empty() ? nullptr : personalisation.data(),
personalisation.size());
CTR_DRBG_reseed(&drbg, reseed.data(),
ai_reseed.size() > 0 ? ai_reseed.data() : nullptr,
ai_reseed.empty() ? nullptr : ai_reseed.data(),
ai_reseed.size());
std::vector<uint8_t> out;
out.resize(expected.size());
CTR_DRBG_generate(&drbg, out.data(), out.size(),
ai1.size() > 0 ? ai1.data() : nullptr, ai1.size());
ai1.empty() ? nullptr : ai1.data(), ai1.size());
CTR_DRBG_generate(&drbg, out.data(), out.size(),
ai2.size() > 0 ? ai2.data() : nullptr, ai2.size());
ai2.empty() ? nullptr : ai2.data(), ai2.size());
EXPECT_EQ(Bytes(expected), Bytes(out));
});
-2
View File
@@ -345,8 +345,6 @@ void RAND_bytes_with_additional_data(uint8_t *out, size_t out_len,
#if defined(BORINGSSL_FIPS)
CRYPTO_STATIC_MUTEX_unlock_read(thread_states_list_lock_bss_get());
#endif
return;
}
int RAND_bytes(uint8_t *out, size_t out_len) {
+4 -4
View File
@@ -293,12 +293,12 @@ int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
return index;
}
int RSA_set_ex_data(RSA *d, int idx, void *arg) {
return CRYPTO_set_ex_data(&d->ex_data, idx, arg);
int RSA_set_ex_data(RSA *rsa, int idx, void *arg) {
return CRYPTO_set_ex_data(&rsa->ex_data, idx, arg);
}
void *RSA_get_ex_data(const RSA *d, int idx) {
return CRYPTO_get_ex_data(&d->ex_data, idx);
void *RSA_get_ex_data(const RSA *rsa, int idx) {
return CRYPTO_get_ex_data(&rsa->ex_data, idx);
}
/* SSL_SIG_LENGTH is the size of an SSL/TLS (prior to TLS 1.2) signature: it's
+2 -1
View File
@@ -32,7 +32,8 @@
FileTest::FileTest(std::unique_ptr<FileTest::LineReader> reader,
std::function<void(const std::string &)> comment_callback)
: reader_(std::move(reader)), comment_callback_(comment_callback) {}
: reader_(std::move(reader)),
comment_callback_(std::move(comment_callback)) {}
FileTest::~FileTest() {}
+2 -2
View File
@@ -79,9 +79,9 @@ extern "C" {
DEFINE_STACK_OF(BIO)
/* BIO_new creates a new BIO with the given type and a reference count of one.
/* BIO_new creates a new BIO with the given method and a reference count of one.
* It returns the fresh |BIO|, or NULL on error. */
OPENSSL_EXPORT BIO *BIO_new(const BIO_METHOD *type);
OPENSSL_EXPORT BIO *BIO_new(const BIO_METHOD *method);
/* BIO_free decrements the reference count of |bio|. If the reference count
* drops to zero, it (optionally) calls the BIO's callback with |BIO_CB_FREE|,
+2 -2
View File
@@ -91,7 +91,7 @@ OPENSSL_EXPORT size_t BUF_MEM_grow(BUF_MEM *buf, size_t len);
/* BUF_MEM_grow_clean acts the same as |BUF_MEM_grow|, but clears the previous
* contents of memory if reallocing. */
OPENSSL_EXPORT size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
OPENSSL_EXPORT size_t BUF_MEM_grow_clean(BUF_MEM *buf, size_t len);
/* BUF_strdup returns an allocated, duplicate of |str|. */
OPENSSL_EXPORT char *BUF_strdup(const char *str);
@@ -112,7 +112,7 @@ OPENSSL_EXPORT void *BUF_memdup(const void *data, size_t size);
OPENSSL_EXPORT size_t BUF_strlcpy(char *dst, const char *src, size_t dst_size);
/* BUF_strlcat acts like strlcat(3). */
OPENSSL_EXPORT size_t BUF_strlcat(char *dst, const char *src, size_t size);
OPENSSL_EXPORT size_t BUF_strlcat(char *dst, const char *src, size_t dst_size);
#if defined(__cplusplus)
+1 -1
View File
@@ -50,7 +50,7 @@ OPENSSL_EXPORT void X25519_keypair(uint8_t out_public_value[32],
* public values as inputs. */
OPENSSL_EXPORT int X25519(uint8_t out_shared_key[32],
const uint8_t private_key[32],
const uint8_t peers_public_value[32]);
const uint8_t peer_public_value[32]);
/* X25519_public_from_private calculates a Diffie-Hellman public value from the
* given private key and writes it to |out_public_value|. */
+2 -2
View File
@@ -298,8 +298,8 @@ OPENSSL_EXPORT int DSA_get_ex_new_index(long argl, void *argp,
CRYPTO_EX_unused *unused,
CRYPTO_EX_dup *dup_unused,
CRYPTO_EX_free *free_func);
OPENSSL_EXPORT int DSA_set_ex_data(DSA *d, int idx, void *arg);
OPENSSL_EXPORT void *DSA_get_ex_data(const DSA *d, int idx);
OPENSSL_EXPORT int DSA_set_ex_data(DSA *dsa, int idx, void *arg);
OPENSSL_EXPORT void *DSA_get_ex_data(const DSA *dsa, int idx);
/* Deprecated functions. */
+2 -2
View File
@@ -456,8 +456,8 @@ OPENSSL_EXPORT int RSA_get_ex_new_index(long argl, void *argp,
CRYPTO_EX_unused *unused,
CRYPTO_EX_dup *dup_unused,
CRYPTO_EX_free *free_func);
OPENSSL_EXPORT int RSA_set_ex_data(RSA *r, int idx, void *arg);
OPENSSL_EXPORT void *RSA_get_ex_data(const RSA *r, int idx);
OPENSSL_EXPORT int RSA_set_ex_data(RSA *rsa, int idx, void *arg);
OPENSSL_EXPORT void *RSA_get_ex_data(const RSA *rsa, int idx);
/* Flags. */
+19 -27
View File
@@ -2819,20 +2819,17 @@ OPENSSL_EXPORT const SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(
* The callback returns the length of the PSK or 0 if no suitable identity was
* found. */
OPENSSL_EXPORT void SSL_CTX_set_psk_client_callback(
SSL_CTX *ctx,
unsigned (*psk_client_callback)(
SSL *ssl, const char *hint, char *identity,
unsigned max_identity_len, uint8_t *psk, unsigned max_psk_len));
SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
unsigned max_identity_len, uint8_t *psk,
unsigned max_psk_len));
/* SSL_set_psk_client_callback sets the callback to be called when PSK is
* negotiated on the client. This callback must be set to enable PSK cipher
* suites on the client. See also |SSL_CTX_set_psk_client_callback|. */
OPENSSL_EXPORT void SSL_set_psk_client_callback(
SSL *ssl, unsigned (*psk_client_callback)(SSL *ssl, const char *hint,
char *identity,
unsigned max_identity_len,
uint8_t *psk,
unsigned max_psk_len));
SSL *ssl, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
unsigned max_identity_len, uint8_t *psk,
unsigned max_psk_len));
/* SSL_CTX_set_psk_server_callback sets the callback to be called when PSK is
* negotiated on the server. This callback must be set to enable PSK cipher
@@ -2842,19 +2839,15 @@ OPENSSL_EXPORT void SSL_set_psk_client_callback(
* length at most |max_psk_len| to |psk| and return the number of bytes written
* or zero if the PSK identity is unknown. */
OPENSSL_EXPORT void SSL_CTX_set_psk_server_callback(
SSL_CTX *ctx,
unsigned (*psk_server_callback)(SSL *ssl, const char *identity,
uint8_t *psk,
unsigned max_psk_len));
SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *identity, uint8_t *psk,
unsigned max_psk_len));
/* SSL_set_psk_server_callback sets the callback to be called when PSK is
* negotiated on the server. This callback must be set to enable PSK cipher
* suites on the server. See also |SSL_CTX_set_psk_server_callback|. */
OPENSSL_EXPORT void SSL_set_psk_server_callback(
SSL *ssl,
unsigned (*psk_server_callback)(SSL *ssl, const char *identity,
uint8_t *psk,
unsigned max_psk_len));
SSL *ssl, unsigned (*cb)(SSL *ssl, const char *identity, uint8_t *psk,
unsigned max_psk_len));
/* SSL_CTX_use_psk_identity_hint configures server connections to advertise an
* identity hint of |identity_hint|. It returns one on success and zero on
@@ -3572,7 +3565,7 @@ OPENSSL_EXPORT int SSL_CTX_sess_timeouts(const SSL_CTX *ctx);
OPENSSL_EXPORT int SSL_CTX_sess_cache_full(const SSL_CTX *ctx);
/* SSL_cutthrough_complete calls |SSL_in_false_start|. */
OPENSSL_EXPORT int SSL_cutthrough_complete(const SSL *s);
OPENSSL_EXPORT int SSL_cutthrough_complete(const SSL *ssl);
/* SSL_num_renegotiations calls |SSL_total_renegotiations|. */
OPENSSL_EXPORT int SSL_num_renegotiations(const SSL *ssl);
@@ -3596,10 +3589,10 @@ OPENSSL_EXPORT int SSL_CTX_get_read_ahead(const SSL_CTX *ctx);
OPENSSL_EXPORT void SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes);
/* SSL_get_read_ahead returns zero. */
OPENSSL_EXPORT int SSL_get_read_ahead(const SSL *s);
OPENSSL_EXPORT int SSL_get_read_ahead(const SSL *ssl);
/* SSL_set_read_ahead does nothing. */
OPENSSL_EXPORT void SSL_set_read_ahead(SSL *s, int yes);
OPENSSL_EXPORT void SSL_set_read_ahead(SSL *ssl, int yes);
/* SSL_renegotiate put an error on the error queue and returns zero. */
OPENSSL_EXPORT int SSL_renegotiate(SSL *ssl);
@@ -3664,10 +3657,10 @@ OPENSSL_EXPORT int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx,
OPENSSL_EXPORT int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles);
/* SSL_get_current_compression returns NULL. */
OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_compression(SSL *s);
OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_compression(SSL *ssl);
/* SSL_get_current_expansion returns NULL. */
OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_expansion(SSL *s);
OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_expansion(SSL *ssl);
/* SSL_get_server_tmp_key returns zero. */
OPENSSL_EXPORT int *SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key);
@@ -3680,11 +3673,11 @@ OPENSSL_EXPORT int SSL_set_tmp_dh(SSL *ssl, const DH *dh);
/* SSL_CTX_set_tmp_dh_callback does nothing. */
OPENSSL_EXPORT void SSL_CTX_set_tmp_dh_callback(
SSL_CTX *ctx, DH *(*callback)(SSL *ssl, int is_export, int keylength));
SSL_CTX *ctx, DH *(*cb)(SSL *ssl, int is_export, int keylength));
/* SSL_set_tmp_dh_callback does nothing. */
OPENSSL_EXPORT void SSL_set_tmp_dh_callback(SSL *ssl,
DH *(*dh)(SSL *ssl, int is_export,
DH *(*cb)(SSL *ssl, int is_export,
int keylength));
@@ -3784,8 +3777,7 @@ OPENSSL_EXPORT const char *SSL_get_cipher_list(const SSL *ssl, int n);
* this function is confusing. This callback may not be registered concurrently
* with |SSL_CTX_set_cert_cb| or |SSL_set_cert_cb|. */
OPENSSL_EXPORT void SSL_CTX_set_client_cert_cb(
SSL_CTX *ctx,
int (*client_cert_cb)(SSL *ssl, X509 **out_x509, EVP_PKEY **out_pkey));
SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **out_x509, EVP_PKEY **out_pkey));
#define SSL_NOTHING 1
#define SSL_WRITING 2
@@ -4368,7 +4360,7 @@ struct ssl_ctx_st {
* in: points to the client's list of supported protocols in
* wire-format.
* inlen: the length of |in|. */
int (*alpn_select_cb)(SSL *s, const uint8_t **out, uint8_t *out_len,
int (*alpn_select_cb)(SSL *ssl, const uint8_t **out, uint8_t *out_len,
const uint8_t *in, unsigned in_len, void *arg);
void *alpn_select_cb_arg;
+7 -8
View File
@@ -716,7 +716,7 @@ int ssl_has_private_key(const SSL *ssl);
enum ssl_private_key_result_t ssl_private_key_sign(
SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len, size_t max_out,
uint16_t signature_algorithm, const uint8_t *in, size_t in_len);
uint16_t sigalg, const uint8_t *in, size_t in_len);
enum ssl_private_key_result_t ssl_private_key_decrypt(
SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len, size_t max_out,
@@ -728,11 +728,10 @@ int ssl_private_key_supports_signature_algorithm(SSL_HANDSHAKE *hs,
uint16_t sigalg);
/* ssl_public_key_verify verifies that the |signature| is valid for the public
* key |pkey| and input |in|, using the |signature_algorithm| specified. */
int ssl_public_key_verify(
SSL *ssl, const uint8_t *signature, size_t signature_len,
uint16_t signature_algorithm, EVP_PKEY *pkey,
const uint8_t *in, size_t in_len);
* key |pkey| and input |in|, using the signature algorithm |sigalg|. */
int ssl_public_key_verify(SSL *ssl, const uint8_t *signature,
size_t signature_len, uint16_t sigalg, EVP_PKEY *pkey,
const uint8_t *in, size_t in_len);
/* Custom extensions */
@@ -2030,8 +2029,8 @@ static const size_t kMaxEarlyDataAccepted = 14336;
CERT *ssl_cert_new(const SSL_X509_METHOD *x509_method);
CERT *ssl_cert_dup(CERT *cert);
void ssl_cert_clear_certs(CERT *c);
void ssl_cert_free(CERT *c);
void ssl_cert_clear_certs(CERT *cert);
void ssl_cert_free(CERT *cert);
int ssl_set_cert(CERT *cert, UniquePtr<CRYPTO_BUFFER> buffer);
int ssl_is_key_type_supported(int key_type);
/* ssl_compare_public_and_private_key returns one if |pubkey| is the public
+11 -11
View File
@@ -222,24 +222,24 @@ void ssl_cert_clear_certs(CERT *cert) {
cert->key_method = NULL;
}
void ssl_cert_free(CERT *c) {
if (c == NULL) {
void ssl_cert_free(CERT *cert) {
if (cert == NULL) {
return;
}
ssl_cert_clear_certs(c);
c->x509_method->cert_free(c);
OPENSSL_free(c->sigalgs);
CRYPTO_BUFFER_free(c->signed_cert_timestamp_list);
CRYPTO_BUFFER_free(c->ocsp_response);
ssl_cert_clear_certs(cert);
cert->x509_method->cert_free(cert);
OPENSSL_free(cert->sigalgs);
CRYPTO_BUFFER_free(cert->signed_cert_timestamp_list);
CRYPTO_BUFFER_free(cert->ocsp_response);
OPENSSL_free(c);
OPENSSL_free(cert);
}
static void ssl_cert_set_cert_cb(CERT *c, int (*cb)(SSL *ssl, void *arg),
static void ssl_cert_set_cert_cb(CERT *cert, int (*cb)(SSL *ssl, void *arg),
void *arg) {
c->cert_cb = cb;
c->cert_cb_arg = arg;
cert->cert_cb = cb;
cert->cert_cb_arg = arg;
}
enum leaf_cert_and_privkey_result_t {
+10 -14
View File
@@ -2148,8 +2148,8 @@ int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
return index;
}
int SSL_set_ex_data(SSL *ssl, int idx, void *arg) {
return CRYPTO_set_ex_data(&ssl->ex_data, idx, arg);
int SSL_set_ex_data(SSL *ssl, int idx, void *data) {
return CRYPTO_set_ex_data(&ssl->ex_data, idx, data);
}
void *SSL_get_ex_data(const SSL *ssl, int idx) {
@@ -2167,8 +2167,8 @@ int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
return index;
}
int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *arg) {
return CRYPTO_set_ex_data(&ctx->ex_data, idx, arg);
int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *data) {
return CRYPTO_set_ex_data(&ctx->ex_data, idx, data);
}
void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) {
@@ -2179,21 +2179,17 @@ int SSL_want(const SSL *ssl) { return ssl->rwstate; }
void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
RSA *(*cb)(SSL *ssl, int is_export,
int keylength)) {
}
int keylength)) {}
void SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int is_export,
int keylength)) {
}
int keylength)) {}
void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
DH *(*callback)(SSL *ssl, int is_export,
int keylength)) {
}
DH *(*cb)(SSL *ssl, int is_export,
int keylength)) {}
void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*callback)(SSL *ssl, int is_export,
int keylength)) {
}
void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*cb)(SSL *ssl, int is_export,
int keylength)) {}
static int use_psk_identity_hint(char **out, const char *identity_hint) {
if (identity_hint != NULL && strlen(identity_hint) > PSK_MAX_IDENTITY_LEN) {
+1 -1
View File
@@ -911,7 +911,7 @@ int SSL_SESSION_set1_id_context(SSL_SESSION *session, const uint8_t *sid_ctx,
return 0;
}
assert(sizeof(session->sid_ctx) < 256);
static_assert(sizeof(session->sid_ctx) < 256, "sid_ctx_len does not fit");
session->sid_ctx_length = (uint8_t)sid_ctx_len;
OPENSSL_memcpy(session->sid_ctx, sid_ctx, sid_ctx_len);
+1 -1
View File
@@ -42,7 +42,7 @@ bool Rand(const std::vector<std::string> &args) {
std::vector<std::string> args_copy(args);
const std::string &last_arg = args.back();
if (last_arg.size() > 0 && last_arg[0] != '-') {
if (!last_arg.empty() && last_arg[0] != '-') {
char *endptr;
unsigned long long num = strtoull(last_arg.c_str(), &endptr, 10);
if (*endptr == 0) {