|
@@ -0,0 +1,43 @@
|
|
|
|
+/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
|
|
|
+ *
|
|
|
|
+ * LibTomCrypt is a library that provides various cryptographic
|
|
|
|
+ * algorithms in a highly modular and flexible manner.
|
|
|
|
+ *
|
|
|
|
+ * The library is free for all purposes without any express
|
|
|
|
+ * guarantee it works.
|
|
|
|
+ */
|
|
|
|
+#include "tomcrypt_private.h"
|
|
|
|
+
|
|
|
|
+#ifdef LTC_DER
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ 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)
|
|
|
|
+{
|
|
|
|
+ unsigned long i;
|
|
|
|
+ char tmp[256] = { 0 };
|
|
|
|
+ int err;
|
|
|
|
+
|
|
|
|
+ if (o1 == NULL || o2 == NULL) return CRYPT_ERROR;
|
|
|
|
+
|
|
|
|
+ if (o2->type != LTC_ASN1_OBJECT_IDENTIFIER) return CRYPT_INVALID_ARG;
|
|
|
|
+
|
|
|
|
+ i = sizeof(tmp);
|
|
|
|
+ if ((err = pk_oid_num_to_str(o2->data, o2->size, tmp, &i)) != CRYPT_OK) {
|
|
|
|
+ return err;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (XSTRCMP(o1, tmp) != 0) {
|
|
|
|
+ return CRYPT_PK_INVALID_TYPE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return CRYPT_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/* ref: $Format:%D$ */
|
|
|
|
+/* git commit: $Format:%H$ */
|
|
|
|
+/* commit time: $Format:%ai$ */
|