Add wrap support, interrop with itself but not w2k3s-sp1
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18172 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -60,8 +60,8 @@ RCSID("$Id$");
|
|||||||
/*
|
/*
|
||||||
* WRAP in DCE-style have a fixed size header and no padding, the oid
|
* WRAP in DCE-style have a fixed size header and no padding, the oid
|
||||||
* and length over the WRAP header is a total of
|
* and length over the WRAP header is a total of
|
||||||
* GSS_ARCFOUR_WRAP_TOKEN_DCE_DER_HEADER_SIZE byte (ie total of 43
|
* GSS_ARCFOUR_WRAP_TOKEN_DCE_DER_HEADER_SIZE byte (ie total of 45
|
||||||
* bytes overhead).
|
* bytes overhead, remember the 2 bytes from APPL [0] SEQ).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GSS_ARCFOUR_WRAP_TOKEN_SIZE 32
|
#define GSS_ARCFOUR_WRAP_TOKEN_SIZE 32
|
||||||
@@ -354,9 +354,19 @@ _gssapi_wrap_arcfour(OM_uint32 * minor_status,
|
|||||||
if (conf_state)
|
if (conf_state)
|
||||||
*conf_state = 0;
|
*conf_state = 0;
|
||||||
|
|
||||||
datalen = input_message_buffer->length + 1 /* padding */;
|
datalen = input_message_buffer->length;
|
||||||
|
|
||||||
|
if ((context_handle->flags & GSS_C_DCE_STYLE) == 0) {
|
||||||
|
datalen += 1 /* padding */;
|
||||||
len = datalen + GSS_ARCFOUR_WRAP_TOKEN_SIZE;
|
len = datalen + GSS_ARCFOUR_WRAP_TOKEN_SIZE;
|
||||||
_gssapi_encap_length(len, &len, &total_len, GSS_KRB5_MECHANISM);
|
_gssapi_encap_length(len, &len, &total_len, GSS_KRB5_MECHANISM);
|
||||||
|
} else {
|
||||||
|
len = GSS_ARCFOUR_WRAP_TOKEN_SIZE;
|
||||||
|
_gssapi_encap_length(len, &len, &total_len, GSS_KRB5_MECHANISM);
|
||||||
|
assert(total_len == GSS_ARCFOUR_WRAP_TOKEN_SIZE + GSS_ARCFOUR_WRAP_TOKEN_DCE_DER_HEADER_SIZE);
|
||||||
|
assert(total_len - len == 2);
|
||||||
|
total_len += datalen;
|
||||||
|
}
|
||||||
|
|
||||||
output_message_buffer->length = total_len;
|
output_message_buffer->length = total_len;
|
||||||
output_message_buffer->value = malloc (total_len);
|
output_message_buffer->value = malloc (total_len);
|
||||||
@@ -407,6 +417,8 @@ _gssapi_wrap_arcfour(OM_uint32 * minor_status,
|
|||||||
/* p points to data */
|
/* p points to data */
|
||||||
p = p0 + GSS_ARCFOUR_WRAP_TOKEN_SIZE;
|
p = p0 + GSS_ARCFOUR_WRAP_TOKEN_SIZE;
|
||||||
memcpy(p, input_message_buffer->value, input_message_buffer->length);
|
memcpy(p, input_message_buffer->value, input_message_buffer->length);
|
||||||
|
|
||||||
|
if ((context_handle->flags & GSS_C_DCE_STYLE) == 0)
|
||||||
p[input_message_buffer->length] = 1; /* PADDING */
|
p[input_message_buffer->length] = 1; /* PADDING */
|
||||||
|
|
||||||
ret = arcfour_mic_cksum(key, KRB5_KU_USAGE_SEAL,
|
ret = arcfour_mic_cksum(key, KRB5_KU_USAGE_SEAL,
|
||||||
@@ -624,7 +636,8 @@ OM_uint32 _gssapi_unwrap_arcfour(OM_uint32 *minor_status,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
output_message_buffer->length -= padlen;
|
output_message_buffer->length -= padlen;
|
||||||
}
|
} else
|
||||||
|
padlen = 0;
|
||||||
|
|
||||||
ret = arcfour_mic_cksum(key, KRB5_KU_USAGE_SEAL,
|
ret = arcfour_mic_cksum(key, KRB5_KU_USAGE_SEAL,
|
||||||
cksum_data, sizeof(cksum_data),
|
cksum_data, sizeof(cksum_data),
|
||||||
|
Reference in New Issue
Block a user