summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/ssl/s2_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssl/ssl/s2_lib.c')
-rw-r--r--crypto/openssl/ssl/s2_lib.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/crypto/openssl/ssl/s2_lib.c b/crypto/openssl/ssl/s2_lib.c
index 01d1e97..5f8d7b1 100644
--- a/crypto/openssl/ssl/s2_lib.c
+++ b/crypto/openssl/ssl/s2_lib.c
@@ -54,6 +54,8 @@
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
+ *
+ * $FreeBSD$
*/
#include "ssl_locl.h"
@@ -415,7 +417,7 @@ int ssl2_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
return(3);
}
-int ssl2_generate_key_material(SSL *s)
+void ssl2_generate_key_material(SSL *s)
{
unsigned int i;
MD5_CTX ctx;
@@ -428,24 +430,14 @@ int ssl2_generate_key_material(SSL *s)
#endif
km=s->s2->key_material;
-
- if (s->session->master_key_length < 0 || s->session->master_key_length > sizeof s->session->master_key)
- {
- SSLerr(SSL_F_SSL2_GENERATE_KEY_MATERIAL, SSL_R_INTERNAL_ERROR);
- return 0;
- }
-
+ die(s->s2->key_material_length <= sizeof s->s2->key_material);
for (i=0; i<s->s2->key_material_length; i+=MD5_DIGEST_LENGTH)
{
- if (((km - s->s2->key_material) + MD5_DIGEST_LENGTH) > sizeof s->s2->key_material)
- {
- /* MD5_Final() below would write beyond buffer */
- SSLerr(SSL_F_SSL2_GENERATE_KEY_MATERIAL, SSL_R_INTERNAL_ERROR);
- return 0;
- }
-
MD5_Init(&ctx);
+ die(s->session->master_key_length >= 0
+ && s->session->master_key_length
+ < sizeof s->session->master_key);
MD5_Update(&ctx,s->session->master_key,s->session->master_key_length);
MD5_Update(&ctx,&c,1);
c++;
@@ -454,8 +446,6 @@ int ssl2_generate_key_material(SSL *s)
MD5_Final(km,&ctx);
km+=MD5_DIGEST_LENGTH;
}
-
- return 1;
}
void ssl2_return_error(SSL *s, int err)
@@ -480,20 +470,18 @@ void ssl2_write_error(SSL *s)
buf[2]=(s->error_code)&0xff;
/* state=s->rwstate;*/
-
- error=s->error; /* number of bytes left to write */
+ error=s->error;
s->error=0;
- if (error < 0 || error > sizeof buf) /* can't happen */
- return;
-
+ die(error >= 0 && error <= 3);
i=ssl2_write(s,&(buf[3-error]),error);
-
/* if (i == error) s->rwstate=state; */
if (i < 0)
s->error=error;
else if (i != s->error)
s->error=error-i;
+ /* else
+ s->error=0; */
}
int ssl2_shutdown(SSL *s)
OpenPOWER on IntegriCloud