*(*buf)++ = (unsigned char)mech->length;
memcpy(*buf, mech->elements, mech->length);
*buf += mech->length;
- if (tok_type != TOK_TYPE_NONE) {
- *(*buf)++ = (unsigned char)((tok_type>>8) & 0xff);
- *(*buf)++ = (unsigned char)(tok_type & 0xff);
- }
+ assert(tok_type != TOK_TYPE_NONE);
+ *(*buf)++ = (unsigned char)((tok_type>>8) & 0xff);
+ *(*buf)++ = (unsigned char)(tok_type & 0xff);
}
/*
size_t *body_size,
unsigned char **buf_in,
size_t toksize_in,
- enum gss_eap_token_type tok_type)
+ enum gss_eap_token_type *ret_tok_type)
{
unsigned char *buf = *buf_in;
ssize_t seqsize;
*minor = 0;
+ if (ret_tok_type != NULL)
+ *ret_tok_type = TOK_TYPE_NONE;
+
if ((toksize -= 1) < 0)
return GSS_S_DEFECTIVE_TOKEN;
return GSS_S_BAD_MECH;
}
- if (tok_type != TOK_TYPE_NONE) {
+ if (ret_tok_type != NULL) {
if ((toksize -= 2) < 0)
return GSS_S_DEFECTIVE_TOKEN;
- if ((*buf++ != ((tok_type >> 8) & 0xff)) ||
- (*buf++ != (tok_type & 0xff)))
- return GSS_S_DEFECTIVE_TOKEN;
+ *ret_tok_type = load_uint16_be(buf);
+ buf += 2;
}
*buf_in = buf;
*body_size = toksize;