X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=ssl%2Fd1_srvr.c;h=962ae5688d25b8673a71a78b4be1c695a4636918;hb=6635b48cd15942a4ae5b43e638eff1db2b41122b;hp=c4118bb26fc172e9005d1f60ec4b1040455aa411;hpb=beb056b303bd5733a05a85eb8527d40901e79e1a;p=oweals%2Fopenssl.git diff --git a/ssl/d1_srvr.c b/ssl/d1_srvr.c index c4118bb26f..962ae5688d 100644 --- a/ssl/d1_srvr.c +++ b/ssl/d1_srvr.c @@ -121,11 +121,15 @@ #include #include #include +#include +#ifndef OPENSSL_NO_DH +#include +#endif -static SSL_METHOD *dtls1_get_server_method(int ver); +static const SSL_METHOD *dtls1_get_server_method(int ver); static int dtls1_send_hello_verify_request(SSL *s); -static SSL_METHOD *dtls1_get_server_method(int ver) +static const SSL_METHOD *dtls1_get_server_method(int ver) { if (ver == DTLS1_VERSION) return(DTLSv1_server_method()); @@ -133,33 +137,15 @@ static SSL_METHOD *dtls1_get_server_method(int ver) return(NULL); } -SSL_METHOD *DTLSv1_server_method(void) - { - static int init=1; - static SSL_METHOD DTLSv1_server_data; - - if (init) - { - CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); - - if (init) - { - memcpy((char *)&DTLSv1_server_data,(char *)dtlsv1_base_method(), - sizeof(SSL_METHOD)); - DTLSv1_server_data.ssl_accept=dtls1_accept; - DTLSv1_server_data.get_ssl_method=dtls1_get_server_method; - init=0; - } - - CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); - } - return(&DTLSv1_server_data); - } +IMPLEMENT_dtls1_meth_func(DTLSv1_server_method, + dtls1_accept, + ssl_undefined_function, + dtls1_get_server_method) int dtls1_accept(SSL *s) { BUF_MEM *buf; - unsigned long l,Time=time(NULL); + unsigned long l,Time=(unsigned long)time(NULL); void (*cb)(const SSL *ssl,int type,int val)=NULL; long num1; int ret= -1; @@ -673,14 +659,15 @@ int dtls1_send_server_hello(SSL *s) { unsigned char *buf; unsigned char *p,*d; - int i,sl; + int i; + unsigned int sl; unsigned long l,Time; if (s->state == SSL3_ST_SW_SRVR_HELLO_A) { buf=(unsigned char *)s->init_buf->data; p=s->s3->server_random; - Time=time(NULL); /* Time */ + Time=(unsigned long)time(NULL); /* Time */ l2n(Time,p); RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-sizeof(Time)); /* Do the message type and length last */ @@ -719,10 +706,14 @@ int dtls1_send_server_hello(SSL *s) p+=i; /* put the compression method */ +#ifdef OPENSSL_NO_COMP + *(p++)=0; +#else if (s->s3->tmp.new_compression == NULL) *(p++)=0; else *(p++)=s->s3->tmp.new_compression->id; +#endif /* do the header */ l=(p-d); @@ -1075,7 +1066,7 @@ int dtls1_send_certificate_request(SSL *s) d=(unsigned char *)buf->data; *(d++)=SSL3_MT_CERTIFICATE_REQUEST; l2n3(n,d); - l2n(s->d1->handshake_write_seq,d); + s2n(s->d1->handshake_write_seq,d); s->d1->handshake_write_seq++; /* we should now have things packed up, so lets send