diff options
author | Ulf Möller <ulf@openssl.org> | 2006-02-12 23:11:56 +0000 |
---|---|---|
committer | Ulf Möller <ulf@openssl.org> | 2006-02-12 23:11:56 +0000 |
commit | c7235be6e36c4bef84594aa3b2f0561db84b63d8 (patch) | |
tree | d304c3d8ac064a1345d64f0e25a1eebf52e564a4 /crypto/asn1/a_type.c | |
parent | 1c17d91c53ba73c907e0559d2bb80122dc7a8284 (diff) | |
download | openssl-c7235be6e36c4bef84594aa3b2f0561db84b63d8.tar.gz |
RFC 3161 compliant time stamp request creation, response generation
and response verification.
Submitted by: Zoltan Glozik <zglozik@opentsa.org>
Reviewed by: Ulf Moeller
Diffstat (limited to 'crypto/asn1/a_type.c')
-rw-r--r-- | crypto/asn1/a_type.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/crypto/asn1/a_type.c b/crypto/asn1/a_type.c index a6acef16f3..c603741f39 100644 --- a/crypto/asn1/a_type.c +++ b/crypto/asn1/a_type.c @@ -82,3 +82,49 @@ void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) IMPLEMENT_STACK_OF(ASN1_TYPE) IMPLEMENT_ASN1_SET_OF(ASN1_TYPE) + +/* Returns 0 if they are equal, != 0 otherwise. */ +int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b) + { + int result = -1; + + if (!a || !b || a->type != b->type) return -1; + + switch (a->type) + { + case V_ASN1_OBJECT: + result = OBJ_cmp(a->value.object, b->value.object); + break; + case V_ASN1_NULL: + result = 0; /* They do not have content. */ + break; + case V_ASN1_INTEGER: + case V_ASN1_NEG_INTEGER: + case V_ASN1_ENUMERATED: + case V_ASN1_NEG_ENUMERATED: + case V_ASN1_BIT_STRING: + case V_ASN1_OCTET_STRING: + case V_ASN1_SEQUENCE: + case V_ASN1_SET: + case V_ASN1_NUMERICSTRING: + case V_ASN1_PRINTABLESTRING: + case V_ASN1_T61STRING: + case V_ASN1_VIDEOTEXSTRING: + case V_ASN1_IA5STRING: + case V_ASN1_UTCTIME: + case V_ASN1_GENERALIZEDTIME: + case V_ASN1_GRAPHICSTRING: + case V_ASN1_VISIBLESTRING: + case V_ASN1_GENERALSTRING: + case V_ASN1_UNIVERSALSTRING: + case V_ASN1_BMPSTRING: + case V_ASN1_UTF8STRING: + case V_ASN1_OTHER: + default: + result = ASN1_STRING_cmp((ASN1_STRING *) a->value.ptr, + (ASN1_STRING *) b->value.ptr); + break; + } + + return result; + } |