diff options
author | David Benjamin <davidben@google.com> | 2023-08-24 18:17:14 -0400 |
---|---|---|
committer | Boringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-08-24 22:34:45 +0000 |
commit | 4325d8c801b043f23d23e99aa3c5f663f0d88168 (patch) | |
tree | dc77a895ba824a58610c73f9656a53e8047db9f4 /crypto/asn1 | |
parent | 4d7976635cfb835004dd6ba1933f9faca69c93ad (diff) | |
download | boringssl-4325d8c801b043f23d23e99aa3c5f663f0d88168.zip boringssl-4325d8c801b043f23d23e99aa3c5f663f0d88168.tar.gz boringssl-4325d8c801b043f23d23e99aa3c5f663f0d88168.tar.bz2 |
Export CBS/CBB unicode functions
This way the Chromium certificate verifier can more easily use them.
Bug: chromium:1322914
Change-Id: I51dafc4e70d74da8543688b6457563d78e298150
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/62745
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/a_mbstr.c | 18 | ||||
-rw-r--r-- | crypto/asn1/a_strex.c | 10 | ||||
-rw-r--r-- | crypto/asn1/tasn_dec.c | 6 |
3 files changed, 17 insertions, 17 deletions
diff --git a/crypto/asn1/a_mbstr.c b/crypto/asn1/a_mbstr.c index 8fc82ab..4d7ea14 100644 --- a/crypto/asn1/a_mbstr.c +++ b/crypto/asn1/a_mbstr.c @@ -97,22 +97,22 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int error; switch (inform) { case MBSTRING_BMP: - decode_func = cbs_get_ucs2_be; + decode_func = CBS_get_ucs2_be; error = ASN1_R_INVALID_BMPSTRING; break; case MBSTRING_UNIV: - decode_func = cbs_get_utf32_be; + decode_func = CBS_get_utf32_be; error = ASN1_R_INVALID_UNIVERSALSTRING; break; case MBSTRING_UTF8: - decode_func = cbs_get_utf8; + decode_func = CBS_get_utf8; error = ASN1_R_INVALID_UTF8STRING; break; case MBSTRING_ASC: - decode_func = cbs_get_latin1; + decode_func = CBS_get_latin1; error = ERR_R_INTERNAL_ERROR; // Latin-1 inputs are never invalid. break; @@ -162,7 +162,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, } nchar++; - utf8_len += cbb_get_utf8_len(c); + utf8_len += CBB_get_utf8_len(c); if (maxsize > 0 && nchar > (size_t)maxsize) { OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_LONG); ERR_add_error_dataf("maxsize=%zu", (size_t)maxsize); @@ -178,7 +178,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, // Now work out output format and string type int str_type; - int (*encode_func)(CBB *, uint32_t) = cbb_add_latin1; + int (*encode_func)(CBB *, uint32_t) = CBB_add_latin1; size_t size_estimate = nchar; int outform = MBSTRING_ASC; if (mask & B_ASN1_PRINTABLESTRING) { @@ -190,17 +190,17 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, } else if (mask & B_ASN1_BMPSTRING) { str_type = V_ASN1_BMPSTRING; outform = MBSTRING_BMP; - encode_func = cbb_add_ucs2_be; + encode_func = CBB_add_ucs2_be; size_estimate = 2 * nchar; } else if (mask & B_ASN1_UNIVERSALSTRING) { str_type = V_ASN1_UNIVERSALSTRING; - encode_func = cbb_add_utf32_be; + encode_func = CBB_add_utf32_be; size_estimate = 4 * nchar; outform = MBSTRING_UNIV; } else if (mask & B_ASN1_UTF8STRING) { str_type = V_ASN1_UTF8STRING; outform = MBSTRING_UTF8; - encode_func = cbb_add_utf8; + encode_func = CBB_add_utf8; size_estimate = utf8_len; } else { OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_CHARACTERS); diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c index dcc87f1..7e9afad 100644 --- a/crypto/asn1/a_strex.c +++ b/crypto/asn1/a_strex.c @@ -137,19 +137,19 @@ static int do_buf(const unsigned char *buf, int buflen, int encoding, int get_char_error; switch (encoding) { case MBSTRING_UNIV: - get_char = cbs_get_utf32_be; + get_char = CBS_get_utf32_be; get_char_error = ASN1_R_INVALID_UNIVERSALSTRING; break; case MBSTRING_BMP: - get_char = cbs_get_ucs2_be; + get_char = CBS_get_ucs2_be; get_char_error = ASN1_R_INVALID_BMPSTRING; break; case MBSTRING_ASC: - get_char = cbs_get_latin1; + get_char = CBS_get_latin1; get_char_error = ERR_R_INTERNAL_ERROR; // Should not be possible. break; case MBSTRING_UTF8: - get_char = cbs_get_utf8; + get_char = CBS_get_utf8; get_char_error = ASN1_R_INVALID_UTF8STRING; break; default: @@ -172,7 +172,7 @@ static int do_buf(const unsigned char *buf, int buflen, int encoding, uint8_t utf8_buf[6]; CBB utf8_cbb; CBB_init_fixed(&utf8_cbb, utf8_buf, sizeof(utf8_buf)); - if (!cbb_add_utf8(&utf8_cbb, c)) { + if (!CBB_add_utf8(&utf8_cbb, c)) { OPENSSL_PUT_ERROR(ASN1, ERR_R_INTERNAL_ERROR); return 1; } diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c index 24ab04f..94891c8 100644 --- a/crypto/asn1/tasn_dec.c +++ b/crypto/asn1/tasn_dec.c @@ -850,7 +850,7 @@ static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, long len, if (utype == V_ASN1_BMPSTRING) { while (CBS_len(&cbs) != 0) { uint32_t c; - if (!cbs_get_ucs2_be(&cbs, &c)) { + if (!CBS_get_ucs2_be(&cbs, &c)) { OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_BMPSTRING); goto err; } @@ -859,7 +859,7 @@ static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, long len, if (utype == V_ASN1_UNIVERSALSTRING) { while (CBS_len(&cbs) != 0) { uint32_t c; - if (!cbs_get_utf32_be(&cbs, &c)) { + if (!CBS_get_utf32_be(&cbs, &c)) { OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_UNIVERSALSTRING); goto err; } @@ -868,7 +868,7 @@ static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, long len, if (utype == V_ASN1_UTF8STRING) { while (CBS_len(&cbs) != 0) { uint32_t c; - if (!cbs_get_utf8(&cbs, &c)) { + if (!CBS_get_utf8(&cbs, &c)) { OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_UTF8STRING); goto err; } |