summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorTrevor <unsafe@trevp.net>2013-06-24 15:59:05 -0700
committerBen Laurie <ben@links.org>2013-06-28 16:01:12 +0100
commit5382adbf2c8ad6ab68ac13ea00298853bf5a0e68 (patch)
treedaf9b8caaa1e857e71dcba484d9c0234c1b6c69a /ssl
parentac9ce2cf03fda35c49879b1ed7ba051ca0d8a908 (diff)
Cosmetic touchups.
Diffstat (limited to 'ssl')
-rw-r--r--ssl/ssl_cert.c7
-rw-r--r--ssl/ssl_lib.c14
-rw-r--r--ssl/ssl_rsa.c2
-rw-r--r--ssl/t1_lib.c10
4 files changed, 18 insertions, 15 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index f86511d81c..81b5811fd7 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -350,15 +350,15 @@ CERT *ssl_cert_dup(CERT *cert)
if (cert->pkeys[i].serverinfo != NULL)
{
/* Just copy everything. */
- ret->pkeys[i].serverinfo_length =
- cert->pkeys[i].serverinfo_length;
ret->pkeys[i].serverinfo =
- OPENSSL_malloc(ret->pkeys[i].serverinfo_length);
+ OPENSSL_malloc(cert->pkeys[i].serverinfo_length);
if (ret->pkeys[i].serverinfo == NULL)
{
SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE);
return NULL;
}
+ ret->pkeys[i].serverinfo_length =
+ cert->pkeys[i].serverinfo_length;
memcpy(ret->pkeys[i].serverinfo,
cert->pkeys[i].serverinfo,
cert->pkeys[i].serverinfo_length);
@@ -488,6 +488,7 @@ void ssl_cert_clear_certs(CERT *c)
{
OPENSSL_free(cpk->serverinfo);
cpk->serverinfo = NULL;
+ cpk->serverinfo_length = 0;
}
#endif
/* Clear all flags apart from explicit sign */
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index b08e82688f..a48e09e521 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -1702,16 +1702,17 @@ int SSL_CTX_set_custom_cli_ext(SSL_CTX *ctx, unsigned short ext_type,
custom_cli_ext_first_cb_fn fn1,
custom_cli_ext_second_cb_fn fn2, void* arg)
{
- /* Check for duplicates */
size_t i;
custom_cli_ext_record* record;
+ /* Check for duplicates */
for (i=0; i < ctx->custom_cli_ext_records_count; i++)
if (ext_type == ctx->custom_cli_ext_records[i].ext_type)
return 0;
ctx->custom_cli_ext_records = OPENSSL_realloc(ctx->custom_cli_ext_records,
- (ctx->custom_cli_ext_records_count+1) * sizeof(custom_cli_ext_record));
+ (ctx->custom_cli_ext_records_count + 1) *
+ sizeof(custom_cli_ext_record));
if (!ctx->custom_cli_ext_records) {
ctx->custom_cli_ext_records_count = 0;
return 0;
@@ -1726,19 +1727,20 @@ int SSL_CTX_set_custom_cli_ext(SSL_CTX *ctx, unsigned short ext_type,
}
int SSL_CTX_set_custom_srv_ext(SSL_CTX *ctx, unsigned short ext_type,
- custom_srv_ext_first_cb_fn fn1,
- custom_srv_ext_second_cb_fn fn2, void* arg)
+ custom_srv_ext_first_cb_fn fn1,
+ custom_srv_ext_second_cb_fn fn2, void* arg)
{
- /* Check for duplicates */
size_t i;
custom_srv_ext_record* record;
+ /* Check for duplicates */
for (i=0; i < ctx->custom_srv_ext_records_count; i++)
if (ext_type == ctx->custom_srv_ext_records[i].ext_type)
return 0;
ctx->custom_srv_ext_records = OPENSSL_realloc(ctx->custom_srv_ext_records,
- (ctx->custom_srv_ext_records_count+1) * sizeof(custom_srv_ext_record));
+ (ctx->custom_srv_ext_records_count + 1) *
+ sizeof(custom_srv_ext_record));
if (!ctx->custom_srv_ext_records) {
ctx->custom_srv_ext_records_count = 0;
return 0;
diff --git a/ssl/ssl_rsa.c b/ssl/ssl_rsa.c
index 507a3d1773..77abcfce83 100644
--- a/ssl/ssl_rsa.c
+++ b/ssl/ssl_rsa.c
@@ -1096,7 +1096,7 @@ int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo,
return 0;
}
ctx->cert->key->serverinfo = OPENSSL_realloc(ctx->cert->key->serverinfo,
- serverinfo_length);
+ serverinfo_length);
if (ctx->cert->key->serverinfo == NULL)
{
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO,ERR_R_MALLOC_FAILURE);
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index 8bed38d6d4..07cb096646 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -2364,19 +2364,19 @@ static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char
record = &s->ctx->custom_srv_ext_records[i];
if (type == record->ext_type)
{
- /* Error on duplicate TLS Extensions */
size_t j;
+ /* Error on duplicate TLS Extensions */
for (j = 0; j < s->s3->tlsext_custom_types_count; j++)
{
- if (s->s3->tlsext_custom_types[j] == type)
+ if (type == s->s3->tlsext_custom_types[j])
{
*al = TLS1_AD_DECODE_ERROR;
return 0;
}
}
- /* Callback */
+ /* NULL callback still notes the extension */
if (record->fn1 && !record->fn1(s, type, data, size, al, record->arg))
return 0;
@@ -2384,7 +2384,7 @@ static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char
s->s3->tlsext_custom_types_count++;
s->s3->tlsext_custom_types = OPENSSL_realloc(
s->s3->tlsext_custom_types,
- s->s3->tlsext_custom_types_count*2);
+ s->s3->tlsext_custom_types_count * 2);
if (s->s3->tlsext_custom_types == NULL)
{
s->s3->tlsext_custom_types = 0;
@@ -2392,7 +2392,7 @@ static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char
return 0;
}
s->s3->tlsext_custom_types[
- s->s3->tlsext_custom_types_count-1] = type;
+ s->s3->tlsext_custom_types_count - 1] = type;
}
}
}