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/x509v3/v3_genn.c | |
parent | 1c17d91c53ba73c907e0559d2bb80122dc7a8284 (diff) | |
download | openssl-c7235be6e36c4bef84594aa3b2f0561db84b63d8.zip openssl-c7235be6e36c4bef84594aa3b2f0561db84b63d8.tar.gz openssl-c7235be6e36c4bef84594aa3b2f0561db84b63d8.tar.bz2 |
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/x509v3/v3_genn.c')
-rw-r--r-- | crypto/x509v3/v3_genn.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/crypto/x509v3/v3_genn.c b/crypto/x509v3/v3_genn.c index 650b510..4dc8361 100644 --- a/crypto/x509v3/v3_genn.c +++ b/crypto/x509v3/v3_genn.c @@ -99,3 +99,62 @@ ASN1_ITEM_TEMPLATE(GENERAL_NAMES) = ASN1_ITEM_TEMPLATE_END(GENERAL_NAMES) IMPLEMENT_ASN1_FUNCTIONS(GENERAL_NAMES) + +GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a) + { + return (GENERAL_NAME *) ASN1_dup((int (*)()) i2d_GENERAL_NAME, + (char *(*)()) d2i_GENERAL_NAME, + (char *) a); + } + +/* Returns 0 if they are equal, != 0 otherwise. */ +int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b) + { + int result = -1; + + if (!a || !b || a->type != b->type) return -1; + switch(a->type) + { + case GEN_X400: + case GEN_EDIPARTY: + result = ASN1_TYPE_cmp(a->d.other, b->d.other); + break; + + case GEN_OTHERNAME: + result = OTHERNAME_cmp(a->d.otherName, b->d.otherName); + break; + + case GEN_EMAIL: + case GEN_DNS: + case GEN_URI: + result = ASN1_STRING_cmp(a->d.ia5, b->d.ia5); + break; + + case GEN_DIRNAME: + result = X509_NAME_cmp(a->d.dirn, b->d.dirn); + break; + + case GEN_IPADD: + result = ASN1_OCTET_STRING_cmp(a->d.ip, b->d.ip); + break; + + case GEN_RID: + result = OBJ_cmp(a->d.rid, b->d.rid); + break; + } + return result; + } + +/* Returns 0 if they are equal, != 0 otherwise. */ +int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b) + { + int result = -1; + + if (!a || !b) return -1; + /* Check their type first. */ + if ((result = OBJ_cmp(a->type_id, b->type_id)) != 0) + return result; + /* Check the value. */ + result = ASN1_TYPE_cmp(a->value, b->value); + return result; + } |