+typedef int sk_cmp_fn_type(const char * const *a, const char * const *b);
+
+int OBJ_add_sigid(int signid, int dig_id, int pkey_id)
+ {
+ nid_triple *ntr;
+ if (!sig_app)
+ sig_app = sk_new((sk_cmp_fn_type *)cmp_sig_sk);
+ if (!sig_app)
+ return 0;
+ if (!sigx_app)
+ sigx_app = sk_new((sk_cmp_fn_type *)cmp_sigx);
+ if (!sigx_app)
+ return 0;
+ ntr = OPENSSL_malloc(sizeof(int) * 3);
+ if (!ntr)
+ return 0;
+ (*ntr)[0] = signid;
+ (*ntr)[1] = dig_id;
+ (*ntr)[2] = pkey_id;
+
+ if (!sk_push(sig_app, (char *)ntr))
+ {
+ OPENSSL_free(ntr);
+ return 0;
+ }
+
+ if (!sk_push(sigx_app, (char *)ntr))
+ return 0;
+
+ sk_sort(sig_app);
+ sk_sort(sigx_app);
+
+ return 1;
+ }
+
+static void sid_free(void *x)
+ {
+ nid_triple *tt = (nid_triple *)x;
+ OPENSSL_free(tt);
+ }
+
+void OBJ_sigid_free(void)
+ {
+ if (sig_app)
+ {
+ sk_pop_free(sig_app, sid_free);
+ sig_app = NULL;
+ }
+ if (sigx_app)
+ {
+ sk_free(sigx_app);
+ sigx_app = NULL;
+ }
+ }
+