+/* Allocate hash by OID string */
+
+SilcBool silc_hash_alloc_by_oid(const char *oid, SilcHash *new_hash)
+{
+ SilcHashObject *entry = NULL;
+
+ SILC_LOG_DEBUG(("Allocating new hash %s", oid));
+
+#ifndef SILC_SYMBIAN
+ if (silc_hash_list) {
+ silc_dlist_start(silc_hash_list);
+ while ((entry = silc_dlist_get(silc_hash_list)) != SILC_LIST_END) {
+ if (!strcmp(entry->oid, oid))
+ break;
+ }
+ }
+#else
+ {
+ /* On EPOC which don't have globals we check our constant hash list. */
+ int i;
+ for (i = 0; silc_default_hash[i].oid; i++) {
+ if (!strcmp(silc_default_hash[i].oid, oid)) {
+ entry = (SilcHashObject *)&(silc_default_hash[i]);
+ break;
+ }
+ }
+ }
+#endif /* SILC_SYMBIAN */
+
+ if (entry) {
+ *new_hash = silc_calloc(1, sizeof(**new_hash));
+ if (!(*new_hash))
+ return FALSE;
+ (*new_hash)->hash = entry;
+ (*new_hash)->context = silc_calloc(1, entry->context_len());
+ if (!(*new_hash)->context) {
+ silc_free(*new_hash);
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ return FALSE;
+}
+