@@ -85,7 +85,7 @@ static const cipher_info_t cipher_info[NUM_PROTOCOLS] =
85
85
16 , /* block padding size */
86
86
SHA1_SIZE , /* digest size */
87
87
2 * (SHA1_SIZE + 16 + 16 ), /* key block size */
88
- hmac_sha1 , /* hmac algorithm */
88
+ hmac_sha1_v , /* hmac algorithm */
89
89
(crypt_func )AES_cbc_encrypt , /* encrypt */
90
90
(crypt_func )AES_cbc_decrypt /* decrypt */
91
91
},
@@ -96,7 +96,7 @@ static const cipher_info_t cipher_info[NUM_PROTOCOLS] =
96
96
16 , /* block padding size */
97
97
SHA1_SIZE , /* digest size */
98
98
2 * (SHA1_SIZE + 32 + 16 ), /* key block size */
99
- hmac_sha1 , /* hmac algorithm */
99
+ hmac_sha1_v , /* hmac algorithm */
100
100
(crypt_func )AES_cbc_encrypt , /* encrypt */
101
101
(crypt_func )AES_cbc_decrypt /* decrypt */
102
102
},
@@ -107,7 +107,7 @@ static const cipher_info_t cipher_info[NUM_PROTOCOLS] =
107
107
16 , /* block padding size */
108
108
SHA256_SIZE , /* digest size */
109
109
2 * (SHA256_SIZE + 32 + 16 ), /* key block size */
110
- hmac_sha256 , /* hmac algorithm */
110
+ hmac_sha256_v , /* hmac algorithm */
111
111
(crypt_func )AES_cbc_encrypt , /* encrypt */
112
112
(crypt_func )AES_cbc_decrypt /* decrypt */
113
113
},
@@ -118,7 +118,7 @@ static const cipher_info_t cipher_info[NUM_PROTOCOLS] =
118
118
16 , /* block padding size */
119
119
SHA256_SIZE , /* digest size */
120
120
2 * (SHA256_SIZE + 32 + 16 ), /* key block size */
121
- hmac_sha256 , /* hmac algorithm */
121
+ hmac_sha256_v , /* hmac algorithm */
122
122
(crypt_func )AES_cbc_encrypt , /* encrypt */
123
123
(crypt_func )AES_cbc_decrypt /* decrypt */
124
124
}
@@ -746,21 +746,24 @@ static void increment_write_sequence(SSL *ssl)
746
746
static void add_hmac_digest (SSL * ssl , int mode , uint8_t * hmac_header ,
747
747
const uint8_t * buf , int buf_len , uint8_t * hmac_buf )
748
748
{
749
- int hmac_len = buf_len + 8 + SSL_RECORD_SIZE ;
750
- uint8_t * t_buf = (uint8_t * )malloc (hmac_len );
749
+ const uint8_t * bufs [] = {
750
+ (mode == SSL_SERVER_WRITE || mode == SSL_CLIENT_WRITE ) ?
751
+ ssl -> write_sequence : ssl -> read_sequence ,
752
+ hmac_header ,
753
+ buf
754
+ };
751
755
752
- memcpy (t_buf , (mode == SSL_SERVER_WRITE || mode == SSL_CLIENT_WRITE ) ?
753
- ssl -> write_sequence : ssl -> read_sequence , 8 );
754
- memcpy (& t_buf [8 ], hmac_header , SSL_RECORD_SIZE );
755
- memcpy (& t_buf [8 + SSL_RECORD_SIZE ], buf , buf_len );
756
+ int lengths [] = {
757
+ 8 ,
758
+ SSL_RECORD_SIZE ,
759
+ buf_len
760
+ };
756
761
757
- ssl -> cipher_info -> hmac ( t_buf , hmac_len ,
762
+ ssl -> cipher_info -> hmac_v ( bufs , lengths , 3 ,
758
763
(mode == SSL_SERVER_WRITE || mode == SSL_CLIENT_READ ) ?
759
764
ssl -> server_mac : ssl -> client_mac ,
760
765
ssl -> cipher_info -> digest_size , hmac_buf );
761
766
762
- free (t_buf );
763
-
764
767
#if 0
765
768
print_blob ("record" , hmac_header , SSL_RECORD_SIZE );
766
769
print_blob ("buf" , buf , buf_len );
0 commit comments