+ 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;
+}
+
+/* Allocate hash by OID string */
+
+SilcBool silc_hash_alloc_by_oid(const char *oid, SilcHash *new_hash)
+{
+ SilcHashObject *entry = NULL;
+ int i;
+
+ SILC_LOG_DEBUG(("Allocating new hash %s", oid));
+
+#ifndef SILC_SYMBIAN
+ /* Check list of registered hash functions */
+ 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;
+ }
+ }
+#endif /* SILC_SYMBIAN */
+
+ if (!entry) {
+ /* Check builtin hash function list */
+ for (i = 0; silc_default_hash[i].oid; i++) {
+ if (!strcmp(silc_default_hash[i].oid, oid)) {
+ entry = (SilcHashObject *)&(silc_default_hash[i]);
+ break;
+ }
+ }
+ }
+
+ if (entry) {
+ *new_hash = silc_calloc(1, sizeof(**new_hash));
+ if (!(*new_hash))
+ return FALSE;