|
Lines 165-176
mac_init(Mac *mac)
Link Here
|
| 165 |
u_char * |
165 |
u_char * |
| 166 |
mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen) |
166 |
mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen) |
| 167 |
{ |
167 |
{ |
| 168 |
static u_char m[EVP_MAX_MD_SIZE]; |
168 |
static u_char *m; |
| 169 |
u_char b[4], nonce[8]; |
169 |
u_char b[4], nonce[8]; |
| 170 |
|
170 |
|
| 171 |
if (mac->mac_len > sizeof(m)) |
171 |
/* malloc ensures m is longword aligned, which is needed by umac */ |
|
|
172 |
if (m == NULL) |
| 173 |
m = xmalloc(EVP_MAX_MD_SIZE); |
| 174 |
|
| 175 |
if (mac->mac_len > EVP_MAX_MD_SIZE) |
| 172 |
fatal("mac_compute: mac too long %u %lu", |
176 |
fatal("mac_compute: mac too long %u %lu", |
| 173 |
mac->mac_len, (u_long)sizeof(m)); |
177 |
mac->mac_len, EVP_MAX_MD_SIZE); |
| 174 |
|
178 |
|
| 175 |
switch (mac->type) { |
179 |
switch (mac->type) { |
| 176 |
case SSH_EVP: |
180 |
case SSH_EVP: |