summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2018-04-25 07:10:39 +0000
committertb <>2018-04-25 07:10:39 +0000
commit7a58116b9a7e5669a2dd3926f53fafdaa1d8ec1e (patch)
treeaf0d93a255d15bc29d3b427a91bfc08513163ac5 /src
parent1050fac1647b143f03ecfdf7cf1a88d71cf4d1c2 (diff)
downloadopenbsd-7a58116b9a7e5669a2dd3926f53fafdaa1d8ec1e.tar.gz
openbsd-7a58116b9a7e5669a2dd3926f53fafdaa1d8ec1e.tar.bz2
openbsd-7a58116b9a7e5669a2dd3926f53fafdaa1d8ec1e.zip
OpenSSL started adding const to functions all over the place. Make all
our libssl functions match theirs wrt const, except for BIO_f_ssl(3) which will be fixed in a later step. this went through a i386 bulk by sthen ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/ssl.h18
-rw-r--r--src/lib/libssl/ssl_cert.c4
-rw-r--r--src/lib/libssl/ssl_ciph.c4
-rw-r--r--src/lib/libssl/ssl_lib.c4
-rw-r--r--src/lib/libssl/ssl_locl.h6
-rw-r--r--src/lib/libssl/ssl_rsa.c24
-rw-r--r--src/lib/libssl/ssl_sess.c8
7 files changed, 30 insertions, 38 deletions
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h
index 143dd8a003..f996af188f 100644
--- a/src/lib/libssl/ssl.h
+++ b/src/lib/libssl/ssl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl.h,v 1.155 2018/04/11 17:47:36 jsing Exp $ */ 1/* $OpenBSD: ssl.h,v 1.156 2018/04/25 07:10:39 tb 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 *
@@ -727,10 +727,10 @@ void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx,
727void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, 727void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx,
728 SSL_SESSION *sess); 728 SSL_SESSION *sess);
729void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, 729void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
730 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data, 730 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
731 int len, int *copy)); 731 const unsigned char *data, int len, int *copy));
732SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, 732SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl,
733 unsigned char *Data, int len, int *copy); 733 const unsigned char *Data, int len, int *copy);
734void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl, 734void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl,
735 int type, int val)); 735 int type, int val));
736void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, int type, 736void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, int type,
@@ -746,7 +746,7 @@ void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,
746 int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, 746 int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie,
747 unsigned int *cookie_len)); 747 unsigned int *cookie_len));
748void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, 748void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
749 int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, 749 int (*app_verify_cookie_cb)(SSL *ssl, const unsigned char *cookie,
750 unsigned int cookie_len)); 750 unsigned int cookie_len));
751void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, int (*cb)(SSL *ssl, 751void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, int (*cb)(SSL *ssl,
752 const unsigned char **out, unsigned int *outlen, void *arg), void *arg); 752 const unsigned char **out, unsigned int *outlen, void *arg), void *arg);
@@ -1247,7 +1247,7 @@ const SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
1247const SSL_CIPHER *SSL_CIPHER_get_by_id(unsigned int id); 1247const SSL_CIPHER *SSL_CIPHER_get_by_id(unsigned int id);
1248const SSL_CIPHER *SSL_CIPHER_get_by_value(uint16_t value); 1248const SSL_CIPHER *SSL_CIPHER_get_by_value(uint16_t value);
1249int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); 1249int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits);
1250char * SSL_CIPHER_get_version(const SSL_CIPHER *c); 1250const char * SSL_CIPHER_get_version(const SSL_CIPHER *c);
1251const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); 1251const char * SSL_CIPHER_get_name(const SSL_CIPHER *c);
1252unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c); 1252unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c);
1253uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *c); 1253uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *c);
@@ -1279,7 +1279,7 @@ void SSL_set_verify(SSL *s, int mode,
1279 int (*callback)(int ok, X509_STORE_CTX *ctx)); 1279 int (*callback)(int ok, X509_STORE_CTX *ctx));
1280void SSL_set_verify_depth(SSL *s, int depth); 1280void SSL_set_verify_depth(SSL *s, int depth);
1281int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); 1281int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
1282int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); 1282int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, long len);
1283int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); 1283int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
1284int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, long len); 1284int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, long len);
1285int SSL_use_certificate(SSL *ssl, X509 *x); 1285int SSL_use_certificate(SSL *ssl, X509 *x);
@@ -1457,12 +1457,12 @@ long SSL_get_default_timeout(const SSL *s);
1457int SSL_library_init(void ); 1457int SSL_library_init(void );
1458 1458
1459char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); 1459char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size);
1460STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); 1460STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk);
1461 1461
1462SSL *SSL_dup(SSL *ssl); 1462SSL *SSL_dup(SSL *ssl);
1463 1463
1464X509 *SSL_get_certificate(const SSL *ssl); 1464X509 *SSL_get_certificate(const SSL *ssl);
1465/* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl); 1465/* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl);
1466 1466
1467void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode); 1467void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode);
1468int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); 1468int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);
diff --git a/src/lib/libssl/ssl_cert.c b/src/lib/libssl/ssl_cert.c
index a244353b88..a01f484578 100644
--- a/src/lib/libssl/ssl_cert.c
+++ b/src/lib/libssl/ssl_cert.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_cert.c,v 1.66 2017/08/12 02:55:22 jsing Exp $ */ 1/* $OpenBSD: ssl_cert.c,v 1.67 2018/04/25 07:10:39 tb 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 *
@@ -454,7 +454,7 @@ set_client_CA_list(STACK_OF(X509_NAME) **ca_list,
454} 454}
455 455
456STACK_OF(X509_NAME) * 456STACK_OF(X509_NAME) *
457SSL_dup_CA_list(STACK_OF(X509_NAME) *sk) 457SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk)
458{ 458{
459 int i; 459 int i;
460 STACK_OF(X509_NAME) *ret; 460 STACK_OF(X509_NAME) *ret;
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c
index 271d77f38b..cd0e9b0ad6 100644
--- a/src/lib/libssl/ssl_ciph.c
+++ b/src/lib/libssl/ssl_ciph.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_ciph.c,v 1.98 2018/03/17 14:40:45 jsing Exp $ */ 1/* $OpenBSD: ssl_ciph.c,v 1.99 2018/04/25 07:10:39 tb 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 *
@@ -1674,7 +1674,7 @@ SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
1674 return (ret); 1674 return (ret);
1675} 1675}
1676 1676
1677char * 1677const char *
1678SSL_CIPHER_get_version(const SSL_CIPHER *c) 1678SSL_CIPHER_get_version(const SSL_CIPHER *c)
1679{ 1679{
1680 if (c == NULL) 1680 if (c == NULL)
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 5cae53041d..4f1eb5bf0a 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.184 2018/04/14 07:09:21 tb Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.185 2018/04/25 07:10:39 tb 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 *
@@ -2654,7 +2654,7 @@ SSL_get_certificate(const SSL *s)
2654 2654
2655/* Fix this function so that it takes an optional type parameter */ 2655/* Fix this function so that it takes an optional type parameter */
2656EVP_PKEY * 2656EVP_PKEY *
2657SSL_get_privatekey(SSL *s) 2657SSL_get_privatekey(const SSL *s)
2658{ 2658{
2659 if (s->cert != NULL) 2659 if (s->cert != NULL)
2660 return (s->cert->key->privatekey); 2660 return (s->cert->key->privatekey);
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index 1677377c64..696ffc44b9 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.204 2018/04/07 17:02:34 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.205 2018/04/25 07:10:39 tb 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 *
@@ -460,7 +460,7 @@ typedef struct ssl_ctx_internal_st {
460 int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess); 460 int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess);
461 void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess); 461 void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess);
462 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, 462 SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
463 unsigned char *data, int len, int *copy); 463 const unsigned char *data, int len, int *copy);
464 464
465 /* if defined, these override the X509_verify_cert() calls */ 465 /* if defined, these override the X509_verify_cert() calls */
466 int (*app_verify_callback)(X509_STORE_CTX *, void *); 466 int (*app_verify_callback)(X509_STORE_CTX *, void *);
@@ -474,7 +474,7 @@ typedef struct ssl_ctx_internal_st {
474 unsigned int *cookie_len); 474 unsigned int *cookie_len);
475 475
476 /* verify cookie callback */ 476 /* verify cookie callback */
477 int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, 477 int (*app_verify_cookie_cb)(SSL *ssl, const unsigned char *cookie,
478 unsigned int cookie_len); 478 unsigned int cookie_len);
479 479
480 void (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */ 480 void (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */
diff --git a/src/lib/libssl/ssl_rsa.c b/src/lib/libssl/ssl_rsa.c
index e99ce1e3ae..631aaa5077 100644
--- a/src/lib/libssl/ssl_rsa.c
+++ b/src/lib/libssl/ssl_rsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_rsa.c,v 1.28 2017/02/07 02:08:38 beck Exp $ */ 1/* $OpenBSD: ssl_rsa.c,v 1.29 2018/04/25 07:10:39 tb 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 *
@@ -133,7 +133,7 @@ SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len)
133 X509 *x; 133 X509 *x;
134 int ret; 134 int ret;
135 135
136 x = d2i_X509(NULL, &d,(long)len); 136 x = d2i_X509(NULL, &d, (long)len);
137 if (x == NULL) { 137 if (x == NULL) {
138 SSLerror(ssl, ERR_R_ASN1_LIB); 138 SSLerror(ssl, ERR_R_ASN1_LIB);
139 return (0); 139 return (0);
@@ -254,14 +254,12 @@ end:
254} 254}
255 255
256int 256int
257SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len) 257SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, long len)
258{ 258{
259 int ret; 259 int ret;
260 const unsigned char *p;
261 RSA *rsa; 260 RSA *rsa;
262 261
263 p = d; 262 if ((rsa = d2i_RSAPrivateKey(NULL, &d, (long)len)) == NULL) {
264 if ((rsa = d2i_RSAPrivateKey(NULL, &p,(long)len)) == NULL) {
265 SSLerror(ssl, ERR_R_ASN1_LIB); 263 SSLerror(ssl, ERR_R_ASN1_LIB);
266 return (0); 264 return (0);
267 } 265 }
@@ -332,11 +330,9 @@ int
332SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len) 330SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len)
333{ 331{
334 int ret; 332 int ret;
335 const unsigned char *p;
336 EVP_PKEY *pkey; 333 EVP_PKEY *pkey;
337 334
338 p = d; 335 if ((pkey = d2i_PrivateKey(type, NULL, &d, (long)len)) == NULL) {
339 if ((pkey = d2i_PrivateKey(type, NULL, &p,(long)len)) == NULL) {
340 SSLerror(ssl, ERR_R_ASN1_LIB); 336 SSLerror(ssl, ERR_R_ASN1_LIB);
341 return (0); 337 return (0);
342 } 338 }
@@ -465,7 +461,7 @@ SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d)
465 X509 *x; 461 X509 *x;
466 int ret; 462 int ret;
467 463
468 x = d2i_X509(NULL, &d,(long)len); 464 x = d2i_X509(NULL, &d, (long)len);
469 if (x == NULL) { 465 if (x == NULL) {
470 SSLerrorx(ERR_R_ASN1_LIB); 466 SSLerrorx(ERR_R_ASN1_LIB);
471 return (0); 467 return (0);
@@ -547,11 +543,9 @@ int
547SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len) 543SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len)
548{ 544{
549 int ret; 545 int ret;
550 const unsigned char *p;
551 RSA *rsa; 546 RSA *rsa;
552 547
553 p = d; 548 if ((rsa = d2i_RSAPrivateKey(NULL, &d, (long)len)) == NULL) {
554 if ((rsa = d2i_RSAPrivateKey(NULL, &p,(long)len)) == NULL) {
555 SSLerrorx(ERR_R_ASN1_LIB); 549 SSLerrorx(ERR_R_ASN1_LIB);
556 return (0); 550 return (0);
557 } 551 }
@@ -620,11 +614,9 @@ SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, const unsigned char *d,
620 long len) 614 long len)
621{ 615{
622 int ret; 616 int ret;
623 const unsigned char *p;
624 EVP_PKEY *pkey; 617 EVP_PKEY *pkey;
625 618
626 p = d; 619 if ((pkey = d2i_PrivateKey(type, NULL, &d, (long)len)) == NULL) {
627 if ((pkey = d2i_PrivateKey(type, NULL, &p,(long)len)) == NULL) {
628 SSLerrorx(ERR_R_ASN1_LIB); 620 SSLerrorx(ERR_R_ASN1_LIB);
629 return (0); 621 return (0);
630 } 622 }
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c
index b3ee7ef430..8ebeb273fe 100644
--- a/src/lib/libssl/ssl_sess.c
+++ b/src/lib/libssl/ssl_sess.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_sess.c,v 1.79 2018/03/20 15:28:12 tb Exp $ */ 1/* $OpenBSD: ssl_sess.c,v 1.80 2018/04/25 07:10:39 tb 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 *
@@ -1092,13 +1092,13 @@ void
1092 1092
1093void 1093void
1094SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(struct ssl_st *ssl, 1094SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(struct ssl_st *ssl,
1095 unsigned char *data, int len, int *copy)) 1095 const unsigned char *data, int len, int *copy))
1096{ 1096{
1097 ctx->internal->get_session_cb = cb; 1097 ctx->internal->get_session_cb = cb;
1098} 1098}
1099 1099
1100SSL_SESSION * 1100SSL_SESSION *
1101(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, 1101(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(SSL *ssl, const unsigned char *data,
1102 int len, int *copy) 1102 int len, int *copy)
1103{ 1103{
1104 return ctx->internal->get_session_cb; 1104 return ctx->internal->get_session_cb;
@@ -1158,7 +1158,7 @@ SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,
1158 1158
1159void 1159void
1160SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, 1160SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
1161 int (*cb)(SSL *ssl, unsigned char *cookie, unsigned int cookie_len)) 1161 int (*cb)(SSL *ssl, const unsigned char *cookie, unsigned int cookie_len))
1162{ 1162{
1163 ctx->internal->app_verify_cookie_cb = cb; 1163 ctx->internal->app_verify_cookie_cb = cb;
1164} 1164}