diff options
author | Ben Laurie <ben@openssl.org> | 1999-04-18 01:25:43 +0400 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 1999-04-18 01:25:43 +0400 |
commit | e778802f53c8d47e96a6e4cbc776eb6e1d4c461a (patch) | |
tree | 719d4dd0fc69b355c6d8329af1f90b2c4f603548 /ssl | |
parent | d77b3054cd87c2b13fa0169931f74b8e0dac5252 (diff) |
Massive constification.
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/s2_clnt.c | 4 | ||||
-rw-r--r-- | ssl/s2_enc.c | 4 | ||||
-rw-r--r-- | ssl/s2_lib.c | 2 | ||||
-rw-r--r-- | ssl/s2_pkt.c | 2 | ||||
-rw-r--r-- | ssl/s2_srvr.c | 4 | ||||
-rw-r--r-- | ssl/s3_enc.c | 24 | ||||
-rw-r--r-- | ssl/s3_lib.c | 6 | ||||
-rw-r--r-- | ssl/s3_pkt.c | 15 | ||||
-rw-r--r-- | ssl/ssl.h | 16 | ||||
-rw-r--r-- | ssl/ssl2.h | 2 | ||||
-rw-r--r-- | ssl/ssl3.h | 8 | ||||
-rw-r--r-- | ssl/ssl_ciph.c | 14 | ||||
-rw-r--r-- | ssl/ssl_lib.c | 5 | ||||
-rw-r--r-- | ssl/ssl_locl.h | 8 | ||||
-rw-r--r-- | ssl/t1_enc.c | 14 |
15 files changed, 65 insertions, 63 deletions
diff --git a/ssl/s2_clnt.c b/ssl/s2_clnt.c index 46e14d82cd..8c3cbde177 100644 --- a/ssl/s2_clnt.c +++ b/ssl/s2_clnt.c @@ -536,8 +536,8 @@ SSL *s; unsigned char *p,*d; int clear,enc,karg,i; SSL_SESSION *sess; - EVP_CIPHER *c; - EVP_MD *md; + const EVP_CIPHER *c; + const EVP_MD *md; buf=(unsigned char *)s->init_buf->data; if (s->state == SSL2_ST_SEND_CLIENT_MASTER_KEY_A) diff --git a/ssl/s2_enc.c b/ssl/s2_enc.c index 63ebf28748..af12dc472f 100644 --- a/ssl/s2_enc.c +++ b/ssl/s2_enc.c @@ -65,8 +65,8 @@ int client; { /* Max number of bytes needed */ EVP_CIPHER_CTX *rs,*ws; - EVP_CIPHER *c; - EVP_MD *md; + const EVP_CIPHER *c; + const EVP_MD *md; int num; if (!ssl_cipher_get_evp(s->session,&c,&md,NULL)) diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c index e7581313c9..7241ea2cf9 100644 --- a/ssl/s2_lib.c +++ b/ssl/s2_lib.c @@ -67,7 +67,7 @@ static long ssl2_default_timeout(void ); static long ssl2_default_timeout(); #endif -char *ssl2_version_str="SSLv2" OPENSSL_VERSION_PTEXT; +const char *ssl2_version_str="SSLv2" OPENSSL_VERSION_PTEXT; #define SSL2_NUM_CIPHERS (sizeof(ssl2_ciphers)/sizeof(SSL_CIPHER)) diff --git a/ssl/s2_pkt.c b/ssl/s2_pkt.c index 96d9a1be55..e1b13ccf65 100644 --- a/ssl/s2_pkt.c +++ b/ssl/s2_pkt.c @@ -567,7 +567,7 @@ unsigned int len; /* lets try to actually write the data */ s->s2->wpend_tot=olen; - s->s2->wpend_buf=(char *)buf; + s->s2->wpend_buf=buf; s->s2->wpend_ret=len; diff --git a/ssl/s2_srvr.c b/ssl/s2_srvr.c index 930a47d4d3..c058b522bc 100644 --- a/ssl/s2_srvr.c +++ b/ssl/s2_srvr.c @@ -340,8 +340,8 @@ SSL *s; int export,i,n,keya,ek; unsigned char *p; SSL_CIPHER *cp; - EVP_CIPHER *c; - EVP_MD *md; + const EVP_CIPHER *c; + const EVP_MD *md; p=(unsigned char *)s->init_buf->data; if (s->state == SSL2_ST_GET_CLIENT_MASTER_KEY_A) diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index d79d9272d6..d1341af178 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c @@ -135,9 +135,9 @@ int which; unsigned char exp_iv[EVP_MAX_KEY_LENGTH]; unsigned char *ms,*key,*iv,*er1,*er2; EVP_CIPHER_CTX *dd; - EVP_CIPHER *c; + const EVP_CIPHER *c; COMP_METHOD *comp; - EVP_MD *m; + const EVP_MD *m; MD5_CTX md; int exp,n,i,j,k,cl; @@ -282,8 +282,8 @@ int ssl3_setup_key_block(s) SSL *s; { unsigned char *p; - EVP_CIPHER *c; - EVP_MD *hash; + const EVP_CIPHER *c; + const EVP_MD *hash; int num; SSL_COMP *comp; @@ -340,7 +340,7 @@ int send; EVP_CIPHER_CTX *ds; unsigned long l; int bs,i; - EVP_CIPHER *enc; + const EVP_CIPHER *enc; if (send) { @@ -411,7 +411,7 @@ SSL *s; void ssl3_finish_mac(s,buf,len) SSL *s; -unsigned char *buf; +const unsigned char *buf; int len; { EVP_DigestUpdate(&(s->s3->finish_dgst1),buf,len); @@ -486,7 +486,7 @@ int send; SSL3_RECORD *rec; unsigned char *mac_sec,*seq; EVP_MD_CTX md_ctx; - EVP_MD *hash; + const EVP_MD *hash; unsigned char *p,rec_char; unsigned int md_size; int npad,i; @@ -541,10 +541,10 @@ unsigned char *out; unsigned char *p; int len; { - static unsigned char *salt[3]={ - (unsigned char *)"A", - (unsigned char *)"BB", - (unsigned char *)"CCC", + static const unsigned char *salt[3]={ + (const unsigned char *)"A", + (const unsigned char *)"BB", + (const unsigned char *)"CCC", }; unsigned char buf[EVP_MAX_MD_SIZE]; EVP_MD_CTX ctx; @@ -554,7 +554,7 @@ int len; for (i=0; i<3; i++) { EVP_DigestInit(&ctx,s->ctx->sha1); - EVP_DigestUpdate(&ctx,salt[i],strlen((char *)salt[i])); + EVP_DigestUpdate(&ctx,salt[i],strlen((const char *)salt[i])); EVP_DigestUpdate(&ctx,p,len); EVP_DigestUpdate(&ctx,&(s->s3->client_random[0]), SSL3_RANDOM_SIZE); diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index ab0d012b38..444e554c27 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -60,7 +60,7 @@ #include "objects.h" #include "ssl_locl.h" -char *ssl3_version_str="SSLv3" OPENSSL_VERSION_PTEXT; +const char *ssl3_version_str="SSLv3" OPENSSL_VERSION_PTEXT; #define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers)/sizeof(SSL_CIPHER)) @@ -1039,7 +1039,7 @@ int len; if (s->s3->delay_buf_pop_ret == 0) { ret=ssl3_write_bytes(s,SSL3_RT_APPLICATION_DATA, - (char *)buf,len); + buf,len); if (ret <= 0) return(ret); s->s3->delay_buf_pop_ret=ret; @@ -1060,7 +1060,7 @@ int len; else { ret=ssl3_write_bytes(s,SSL3_RT_APPLICATION_DATA, - (char *)buf,len); + buf,len); if (ret <= 0) return(ret); } diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c index f5350bf1b7..6b1addc6ac 100644 --- a/ssl/s3_pkt.c +++ b/ssl/s3_pkt.c @@ -94,8 +94,9 @@ */ #ifndef NOPROTO -static int do_ssl3_write(SSL *s, int type, char *buf, unsigned int len); -static int ssl3_write_pending(SSL *s, int type, char *buf, unsigned int len); +static int do_ssl3_write(SSL *s, int type, const char *buf, unsigned int len); +static int ssl3_write_pending(SSL *s, int type, const char *buf, + unsigned int len); static int ssl3_get_record(SSL *s); static int do_compress(SSL *ssl); static int do_uncompress(SSL *ssl); @@ -477,7 +478,7 @@ SSL *ssl; int ssl3_write_bytes(s,type,buf,len) SSL *s; int type; -char *buf; +const char *buf; int len; { unsigned int tot,n,nw; @@ -514,7 +515,7 @@ int len; } if (type == SSL3_RT_HANDSHAKE) - ssl3_finish_mac(s,(unsigned char *)&(buf[tot]),i); + ssl3_finish_mac(s,&(buf[tot]),i); if (i == (int)n) return(tot+i); @@ -526,7 +527,7 @@ int len; static int do_ssl3_write(s,type,buf,len) SSL *s; int type; -char *buf; +const char *buf; unsigned int len; { unsigned char *p,*plen; @@ -644,7 +645,7 @@ err: static int ssl3_write_pending(s,type,buf,len) SSL *s; int type; -char *buf; +const char *buf; unsigned int len; { int i; @@ -975,7 +976,7 @@ start: } if (type == SSL3_RT_HANDSHAKE) - ssl3_finish_mac(s,(unsigned char *)buf,n); + ssl3_finish_mac(s,buf,n); return(n); f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); @@ -162,7 +162,7 @@ typedef struct ssl_st *ssl_crock_st; typedef struct ssl_cipher_st { int valid; - char *name; /* text name */ + const char *name; /* text name */ unsigned long id; /* id, 4 bytes, first is version */ unsigned long algorithms; /* what ciphers are used */ unsigned long algorithm2; /* Extra flags */ @@ -416,9 +416,9 @@ struct ssl_ctx_st CRYPTO_EX_DATA ex_data; - EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */ - EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */ - EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ + const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */ + const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */ + const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ STACK_OF(X509) *extra_certs; STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ @@ -546,7 +546,7 @@ struct ssl_st * the ones to be 'copied' into these ones */ EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ - EVP_MD *read_hash; /* used for mac generation */ + const EVP_MD *read_hash; /* used for mac generation */ #ifdef HEADER_COMP_H COMP_CTX *expand; /* uncompress */ #else @@ -554,7 +554,7 @@ struct ssl_st #endif EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ - EVP_MD *write_hash; /* used for mac generation */ + const EVP_MD *write_hash; /* used for mac generation */ #ifdef HEADER_COMP_H COMP_CTX *compress; /* compression */ #else @@ -837,10 +837,10 @@ void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm); SSL_CIPHER *SSL_get_current_cipher(SSL *s); int SSL_CIPHER_get_bits(SSL_CIPHER *c,int *alg_bits); char * SSL_CIPHER_get_version(SSL_CIPHER *c); -char * SSL_CIPHER_get_name(SSL_CIPHER *c); +const char * SSL_CIPHER_get_name(SSL_CIPHER *c); int SSL_get_fd(SSL *s); -char * SSL_get_cipher_list(SSL *s,int n); +const char * SSL_get_cipher_list(SSL *s,int n); char * SSL_get_shared_ciphers(SSL *s, char *buf, int len); int SSL_get_read_ahead(SSL * s); int SSL_pending(SSL *s); diff --git a/ssl/ssl2.h b/ssl/ssl2.h index 95e8231dfc..4d75e93740 100644 --- a/ssl/ssl2.h +++ b/ssl/ssl2.h @@ -162,7 +162,7 @@ typedef struct ssl2_ctx_st * args were passwd */ unsigned int wnum; /* number of bytes sent so far */ int wpend_tot; - char *wpend_buf; + const char *wpend_buf; int wpend_off; /* offset to data to write */ int wpend_len; /* number of bytes passwd to write */ diff --git a/ssl/ssl3.h b/ssl/ssl3.h index d334c90c3d..cf34e978f1 100644 --- a/ssl/ssl3.h +++ b/ssl/ssl3.h @@ -286,7 +286,7 @@ typedef struct ssl3_ctx_st int wpend_tot; /* number bytes written */ int wpend_type; int wpend_ret; /* number of bytes submitted */ - char *wpend_buf; + const char *wpend_buf; /* used during startup, digest all incoming/outgoing packets */ EVP_MD_CTX finish_dgst1; @@ -338,10 +338,10 @@ typedef struct ssl3_ctx_st int key_block_length; unsigned char *key_block; - EVP_CIPHER *new_sym_enc; - EVP_MD *new_hash; + const EVP_CIPHER *new_sym_enc; + const EVP_MD *new_hash; #ifdef HEADER_COMP_H - SSL_COMP *new_compression; + const SSL_COMP *new_compression; #else char *new_compression; #endif diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index f53d688d89..2b95ee6aff 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c @@ -70,7 +70,7 @@ #define SSL_ENC_NULL_IDX 6 #define SSL_ENC_NUM_IDX 7 -static EVP_CIPHER *ssl_cipher_methods[SSL_ENC_NUM_IDX]={ +static const EVP_CIPHER *ssl_cipher_methods[SSL_ENC_NUM_IDX]={ NULL,NULL,NULL,NULL,NULL,NULL, }; @@ -79,7 +79,7 @@ static STACK_OF(SSL_COMP) *ssl_comp_methods=NULL; #define SSL_MD_MD5_IDX 0 #define SSL_MD_SHA1_IDX 1 #define SSL_MD_NUM_IDX 2 -static EVP_MD *ssl_digest_methods[SSL_MD_NUM_IDX]={ +static const EVP_MD *ssl_digest_methods[SSL_MD_NUM_IDX]={ NULL,NULL, }; @@ -187,8 +187,8 @@ static void load_ciphers() int ssl_cipher_get_evp(s,enc,md,comp) SSL_SESSION *s; -EVP_CIPHER **enc; -EVP_MD **md; +const EVP_CIPHER **enc; +const EVP_MD **md; SSL_COMP **comp; { int i; @@ -750,7 +750,7 @@ SSL_CIPHER *c; } /* return the actual cipher being used */ -char *SSL_CIPHER_get_name(c) +const char *SSL_CIPHER_get_name(c) SSL_CIPHER *c; { if (c != NULL) @@ -764,8 +764,8 @@ SSL_CIPHER *c; int *alg_bits; { int ret=0,a=0; - EVP_CIPHER *enc; - EVP_MD *md; + const EVP_CIPHER *enc; + const EVP_MD *md; SSL_SESSION ss; if (c != NULL) diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 566d112d07..2fad1c32c3 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -736,7 +736,7 @@ STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s) } /** The old interface to get the same thing as SSL_get_ciphers() */ -char *SSL_get_cipher_list(SSL *s,int n) +const char *SSL_get_cipher_list(SSL *s,int n) { SSL_CIPHER *c; STACK_OF(SSL_CIPHER) *sk; @@ -775,7 +775,8 @@ int SSL_set_cipher_list(SSL *s,char *str) /* works well for SSLv2, not so good for SSLv3 */ char *SSL_get_shared_ciphers(SSL *s,char *buf,int len) { - char *p,*cp; + char *p; + const char *cp; STACK_OF(SSL_CIPHER) *sk; SSL_CIPHER *c; int i; diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index a29994b1e1..870dcf27de 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -367,8 +367,8 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(SSL_METHOD *meth, STACK_OF(SSL_CIPHER) **sorted, char *str); void ssl_update_cache(SSL *s, int mode); -int ssl_cipher_get_evp(SSL_SESSION *s, EVP_CIPHER **enc, EVP_MD **md, - SSL_COMP **comp); +int ssl_cipher_get_evp(SSL_SESSION *s,const EVP_CIPHER **enc,const EVP_MD **md, + SSL_COMP **comp); int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); int ssl_undefined_function(SSL *s); X509 *ssl_get_server_send_cert(SSL *); @@ -427,11 +427,11 @@ int ssl3_renegotiate_check(SSL *ssl); int ssl3_dispatch_alert(SSL *s); int ssl3_read_bytes(SSL *s, int type, char *buf, int len); int ssl3_part_read(SSL *s, int i); -int ssl3_write_bytes(SSL *s, int type, char *buf, int len); +int ssl3_write_bytes(SSL *s, int type, const char *buf, int len); int ssl3_final_finish_mac(SSL *s, EVP_MD_CTX *ctx1,EVP_MD_CTX *ctx2, unsigned char *sender, int slen,unsigned char *p); int ssl3_cert_verify_mac(SSL *s, EVP_MD_CTX *in, unsigned char *p); -void ssl3_finish_mac(SSL *s, unsigned char *buf, int len); +void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len); int ssl3_enc(SSL *s, int send_data); int ssl3_mac(SSL *ssl, unsigned char *md, int send_data); unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c index 0f5cbd326a..4e783c23a4 100644 --- a/ssl/t1_enc.c +++ b/ssl/t1_enc.c @@ -175,9 +175,9 @@ int which; unsigned char *ms,*key,*iv,*er1,*er2; int client_write; EVP_CIPHER_CTX *dd; - EVP_CIPHER *c; - SSL_COMP *comp; - EVP_MD *m; + const EVP_CIPHER *c; + const SSL_COMP *comp; + const EVP_MD *m; int _exp,n,i,j,k,exp_label_len,cl; _exp=SSL_C_IS_EXPORT(s->s3->tmp.new_cipher); @@ -346,8 +346,8 @@ int tls1_setup_key_block(s) SSL *s; { unsigned char *p1,*p2; - EVP_CIPHER *c; - EVP_MD *hash; + const EVP_CIPHER *c; + const EVP_MD *hash; int num; SSL_COMP *comp; @@ -407,7 +407,7 @@ int send; EVP_CIPHER_CTX *ds; unsigned long l; int bs,i,ii,j,k,n=0; - EVP_CIPHER *enc; + const EVP_CIPHER *enc; if (send) { @@ -549,7 +549,7 @@ int send; { SSL3_RECORD *rec; unsigned char *mac_sec,*seq; - EVP_MD *hash; + const EVP_MD *hash; unsigned int md_size; int i; HMAC_CTX hmac; |