diff options
author | David Benjamin <davidben@chromium.org> | 2014-10-01 05:00:38 +0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-10-01 06:17:38 +0400 |
commit | fb3ff2c66cc873150022a4ab87ac72dd9d78b549 (patch) | |
tree | 1a1c9e5afda5354c6e3a4f0442699703c9141301 /ssl/ssl_lib.c | |
parent | 5e77bd449e9d7050d59271db157e3fc8957e23e9 (diff) |
Don't compare signed vs. unsigned.
This resolves a pile of MSVC warnings in Chromium.
Change-Id: Ib9a29cb88d8ed8ec4118d153260f775be059a803
Reviewed-on: https://boringssl-review.googlesource.com/1865
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'ssl/ssl_lib.c')
-rw-r--r-- | ssl/ssl_lib.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 5562e202..952fd788 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1381,18 +1381,20 @@ STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s) } /** The old interface to get the same thing as SSL_get_ciphers() */ -const char *SSL_get_cipher_list(const SSL *s,int n) +const char *SSL_get_cipher_list(const SSL *s, int n) { const SSL_CIPHER *c; STACK_OF(SSL_CIPHER) *sk; - if (s == NULL) return(NULL); - sk=SSL_get_ciphers(s); - if ((sk == NULL) || (sk_SSL_CIPHER_num(sk) <= n)) - return(NULL); - c=sk_SSL_CIPHER_value(sk,n); - if (c == NULL) return(NULL); - return(c->name); + if (s == NULL) + return NULL; + sk = SSL_get_ciphers(s); + if (sk == NULL || n < 0 || (size_t)n >= sk_SSL_CIPHER_num(sk)) + return NULL; + c = sk_SSL_CIPHER_value(sk, n); + if (c == NULL) + return NULL; + return c->name; } /** specify the ciphers to be used by default by the SSL_CTX */ @@ -1458,7 +1460,7 @@ char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len) char *p; STACK_OF(SSL_CIPHER) *sk; const SSL_CIPHER *c; - int i; + size_t i; if ((s->session == NULL) || (s->session->ciphers == NULL) || (len < 2)) |