t1_enc.c (260403) | t1_enc.c (261037) |
---|---|
1/* ssl/t1_enc.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 906 unchanged lines hidden (view full) --- 915 916 EVP_MD_CTX_init(&ctx); 917 918 for (idx=0;ssl_get_handshake_digest(idx,&mask,&md);idx++) 919 { 920 if (mask & ssl_get_algorithm2(s)) 921 { 922 int hashsize = EVP_MD_size(md); | 1/* ssl/t1_enc.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 906 unchanged lines hidden (view full) --- 915 916 EVP_MD_CTX_init(&ctx); 917 918 for (idx=0;ssl_get_handshake_digest(idx,&mask,&md);idx++) 919 { 920 if (mask & ssl_get_algorithm2(s)) 921 { 922 int hashsize = EVP_MD_size(md); |
923 if (hashsize < 0 || hashsize > (int)(sizeof buf - (size_t)(q-buf))) | 923 EVP_MD_CTX *hdgst = s->s3->handshake_dgst[idx]; 924 if (!hdgst || hashsize < 0 || hashsize > (int)(sizeof buf - (size_t)(q-buf))) |
924 { 925 /* internal error: 'buf' is too small for this cipersuite! */ 926 err = 1; 927 } 928 else 929 { | 925 { 926 /* internal error: 'buf' is too small for this cipersuite! */ 927 err = 1; 928 } 929 else 930 { |
930 EVP_MD_CTX_copy_ex(&ctx,s->s3->handshake_dgst[idx]); 931 EVP_DigestFinal_ex(&ctx,q,&i); 932 if (i != (unsigned int)hashsize) /* can't really happen */ | 931 if (!EVP_MD_CTX_copy_ex(&ctx, hdgst) || 932 !EVP_DigestFinal_ex(&ctx,q,&i) || 933 (i != (unsigned int)hashsize)) |
933 err = 1; | 934 err = 1; |
934 q+=i; | 935 q+=hashsize; |
935 } 936 } 937 } 938 939 if (!tls1_PRF(ssl_get_algorithm2(s), 940 str,slen, buf,(int)(q-buf), NULL,0, NULL,0, NULL,0, 941 s->session->master_key,s->session->master_key_length, 942 out,buf2,sizeof buf2)) --- 310 unchanged lines hidden --- | 936 } 937 } 938 } 939 940 if (!tls1_PRF(ssl_get_algorithm2(s), 941 str,slen, buf,(int)(q-buf), NULL,0, NULL,0, NULL,0, 942 s->session->master_key,s->session->master_key_length, 943 out,buf2,sizeof buf2)) --- 310 unchanged lines hidden --- |