aboutsummaryrefslogtreecommitdiff
path: root/ssl
diff options
context:
space:
mode:
authorDavid von Oheimb <David.von.Oheimb@siemens.com>2019-01-15 21:51:25 +0100
committerMatt Caswell <matt@openssl.org>2019-03-06 16:10:09 +0000
commit9fdcc21fdc9d148f78d9cd5be34030f38cc45812 (patch)
tree20cba464edf2befc97c1888631dd782cba830c89 /ssl
parent27d5631236325c3fd8a3bd06af282ac496aac64b (diff)
downloadopenssl-9fdcc21fdc9d148f78d9cd5be34030f38cc45812.zip
openssl-9fdcc21fdc9d148f78d9cd5be34030f38cc45812.tar.gz
openssl-9fdcc21fdc9d148f78d9cd5be34030f38cc45812.tar.bz2
constify *_dup() and *i2d_*() and related functions as far as possible, introducing DECLARE_ASN1_DUP_FUNCTION
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8029)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/ssl_asn1.c10
-rw-r--r--ssl/ssl_locl.h2
-rw-r--r--ssl/ssl_sess.c4
3 files changed, 8 insertions, 8 deletions
diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c
index 4b70e38..e54d530 100644
--- a/ssl/ssl_asn1.c
+++ b/ssl/ssl_asn1.c
@@ -83,9 +83,9 @@ IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(SSL_SESSION_ASN1)
/* Initialise OCTET STRING from buffer and length */
static void ssl_session_oinit(ASN1_OCTET_STRING **dest, ASN1_OCTET_STRING *os,
- unsigned char *data, size_t len)
+ const unsigned char *data, size_t len)
{
- os->data = data;
+ os->data = (unsigned char *)data; /* justified cast: data is not modified */
os->length = (int)len;
os->flags = 0;
*dest = os;
@@ -93,15 +93,15 @@ static void ssl_session_oinit(ASN1_OCTET_STRING **dest, ASN1_OCTET_STRING *os,
/* Initialise OCTET STRING from string */
static void ssl_session_sinit(ASN1_OCTET_STRING **dest, ASN1_OCTET_STRING *os,
- char *data)
+ const char *data)
{
if (data != NULL)
- ssl_session_oinit(dest, os, (unsigned char *)data, strlen(data));
+ ssl_session_oinit(dest, os, (const unsigned char *)data, strlen(data));
else
*dest = NULL;
}
-int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp)
+int i2d_SSL_SESSION(const SSL_SESSION *in, unsigned char **pp)
{
SSL_SESSION_ASN1 as;
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
index a51cc6c..1d3397d 100644
--- a/ssl/ssl_locl.h
+++ b/ssl/ssl_locl.h
@@ -2271,7 +2271,7 @@ __owur int ssl_get_new_session(SSL *s, int session);
__owur SSL_SESSION *lookup_sess_in_cache(SSL *s, const unsigned char *sess_id,
size_t sess_id_len);
__owur int ssl_get_prev_session(SSL *s, CLIENTHELLO_MSG *hello);
-__owur SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket);
+__owur SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket);
__owur int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b);
DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id);
__owur int ssl_cipher_ptr_id_cmp(const SSL_CIPHER *const *ap,
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 58f38d5..d04b4fa 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -94,7 +94,7 @@ SSL_SESSION *SSL_SESSION_new(void)
return ss;
}
-SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src)
+SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src)
{
return ssl_session_dup(src, 1);
}
@@ -103,7 +103,7 @@ SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src)
* Create a new SSL_SESSION and duplicate the contents of |src| into it. If
* ticket == 0 then no ticket information is duplicated, otherwise it is.
*/
-SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket)
+SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket)
{
SSL_SESSION *dest;