Commit much improved ASN.1 compiler from joda-choice-branch.
Highlighs for the compiler is support for CHOICE and in general better support for tags. This compiler support most of what is needed for PK-INIT, LDAP, X.509, PKCS-12 and many other protocols. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15617 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003 - 2004 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 2003-2005 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -33,8 +33,6 @@
|
||||
|
||||
#include "der_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
int
|
||||
heim_oid_cmp(const heim_oid *p, const heim_oid *q)
|
||||
{
|
||||
@@ -52,3 +50,48 @@ heim_octet_string_cmp(const heim_octet_string *p, const heim_octet_string *q)
|
||||
return p->length - q->length;
|
||||
return memcmp(p->data, q->data, p->length);
|
||||
}
|
||||
|
||||
int
|
||||
heim_bit_string_cmp(const heim_bit_string *p, const heim_bit_string *q)
|
||||
{
|
||||
int i, r1, r2;
|
||||
if (p->length != q->length)
|
||||
return p->length - q->length;
|
||||
i = memcmp(p->data, q->data, p->length / 8);
|
||||
if (i)
|
||||
return i;
|
||||
i = p->length / 8;
|
||||
r1 = ((unsigned char *)p->data)[i];
|
||||
r2 = ((unsigned char *)q->data)[i];
|
||||
i = 8 - p->length % 8;
|
||||
r1 = r1 >> i;
|
||||
r2 = r2 >> i;
|
||||
return r1 - r2;
|
||||
}
|
||||
|
||||
int
|
||||
heim_integer_cmp(const heim_integer *p, const heim_integer *q)
|
||||
{
|
||||
if (p->length != q->length)
|
||||
return p->length - q->length;
|
||||
if (p->negative != q->negative)
|
||||
return p->negative - q->negative;
|
||||
return memcmp(p->data, q->data, p->length);
|
||||
}
|
||||
|
||||
int
|
||||
heim_bmp_string_cmp(const heim_bmp_string *p, const heim_bmp_string *q)
|
||||
{
|
||||
if (p->length != q->length)
|
||||
return p->length - q->length;
|
||||
return memcmp(p->data, q->data, q->length * sizeof(q->data[0]));
|
||||
}
|
||||
|
||||
int
|
||||
heim_universal_string_cmp(const heim_universal_string *p,
|
||||
const heim_universal_string *q)
|
||||
{
|
||||
if (p->length != q->length)
|
||||
return p->length - q->length;
|
||||
return memcmp(p->data, q->data, q->length * sizeof(q->data[0]));
|
||||
}
|
||||
|
Reference in New Issue
Block a user