Constify security callbacks Reviewed-by: Viktor Dukhovni <viktor@openssl.org> MR: #1595
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 8915531..e17cffc 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c
@@ -132,7 +132,7 @@ #include "internal/threads.h" #include "ssl_locl.h" -static int ssl_security_default_callback(SSL *s, SSL_CTX *ctx, int op, +static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex); @@ -1062,7 +1062,7 @@ return 1; } -static int ssl_security_default_callback(SSL *s, SSL_CTX *ctx, int op, +static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex) { @@ -1144,12 +1144,12 @@ return 1; } -int ssl_security(SSL *s, int op, int bits, int nid, void *other) +int ssl_security(const SSL *s, int op, int bits, int nid, void *other) { return s->cert->sec_cb(s, NULL, op, bits, nid, other, s->cert->sec_ex); } -int ssl_ctx_security(SSL_CTX *ctx, int op, int bits, int nid, void *other) +int ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid, void *other) { return ctx->cert->sec_cb(NULL, ctx, op, bits, nid, other, ctx->cert->sec_ex);
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 2fa323a..94d0a22 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c
@@ -3786,14 +3786,14 @@ } void SSL_set_security_callback(SSL *s, - int (*cb) (SSL *s, SSL_CTX *ctx, int op, + int (*cb) (const SSL *s, const SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex)) { s->cert->sec_cb = cb; } -int (*SSL_get_security_callback(const SSL *s)) (SSL *s, SSL_CTX *ctx, int op, +int (*SSL_get_security_callback(const SSL *s)) (const SSL *s, const SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex) { return s->cert->sec_cb; @@ -3820,15 +3820,15 @@ } void SSL_CTX_set_security_callback(SSL_CTX *ctx, - int (*cb) (SSL *s, SSL_CTX *ctx, int op, + int (*cb) (const SSL *s, const SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex)) { ctx->cert->sec_cb = cb; } -int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (SSL *s, - SSL_CTX *ctx, +int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (const SSL *s, + const SSL_CTX *ctx, int op, int bits, int nid, void *other,
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index b9beca5..7e8f6a5 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h
@@ -1636,7 +1636,7 @@ custom_ext_methods cli_ext; custom_ext_methods srv_ext; /* Security callback */ - int (*sec_cb) (SSL *s, SSL_CTX *ctx, int op, int bits, int nid, + int (*sec_cb) (const SSL *s, const SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex); /* Security level */ int sec_level; @@ -1912,8 +1912,8 @@ __owur int ssl_build_cert_chain(SSL *s, SSL_CTX *ctx, int flags); __owur int ssl_cert_set_cert_store(CERT *c, X509_STORE *store, int chain, int ref); -__owur int ssl_security(SSL *s, int op, int bits, int nid, void *other); -__owur int ssl_ctx_security(SSL_CTX *ctx, int op, int bits, int nid, void *other); +__owur int ssl_security(const SSL *s, int op, int bits, int nid, void *other); +__owur int ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid, void *other); int ssl_undefined_function(SSL *s); __owur int ssl_undefined_void_function(void);