+/* Delete a key by search constraint type from repository */
+
+static SilcBool silc_skr_del_entry(SilcSKR skr, SilcSKRFindType type,
+ void *type_data, SilcSKRKeyInternal key)
+{
+ SilcSKREntryStruct entry;
+
+ if (!type_data)
+ return FALSE;
+
+ entry.type = type;
+ entry.data = type_data;
+
+ return silc_hash_table_del_by_context(skr->keys, &entry, key);
+}
+
+/* This performs AND operation. Any entry already in `results' that is not
+ in `list' will be removed from `results'. */
+
+static SilcBool silc_skr_results_and(SilcDList list, SilcSKRStatus *status,
+ SilcDList *results)
+{
+ SilcSKRKeyInternal entry, r;
+
+ if (*results == NULL) {
+ *results = silc_dlist_init();
+ if (*results == NULL) {
+ *status |= SILC_SKR_NO_MEMORY;
+ return FALSE;
+ }
+ }
+
+ /* If results is empty, just add all entries from list to results */
+ if (!silc_dlist_count(*results)) {
+ silc_dlist_start(list);
+ while ((entry = silc_dlist_get(list)) != SILC_LIST_END)
+ silc_dlist_add(*results, entry);
+
+ return TRUE;
+ }
+
+ silc_dlist_start(*results);
+ while ((entry = silc_dlist_get(*results)) != SILC_LIST_END) {
+
+ /* Check if this entry is in list */
+ silc_dlist_start(list);
+ while ((r = silc_dlist_get(list)) != SILC_LIST_END) {
+ if (r == entry)
+ break;
+ }
+ if (r != SILC_LIST_END)
+ continue;
+
+ /* Remove from results */
+ silc_dlist_del(*results, entry);
+ }
+
+ /* If results became empty, we did not find any key */
+ if (!silc_dlist_count(*results)) {
+ SILC_LOG_DEBUG(("Not all search constraints found"));
+ *status |= SILC_SKR_NOT_FOUND;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/***************************** SILC Public Key ******************************/
+