diff options
author | David Benjamin <davidben@chromium.org> | 2014-12-04 10:32:13 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-12-11 03:05:56 +0300 |
commit | e3594df7f100443933325a9b7c5923c6c10b83de (patch) | |
tree | c10e70fd9ca4361821e10689a41473efd877bdf8 /ssl/s3_srvr.c | |
parent | 1e29a6b7c5a5a4946ce43976af017e2e4c0e0d18 (diff) |
Shorten certificate parsing code a little.
Comparing data is a much easier idiom than CBS_skip + a CBS_len check.
Change-Id: I3efe925734c76f3494cad682445291ae83750a7e
Reviewed-on: https://boringssl-review.googlesource.com/2500
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'ssl/s3_srvr.c')
-rw-r--r-- | ssl/s3_srvr.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c index 2a380a99..326d78cd 100644 --- a/ssl/s3_srvr.c +++ b/ssl/s3_srvr.c @@ -2282,19 +2282,13 @@ int ssl3_get_client_certificate(SSL *s) OPENSSL_PUT_ERROR(SSL, ssl3_get_client_certificate, ERR_R_ASN1_LIB); goto f_err; } - if (!CBS_skip(&certificate, data - CBS_data(&certificate))) - { - al = SSL_AD_INTERNAL_ERROR; - OPENSSL_PUT_ERROR(SSL, ssl3_get_client_certificate, ERR_R_INTERNAL_ERROR); - goto f_err; - } - if (CBS_len(&certificate) != 0) + if (data != CBS_data(&certificate) + CBS_len(&certificate)) { al = SSL_AD_DECODE_ERROR; OPENSSL_PUT_ERROR(SSL, ssl3_get_client_certificate, SSL_R_CERT_LENGTH_MISMATCH); goto f_err; } - if (!sk_X509_push(sk,x)) + if (!sk_X509_push(sk, x)) { OPENSSL_PUT_ERROR(SSL, ssl3_get_client_certificate, ERR_R_MALLOC_FAILURE); goto err; |