summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorop <>2023-05-10 13:48:54 +0000
committerop <>2023-05-10 13:48:54 +0000
commit72c805e72c683fa3159a61579ede6ca11119ec9e (patch)
tree9fe99a8678f6c99b53882f9b0d30567f3756b944 /src/lib
parentb06ec6236f52401a06b0546ab08856db818aee02 (diff)
downloadopenbsd-72c805e72c683fa3159a61579ede6ca11119ec9e.tar.gz
openbsd-72c805e72c683fa3159a61579ede6ca11119ec9e.tar.bz2
openbsd-72c805e72c683fa3159a61579ede6ca11119ec9e.zip
switch two ASN1_STRING_data() to ASN1_STRING_get0_data()
and while here mark as const data. This diff is actually from gilles@, in OpenSMTPD-portable bundled libtls. ok tb@, jsing@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libtls/tls_verify.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libtls/tls_verify.c b/src/lib/libtls/tls_verify.c
index 685146a4a9..fbbed7969c 100644
--- a/src/lib/libtls/tls_verify.c
+++ b/src/lib/libtls/tls_verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_verify.c,v 1.21 2023/05/05 14:05:33 tb Exp $ */ 1/* $OpenBSD: tls_verify.c,v 1.22 2023/05/10 13:48:54 op Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> 3 * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org>
4 * 4 *
@@ -126,12 +126,12 @@ tls_check_subject_altname(struct tls *ctx, X509 *cert, const char *name,
126 continue; 126 continue;
127 127
128 if (type == GEN_DNS) { 128 if (type == GEN_DNS) {
129 unsigned char *data; 129 const unsigned char *data;
130 int format, len; 130 int format, len;
131 131
132 format = ASN1_STRING_type(altname->d.dNSName); 132 format = ASN1_STRING_type(altname->d.dNSName);
133 if (format == V_ASN1_IA5STRING) { 133 if (format == V_ASN1_IA5STRING) {
134 data = ASN1_STRING_data(altname->d.dNSName); 134 data = ASN1_STRING_get0_data(altname->d.dNSName);
135 len = ASN1_STRING_length(altname->d.dNSName); 135 len = ASN1_STRING_length(altname->d.dNSName);
136 136
137 if (len < 0 || (size_t)len != strlen(data)) { 137 if (len < 0 || (size_t)len != strlen(data)) {
@@ -171,11 +171,11 @@ tls_check_subject_altname(struct tls *ctx, X509 *cert, const char *name,
171 } 171 }
172 172
173 } else if (type == GEN_IPADD) { 173 } else if (type == GEN_IPADD) {
174 unsigned char *data; 174 const unsigned char *data;
175 int datalen; 175 int datalen;
176 176
177 datalen = ASN1_STRING_length(altname->d.iPAddress); 177 datalen = ASN1_STRING_length(altname->d.iPAddress);
178 data = ASN1_STRING_data(altname->d.iPAddress); 178 data = ASN1_STRING_get0_data(altname->d.iPAddress);
179 179
180 if (datalen < 0) { 180 if (datalen < 0) {
181 tls_set_errorx(ctx, 181 tls_set_errorx(ctx,