Generate the encryption and decryption keys!
authorSteinar H. Gunderson <sesse@samfundet.no>
Sat, 5 Feb 2005 20:50:51 +0000 (20:50 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sat, 5 Feb 2005 20:50:51 +0000 (20:50 +0000)
secure.c

index 7c90ee2..47d5e80 100644 (file)
--- a/secure.c
+++ b/secure.c
@@ -156,6 +156,19 @@ sec_generate_keys(uint8 * client_key, uint8 * server_key, int rc4_key_size)
        /* Initialise RC4 state arrays */
        RC4_set_key(&rc4_decrypt_key, rc4_key_len, sec_decrypt_key);
        RC4_set_key(&rc4_encrypt_key, rc4_key_len, sec_encrypt_key);
+
+       {
+               int i;
+               printf("sec_decrypt_key: ");
+               for (i = 0; i < 16; ++i)
+                       printf("0x%02x ", sec_decrypt_key[i]);
+               printf("\n");
+               
+               printf("sec_encrypt_key: ");
+               for (i = 0; i < 16; ++i)
+                       printf("0x%02x ", sec_encrypt_key[i]);
+               printf("\n");
+       }
 }
 
 static uint8 pad_54[40] = {
@@ -715,6 +728,8 @@ sec_process_mcs_data(STREAM s)
        }
 }
 
+extern unsigned char cacert[];
+
 /* Receive secure transport packet */
 STREAM
 sec_recv(void)
@@ -777,6 +792,10 @@ sec_recv(void)
                                        printf("0x%x ", inr[i + SEC_RANDOM_SIZE]);
                                }
                                printf("\n");
+
+                               // now we can generate the keys
+                               sec_generate_keys(inr + SEC_RANDOM_SIZE, cacert, 8);
+                               continue;
                        }
                }