143 static unsigned char ssl3_pad_1[48]={
144 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
145 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
146 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
147 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
148 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
149 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36 };
151 static unsigned char ssl3_pad_2[48]={
152 0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
153 0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
154 0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
155 0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
156 0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,
157 0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c };
158 static int ssl3_handshake_mac(
SSL *s,
int md_nid,
159 const char *sender,
int len,
unsigned char *
p);
160 static int ssl3_generate_key_block(
SSL *s,
unsigned char *km,
int num)
168 #ifdef CHARSET_EBCDIC
203 memcpy(km,smd,(num-i));
218 unsigned char *
p,*mac_secret;
221 unsigned char *ms,*
key,*iv,*er1,*er2;
224 #ifndef OPENSSL_NO_COMP
229 int is_exp,n,i,j,k,cl;
237 #ifndef OPENSSL_NO_COMP
256 #ifndef OPENSSL_NO_COMP
292 #ifndef OPENSSL_NO_COMP
329 key= &(p[ n]); n+=j+j;
330 iv= &(p[ n]); n+=k+k;
337 ms= &(p[ n]); n+=i+j;
338 key= &(p[ n]); n+=j+k;
351 memcpy(mac_secret,ms,i);
408 #ifdef OPENSSL_NO_COMP
429 ret = ssl3_generate_key_block(s,p,num);
443 #ifndef OPENSSL_NO_RC4
496 if ((s->
session == NULL) || (ds == NULL) ||
509 if ((bs != 1) && send)
519 rec->
input[l-1]=(i-1);
524 if (l == 0 || l%bs != 0)
535 if ((bs != 1) && !send)
647 return(ssl3_handshake_mac(s,md_nid,NULL,0,p));
650 const char *sender,
int len,
unsigned char *
p)
653 ret=ssl3_handshake_mac(s,
NID_md5,sender,len,p);
655 ret+=ssl3_handshake_mac(s,
NID_sha1,sender,len,p);
658 static int ssl3_handshake_mac(
SSL *s,
int md_nid,
659 const char *sender,
int len,
unsigned char *
p)
715 unsigned char *mac_sec,*seq;
718 unsigned char *
p,rec_char;
719 unsigned int md_size;
742 npad=(48/md_size)*md_size;
778 if (seq[i] != 0)
break;
785 static const unsigned char *salt[3]={
786 #ifndef CHARSET_EBCDIC
787 (
const unsigned char *)
"A",
788 (
const unsigned char *)
"BB",
789 (
const unsigned char *)
"CCC",
791 (
const unsigned char *)
"\x41",
792 (
const unsigned char *)
"\x42\x42",
793 (
const unsigned char *)
"\x43\x43\x43",