Example #1
0
int
decode_ContextFlags(const unsigned char *p, size_t len, ContextFlags *data, size_t *size)
{
size_t ret = 0, reallen;
size_t l;
int e;

memset(data, 0, sizeof(*data));
reallen = 0;
e = der_match_tag_and_length (p, len, UNIV, PRIM, UT_BitString,&reallen, &l);
FORW;
if(len < reallen)
return ASN1_OVERRUN;
p++;
len--;
reallen--;
ret++;
data->delegFlag = (*p >> 7) & 1;
data->mutualFlag = (*p >> 6) & 1;
data->replayFlag = (*p >> 5) & 1;
data->sequenceFlag = (*p >> 4) & 1;
data->anonFlag = (*p >> 3) & 1;
data->confFlag = (*p >> 2) & 1;
data->integFlag = (*p >> 1) & 1;
p += reallen; len -= reallen; ret += reallen;
if(size) *size = ret;
return 0;
fail:
free_ContextFlags(data);
return e;
}
Example #2
0
static void
free_NegTokenInit(NegTokenInit * data)
{
	free_MechTypeList(&(data)->mechTypes);
	if ((data)->reqFlags) {
		free_ContextFlags((data)->reqFlags);
		free((data)->reqFlags);
		(data)->reqFlags = NULL;
	}
	if ((data)->mechToken) {
		free_octet_string((data)->mechToken);
		free((data)->mechToken);
		(data)->mechToken = NULL;
	}
	if ((data)->mechListMIC) {
		free_octet_string((data)->mechListMIC);
		free((data)->mechListMIC);
		(data)->mechListMIC = NULL;
	}
}