Browse Source

Remove unnecessary CBS_get_asn1_element.

EVP_parse_public_key already acts like CBS_get_* in that it peels one
element off and leaves a remainder.

Change-Id: Ic90952785005ed81664a6f46503b13ecd293176c
Reviewed-on: https://boringssl-review.googlesource.com/13045
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
kris/onging/CECPQ3_patch15
David Benjamin 7 years ago
parent
commit
5b410b6bec
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      ssl/ssl_cert.c

+ 3
- 4
ssl/ssl_cert.c View File

@@ -652,14 +652,13 @@ static int ssl_cert_skip_to_spki(const CBS *in, CBS *out_tbs_cert) {
}

EVP_PKEY *ssl_cert_parse_pubkey(const CBS *in) {
CBS buf = *in, tbs_cert, spki;
if (!ssl_cert_skip_to_spki(&buf, &tbs_cert) ||
!CBS_get_asn1_element(&tbs_cert, &spki, CBS_ASN1_SEQUENCE)) {
CBS buf = *in, tbs_cert;
if (!ssl_cert_skip_to_spki(&buf, &tbs_cert)) {
OPENSSL_PUT_ERROR(SSL, SSL_R_CANNOT_PARSE_LEAF_CERT);
return NULL;
}

return EVP_parse_public_key(&spki);
return EVP_parse_public_key(&tbs_cert);
}

int ssl_cert_check_digital_signature_key_usage(const CBS *in) {


Loading…
Cancel
Save