~ubuntu-branches/ubuntu/lucid/openssl/lucid-proposed

« back to all changes in this revision

Viewing changes to ssl/t1_enc.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-06-13 18:15:46 UTC
  • mto: (11.1.5 squeeze)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090613181546-vbfntai3b009dl1u
Tags: upstream-0.9.8k
ImportĀ upstreamĀ versionĀ 0.9.8k

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
 
112
112
#include <stdio.h>
113
113
#include "ssl_locl.h"
 
114
#ifndef OPENSSL_NO_COMP
114
115
#include <openssl/comp.h>
 
116
#endif
115
117
#include <openssl/evp.h>
116
118
#include <openssl/hmac.h>
117
119
#include <openssl/md5.h>
 
120
#ifdef KSSL_DEBUG
 
121
#include <openssl/des.h>
 
122
#endif
118
123
 
119
124
static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec,
120
125
                        int sec_len, unsigned char *seed, int seed_len,
131
136
 
132
137
        HMAC_CTX_init(&ctx);
133
138
        HMAC_CTX_init(&ctx_tmp);
 
139
        HMAC_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
 
140
        HMAC_CTX_set_flags(&ctx_tmp, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
134
141
        HMAC_Init_ex(&ctx,sec,sec_len,md, NULL);
135
142
        HMAC_Init_ex(&ctx_tmp,sec,sec_len,md, NULL);
136
143
        HMAC_Update(&ctx,seed,seed_len);
249
256
#ifdef KSSL_DEBUG
250
257
        printf("tls1_change_cipher_state(which= %d) w/\n", which);
251
258
        printf("\talg= %ld, comp= %p\n", s->s3->tmp.new_cipher->algorithms,
252
 
                comp);
253
 
        printf("\tevp_cipher == %p ==? &d_cbc_ede_cipher3\n", c);
 
259
                (void *)comp);
 
260
        printf("\tevp_cipher == %p ==? &d_cbc_ede_cipher3\n", (void *)c);
254
261
        printf("\tevp_cipher: nid, blksz= %d, %d, keylen=%d, ivlen=%d\n",
255
262
                c->nid,c->block_size,c->key_len,c->iv_len);
256
263
        printf("\tkey_block: len= %d, data= ", s->s3->tmp.key_block_length);
257
264
        {
258
 
        int i;
259
 
        for (i=0; i<s->s3->tmp.key_block_length; i++)
260
 
                printf("%02x", key_block[i]);  printf("\n");
 
265
        int ki;
 
266
        for (ki=0; ki<s->s3->tmp.key_block_length; ki++)
 
267
                printf("%02x", key_block[ki]);  printf("\n");
261
268
        }
262
269
#endif  /* KSSL_DEBUG */
263
270
 
413
420
        s->session->key_arg_length=0;
414
421
#ifdef KSSL_DEBUG
415
422
        {
416
 
        int i;
 
423
        int ki;
417
424
        printf("EVP_CipherInit_ex(dd,c,key=,iv=,which)\n");
418
 
        printf("\tkey= "); for (i=0; i<c->key_len; i++) printf("%02x", key[i]);
 
425
        printf("\tkey= ");
 
426
        for (ki=0; ki<c->key_len; ki++) printf("%02x", key[ki]);
419
427
        printf("\n");
420
 
        printf("\t iv= "); for (i=0; i<c->iv_len; i++) printf("%02x", iv[i]);
 
428
        printf("\t iv= ");
 
429
        for (ki=0; ki<c->iv_len; ki++) printf("%02x", iv[ki]);
421
430
        printf("\n");
422
431
        }
423
432
#endif  /* KSSL_DEBUG */
590
599
                {
591
600
                unsigned long ui;
592
601
                printf("EVP_Cipher(ds=%p,rec->data=%p,rec->input=%p,l=%ld) ==>\n",
593
 
                        ds,rec->data,rec->input,l);
594
 
                printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%d %d], %d iv_len\n",
 
602
                        (void *)ds,rec->data,rec->input,l);
 
603
                printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%ld %ld], %d iv_len\n",
595
604
                        ds->buf_len, ds->cipher->key_len,
596
 
                        DES_KEY_SZ, DES_SCHEDULE_SZ,
 
605
                        (unsigned long)DES_KEY_SZ,
 
606
                        (unsigned long)DES_SCHEDULE_SZ,
597
607
                        ds->cipher->iv_len);
598
608
                printf("\t\tIV: ");
599
609
                for (i=0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]);
618
628
 
619
629
#ifdef KSSL_DEBUG
620
630
                {
621
 
                unsigned long i;
 
631
                unsigned long ki;
622
632
                printf("\trec->data=");
623
 
                for (i=0; i<l; i++)
624
 
                        printf(" %02x", rec->data[i]);  printf("\n");
 
633
                for (ki=0; ki<l; i++)
 
634
                        printf(" %02x", rec->data[ki]);  printf("\n");
625
635
                }
626
636
#endif  /* KSSL_DEBUG */
627
637
 
805
815
        unsigned char buff[SSL_MAX_MASTER_KEY_LENGTH];
806
816
 
807
817
#ifdef KSSL_DEBUG
808
 
        printf ("tls1_generate_master_secret(%p,%p, %p, %d)\n", s,out, p,len);
 
818
        printf ("tls1_generate_master_secret(%p,%p, %p, %d)\n", (void *)s,out, p,len);
809
819
#endif  /* KSSL_DEBUG */
810
820
 
811
821
        /* Setup the stuff to munge */
852
862
        case SSL_AD_INTERNAL_ERROR:     return(TLS1_AD_INTERNAL_ERROR);
853
863
        case SSL_AD_USER_CANCELLED:     return(TLS1_AD_USER_CANCELLED);
854
864
        case SSL_AD_NO_RENEGOTIATION:   return(TLS1_AD_NO_RENEGOTIATION);
 
865
#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
855
866
        case DTLS1_AD_MISSING_HANDSHAKE_MESSAGE: return 
856
867
                                          (DTLS1_AD_MISSING_HANDSHAKE_MESSAGE);
 
868
#endif
857
869
        default:                        return(-1);
858
870
                }
859
871
        }