|
@@ -11,10 +11,10 @@
|
|
#ifdef LTC_DER
|
|
#ifdef LTC_DER
|
|
|
|
|
|
/*
|
|
/*
|
|
- Compare an OID string to an OID element decoded from ASN.1.
|
|
|
|
|
|
+ Compare an OID string to an array of `unsigned long`.
|
|
@return CRYPT_OK if equal
|
|
@return CRYPT_OK if equal
|
|
*/
|
|
*/
|
|
-int pk_oid_cmp_with_asn1(const char *o1, const ltc_asn1_list *o2)
|
|
|
|
|
|
+int pk_oid_cmp_with_ulong(const char *o1, const unsigned long *o2, unsigned long o2size)
|
|
{
|
|
{
|
|
unsigned long i;
|
|
unsigned long i;
|
|
char tmp[256] = { 0 };
|
|
char tmp[256] = { 0 };
|
|
@@ -22,10 +22,8 @@ int pk_oid_cmp_with_asn1(const char *o1, const ltc_asn1_list *o2)
|
|
|
|
|
|
if (o1 == NULL || o2 == NULL) return CRYPT_ERROR;
|
|
if (o1 == NULL || o2 == NULL) return CRYPT_ERROR;
|
|
|
|
|
|
- if (o2->type != LTC_ASN1_OBJECT_IDENTIFIER) return CRYPT_INVALID_ARG;
|
|
|
|
-
|
|
|
|
i = sizeof(tmp);
|
|
i = sizeof(tmp);
|
|
- if ((err = pk_oid_num_to_str(o2->data, o2->size, tmp, &i)) != CRYPT_OK) {
|
|
|
|
|
|
+ if ((err = pk_oid_num_to_str(o2, o2size, tmp, &i)) != CRYPT_OK) {
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -36,6 +34,19 @@ int pk_oid_cmp_with_asn1(const char *o1, const ltc_asn1_list *o2)
|
|
return CRYPT_OK;
|
|
return CRYPT_OK;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ Compare an OID string to an OID element decoded from ASN.1.
|
|
|
|
+ @return CRYPT_OK if equal
|
|
|
|
+*/
|
|
|
|
+int pk_oid_cmp_with_asn1(const char *o1, const ltc_asn1_list *o2)
|
|
|
|
+{
|
|
|
|
+ if (o1 == NULL || o2 == NULL) return CRYPT_ERROR;
|
|
|
|
+
|
|
|
|
+ if (o2->type != LTC_ASN1_OBJECT_IDENTIFIER) return CRYPT_INVALID_ARG;
|
|
|
|
+
|
|
|
|
+ return pk_oid_cmp_with_ulong(o1, o2->data, o2->size);
|
|
|
|
+}
|
|
|
|
+
|
|
#endif
|
|
#endif
|
|
|
|
|
|
/* ref: $Format:%D$ */
|
|
/* ref: $Format:%D$ */
|