diff options
| author | beck <> | 2022-11-11 12:02:34 +0000 |
|---|---|---|
| committer | beck <> | 2022-11-11 12:02:34 +0000 |
| commit | fadbfece8693f0ef4e461242a68e499a8580c324 (patch) | |
| tree | 0a9a1c7b34e523947e5dbb8897374c8c5c2fec2d /src/lib/libcrypto/x509/x509_alt.c | |
| parent | fd62f2b8865d2908f2ef9a53dcd73faa76f153c3 (diff) | |
| download | openbsd-fadbfece8693f0ef4e461242a68e499a8580c324.tar.gz openbsd-fadbfece8693f0ef4e461242a68e499a8580c324.tar.bz2 openbsd-fadbfece8693f0ef4e461242a68e499a8580c324.zip | |
Start CBS-ifying the name constraints code.
ok jsing@ tb@
Diffstat (limited to 'src/lib/libcrypto/x509/x509_alt.c')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_alt.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libcrypto/x509/x509_alt.c b/src/lib/libcrypto/x509/x509_alt.c index 8656df82b3..cf8cbf0ce2 100644 --- a/src/lib/libcrypto/x509/x509_alt.c +++ b/src/lib/libcrypto/x509/x509_alt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_alt.c,v 1.12 2022/03/26 16:34:21 tb Exp $ */ | 1 | /* $OpenBSD: x509_alt.c,v 1.13 2022/11/11 12:02:34 beck Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -619,6 +619,7 @@ v2i_GENERAL_NAME_ex(GENERAL_NAME *out, const X509V3_EXT_METHOD *method, | |||
| 619 | GENERAL_NAME *ret; | 619 | GENERAL_NAME *ret; |
| 620 | size_t len = 0; | 620 | size_t len = 0; |
| 621 | int type; | 621 | int type; |
| 622 | CBS cbs; | ||
| 622 | 623 | ||
| 623 | name = cnf->name; | 624 | name = cnf->name; |
| 624 | value = cnf->value; | 625 | value = cnf->value; |
| @@ -669,9 +670,10 @@ v2i_GENERAL_NAME_ex(GENERAL_NAME *out, const X509V3_EXT_METHOD *method, | |||
| 669 | } | 670 | } |
| 670 | 671 | ||
| 671 | type = x509_constraints_general_to_bytes(ret, &bytes, &len); | 672 | type = x509_constraints_general_to_bytes(ret, &bytes, &len); |
| 673 | CBS_init(&cbs, bytes, len); | ||
| 672 | switch (type) { | 674 | switch (type) { |
| 673 | case GEN_DNS: | 675 | case GEN_DNS: |
| 674 | if (!x509_constraints_valid_sandns(bytes, len)) { | 676 | if (!x509_constraints_valid_sandns(&cbs)) { |
| 675 | X509V3error(X509V3_R_BAD_OBJECT); | 677 | X509V3error(X509V3_R_BAD_OBJECT); |
| 676 | ERR_asprintf_error_data("name=%s value='%.*s'", name, | 678 | ERR_asprintf_error_data("name=%s value='%.*s'", name, |
| 677 | (int)len, bytes); | 679 | (int)len, bytes); |
| @@ -687,7 +689,7 @@ v2i_GENERAL_NAME_ex(GENERAL_NAME *out, const X509V3_EXT_METHOD *method, | |||
| 687 | } | 689 | } |
| 688 | break; | 690 | break; |
| 689 | case GEN_EMAIL: | 691 | case GEN_EMAIL: |
| 690 | if (!x509_constraints_parse_mailbox(bytes, len, NULL)) { | 692 | if (!x509_constraints_parse_mailbox(&cbs, NULL)) { |
| 691 | X509V3error(X509V3_R_BAD_OBJECT); | 693 | X509V3error(X509V3_R_BAD_OBJECT); |
| 692 | ERR_asprintf_error_data("name=%s value='%.*s'", name, | 694 | ERR_asprintf_error_data("name=%s value='%.*s'", name, |
| 693 | (int)len, bytes); | 695 | (int)len, bytes); |
