Browse Source

updated relay station to check for tag with context string (server_ip || first 4 bytes of ClientHello random)

cecylia 7 years ago
parent
commit
d7dc2bc9c9
1 changed files with 4 additions and 8 deletions
  1. 4 8
      relay_station/crypto.c

+ 4 - 8
relay_station/crypto.c

@@ -1468,14 +1468,10 @@ void check_handshake(struct packet_info *info){
 		fclose(fp);
 
 		/* check tag*/ 
-		res = check_tag(key, privkey, p, (const byte *)"context", 7);
-
-                if(res){
-                    printf("No tag found\n");
-                } else {
-                    printf("Tag found!\n");
-                }
-
+                uint8_t context[4 + SSL3_RANDOM_SIZE - PTWIST_TAG_BYTES];
+                memcpy(context, &info->ip_hdr->dst.s_addr, 4);
+                memcpy(context + 4, hello_rand, SSL3_RANDOM_SIZE - PTWIST_TAG_BYTES);
+		res = check_tag(key, privkey, p, (const byte *)context, sizeof(context));
 		if (!res) {
 
 #ifdef DEBUG