Changeset View
Changeset View
Standalone View
Standalone View
crypto/heimdal/lib/gssapi/ntlm/crypto.c
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | |||||
v2_sign_message(gss_buffer_t in, | v2_sign_message(gss_buffer_t in, | ||||
unsigned char signkey[16], | unsigned char signkey[16], | ||||
RC4_KEY *sealkey, | RC4_KEY *sealkey, | ||||
uint32_t seq, | uint32_t seq, | ||||
unsigned char out[16]) | unsigned char out[16]) | ||||
{ | { | ||||
unsigned char hmac[16]; | unsigned char hmac[16]; | ||||
unsigned int hmaclen; | unsigned int hmaclen; | ||||
HMAC_CTX c; | HMAC_CTX *c; | ||||
HMAC_CTX_init(&c); | c = HMAC_CTX_new(); | ||||
HMAC_Init_ex(&c, signkey, 16, EVP_md5(), NULL); | if (c == NULL) | ||||
return GSS_S_FAILURE; | |||||
HMAC_Init_ex(c, signkey, 16, EVP_md5(), NULL); | |||||
encode_le_uint32(seq, hmac); | encode_le_uint32(seq, hmac); | ||||
HMAC_Update(&c, hmac, 4); | HMAC_Update(c, hmac, 4); | ||||
HMAC_Update(&c, in->value, in->length); | HMAC_Update(c, in->value, in->length); | ||||
HMAC_Final(&c, hmac, &hmaclen); | HMAC_Final(c, hmac, &hmaclen); | ||||
HMAC_CTX_cleanup(&c); | HMAC_CTX_free(c); | ||||
encode_le_uint32(1, &out[0]); | encode_le_uint32(1, &out[0]); | ||||
if (sealkey) | if (sealkey) | ||||
RC4(sealkey, 8, hmac, &out[4]); | RC4(sealkey, 8, hmac, &out[4]); | ||||
else | else | ||||
memcpy(&out[4], hmac, 8); | memcpy(&out[4], hmac, 8); | ||||
memset(&out[12], 0, 4); | memset(&out[12], 0, 4); | ||||
▲ Show 20 Lines • Show All 422 Lines • Show Last 20 Lines |