summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguenther <>2020-10-11 01:16:31 +0000
committerguenther <>2020-10-11 01:16:31 +0000
commitb6bb75f4585006b28ebc729355536e9e77226c3d (patch)
tree081ebd6053829d1d9d7bf9bb60beb046b604b46b
parent777484b19e29edc6126b0347b81a5d02728eeda2 (diff)
downloadopenbsd-b6bb75f4585006b28ebc729355536e9e77226c3d.tar.gz
openbsd-b6bb75f4585006b28ebc729355536e9e77226c3d.tar.bz2
openbsd-b6bb75f4585006b28ebc729355536e9e77226c3d.zip
Constipate srtp_known_profiles, pushing it into .data.rel.ro
ok tb@ jsing@
-rw-r--r--src/lib/libssl/d1_srtp.c19
-rw-r--r--src/lib/libssl/ssl_locl.h8
-rw-r--r--src/lib/libssl/ssl_tlsext.c8
3 files changed, 18 insertions, 17 deletions
diff --git a/src/lib/libssl/d1_srtp.c b/src/lib/libssl/d1_srtp.c
index 70e9a4f127..6d4a1661e1 100644
--- a/src/lib/libssl/d1_srtp.c
+++ b/src/lib/libssl/d1_srtp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_srtp.c,v 1.24 2020/03/16 15:25:13 tb Exp $ */ 1/* $OpenBSD: d1_srtp.c,v 1.25 2020/10/11 01:16:31 guenther Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -126,7 +126,7 @@
126#include "bytestring.h" 126#include "bytestring.h"
127#include "srtp.h" 127#include "srtp.h"
128 128
129static SRTP_PROTECTION_PROFILE srtp_known_profiles[] = { 129static const SRTP_PROTECTION_PROFILE srtp_known_profiles[] = {
130 { 130 {
131 "SRTP_AES128_CM_SHA1_80", 131 "SRTP_AES128_CM_SHA1_80",
132 SRTP_AES128_CM_SHA1_80, 132 SRTP_AES128_CM_SHA1_80,
@@ -139,10 +139,10 @@ static SRTP_PROTECTION_PROFILE srtp_known_profiles[] = {
139}; 139};
140 140
141int 141int
142srtp_find_profile_by_name(char *profile_name, SRTP_PROTECTION_PROFILE **pptr, 142srtp_find_profile_by_name(char *profile_name,
143 unsigned int len) 143 const SRTP_PROTECTION_PROFILE **pptr, unsigned int len)
144{ 144{
145 SRTP_PROTECTION_PROFILE *p; 145 const SRTP_PROTECTION_PROFILE *p;
146 146
147 p = srtp_known_profiles; 147 p = srtp_known_profiles;
148 while (p->name) { 148 while (p->name) {
@@ -160,9 +160,9 @@ srtp_find_profile_by_name(char *profile_name, SRTP_PROTECTION_PROFILE **pptr,
160 160
161int 161int
162srtp_find_profile_by_num(unsigned int profile_num, 162srtp_find_profile_by_num(unsigned int profile_num,
163 SRTP_PROTECTION_PROFILE **pptr) 163 const SRTP_PROTECTION_PROFILE **pptr)
164{ 164{
165 SRTP_PROTECTION_PROFILE *p; 165 const SRTP_PROTECTION_PROFILE *p;
166 166
167 p = srtp_known_profiles; 167 p = srtp_known_profiles;
168 while (p->name) { 168 while (p->name) {
@@ -185,7 +185,7 @@ ssl_ctx_make_profiles(const char *profiles_string,
185 char *col; 185 char *col;
186 char *ptr = (char *)profiles_string; 186 char *ptr = (char *)profiles_string;
187 187
188 SRTP_PROTECTION_PROFILE *p; 188 const SRTP_PROTECTION_PROFILE *p;
189 189
190 if (!(profiles = sk_SRTP_PROTECTION_PROFILE_new_null())) { 190 if (!(profiles = sk_SRTP_PROTECTION_PROFILE_new_null())) {
191 SSLerrorx(SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES); 191 SSLerrorx(SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES);
@@ -245,7 +245,8 @@ SSL_get_srtp_profiles(SSL *s)
245SRTP_PROTECTION_PROFILE * 245SRTP_PROTECTION_PROFILE *
246SSL_get_selected_srtp_profile(SSL *s) 246SSL_get_selected_srtp_profile(SSL *s)
247{ 247{
248 return s->internal->srtp_profile; 248 /* XXX cast away the const */
249 return (SRTP_PROTECTION_PROFILE *)s->internal->srtp_profile;
249} 250}
250 251
251#endif 252#endif
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index a5027a92e0..e47f6191c2 100644
--- a/src/lib/libssl/ssl_locl.h
+++ b/src/lib/libssl/ssl_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_locl.h,v 1.300 2020/10/11 01:13:04 guenther Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.301 2020/10/11 01:16:31 guenther Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -797,7 +797,7 @@ typedef struct ssl_internal_st {
797 TLS_SESSION_TICKET_EXT *tlsext_session_ticket; 797 TLS_SESSION_TICKET_EXT *tlsext_session_ticket;
798 798
799 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* What we'll do */ 799 STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* What we'll do */
800 SRTP_PROTECTION_PROFILE *srtp_profile; /* What's been chosen */ 800 const SRTP_PROTECTION_PROFILE *srtp_profile; /* What's been chosen */
801 801
802 int renegotiate;/* 1 if we are renegotiating. 802 int renegotiate;/* 1 if we are renegotiating.
803 * 2 if we are a server and are inside a handshake 803 * 2 if we are a server and are inside a handshake
@@ -1418,9 +1418,9 @@ void SSL_error_internal(const SSL *s, int r, char *f, int l);
1418#ifndef OPENSSL_NO_SRTP 1418#ifndef OPENSSL_NO_SRTP
1419 1419
1420int srtp_find_profile_by_name(char *profile_name, 1420int srtp_find_profile_by_name(char *profile_name,
1421 SRTP_PROTECTION_PROFILE **pptr, unsigned int len); 1421 const SRTP_PROTECTION_PROFILE **pptr, unsigned int len);
1422int srtp_find_profile_by_num(unsigned int profile_num, 1422int srtp_find_profile_by_num(unsigned int profile_num,
1423 SRTP_PROTECTION_PROFILE **pptr); 1423 const SRTP_PROTECTION_PROFILE **pptr);
1424 1424
1425#endif /* OPENSSL_NO_SRTP */ 1425#endif /* OPENSSL_NO_SRTP */
1426 1426
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c
index 2f6860b6f9..1767104963 100644
--- a/src/lib/libssl/ssl_tlsext.c
+++ b/src/lib/libssl/ssl_tlsext.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_tlsext.c,v 1.83 2020/10/11 01:13:04 guenther Exp $ */ 1/* $OpenBSD: ssl_tlsext.c,v 1.84 2020/10/11 01:16:31 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -1213,7 +1213,7 @@ tlsext_srtp_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
1213 CBB profiles, mki; 1213 CBB profiles, mki;
1214 int ct, i; 1214 int ct, i;
1215 STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL; 1215 STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL;
1216 SRTP_PROTECTION_PROFILE *prof; 1216 const SRTP_PROTECTION_PROFILE *prof;
1217 1217
1218 if ((clnt = SSL_get_srtp_profiles(s)) == NULL) { 1218 if ((clnt = SSL_get_srtp_profiles(s)) == NULL) {
1219 SSLerror(s, SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST); 1219 SSLerror(s, SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST);
@@ -1247,7 +1247,7 @@ tlsext_srtp_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
1247int 1247int
1248tlsext_srtp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) 1248tlsext_srtp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1249{ 1249{
1250 SRTP_PROTECTION_PROFILE *cprof, *sprof; 1250 const SRTP_PROTECTION_PROFILE *cprof, *sprof;
1251 STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL, *srvr; 1251 STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL, *srvr;
1252 int i, j; 1252 int i, j;
1253 int ret; 1253 int ret;
@@ -1358,7 +1358,7 @@ int
1358tlsext_srtp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) 1358tlsext_srtp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1359{ 1359{
1360 STACK_OF(SRTP_PROTECTION_PROFILE) *clnt; 1360 STACK_OF(SRTP_PROTECTION_PROFILE) *clnt;
1361 SRTP_PROTECTION_PROFILE *prof; 1361 const SRTP_PROTECTION_PROFILE *prof;
1362 int i; 1362 int i;
1363 uint16_t id; 1363 uint16_t id;
1364 CBS profile_ids, mki; 1364 CBS profile_ids, mki;