Constify ASN1_TYPE_cmp add X509_ALGOR_cmp.
authorDr. Stephen Henson <steve@openssl.org>
Sun, 14 Dec 2014 23:14:15 +0000 (23:14 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 5 Jan 2015 14:52:55 +0000 (14:52 +0000)
Reviewed-by: Emilia Käsper <emilia@openssl.org>
crypto/asn1/a_type.c
crypto/asn1/asn1.h
crypto/asn1/x_algor.c
crypto/x509/x509.h

index a45d2f9d12ddbc52088b2c3fa2ab260695417965..5e1bc762d08bf67eb19ad9409e9cb4e114e15a45 100644 (file)
@@ -113,7 +113,7 @@ 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 ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b)
        {
        int result = -1;
 
index fc87e0ca7d9f52e3e31e191b0f43620f4a16d79d..9adee694b0764287ea23089f660ed0015c230589 100644 (file)
@@ -783,7 +783,7 @@ DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
 int ASN1_TYPE_get(ASN1_TYPE *a);
 void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
 int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
-int            ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b);
+int            ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
 
 ASN1_OBJECT *  ASN1_OBJECT_new(void );
 void           ASN1_OBJECT_free(ASN1_OBJECT *a);
index 274e456c738296480a58b4f46288001add228234..57cc956c20b2717eab16a71e8f98d0a485f8354a 100644 (file)
@@ -142,3 +142,14 @@ void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)
        X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL);
 
        }
+
+int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b)
+       {
+       int rv;
+       rv = OBJ_cmp(a->algorithm, b->algorithm);
+       if (rv)
+               return rv;
+       if (!a->parameter && !b->parameter)
+               return 0;
+       return ASN1_TYPE_cmp(a->parameter, b->parameter);
+       }
index 46c1d443b5c21c2586f43f59c66765372eab72a2..1376ddb52f69e86df4f221c4369757d84720afce 100644 (file)
@@ -772,6 +772,7 @@ int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval);
 void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
                                                X509_ALGOR *algor);
 void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
+int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);
 
 X509_NAME *X509_NAME_dup(X509_NAME *xn);
 X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);