projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Integer type name change.
[silc.git]
/
lib
/
silccrypt
/
silchash.c
diff --git
a/lib/silccrypt/silchash.c
b/lib/silccrypt/silchash.c
index f508c836e3bfa87898cd59ad7bbe0a87f96461b1..4bb91087de51a278d8478aefd2cbc773f54a221c 100644
(file)
--- a/
lib/silccrypt/silchash.c
+++ b/
lib/silccrypt/silchash.c
@@
-47,6
+47,16
@@
bool silc_hash_register(SilcHashObject *hash)
SILC_LOG_DEBUG(("Registering new hash function `%s'", hash->name));
SILC_LOG_DEBUG(("Registering new hash function `%s'", hash->name));
+ /* Check for existing */
+ if (silc_hash_list) {
+ SilcHashObject *entry;
+ silc_dlist_start(silc_hash_list);
+ while ((entry = silc_dlist_get(silc_hash_list)) != SILC_LIST_END) {
+ if (!strcmp(entry->name, hash->name))
+ return FALSE;
+ }
+ }
+
new = silc_calloc(1, sizeof(*new));
new->name = strdup(hash->name);
new->hash_len = hash->hash_len;
new = silc_calloc(1, sizeof(*new));
new->name = strdup(hash->name);
new->hash_len = hash->hash_len;
@@
-144,7
+154,7
@@
void silc_hash_free(SilcHash hash)
/* Returns the length of the hash digest. */
/* Returns the length of the hash digest. */
-
ui
nt32 silc_hash_len(SilcHash hash)
+
SilcUI
nt32 silc_hash_len(SilcHash hash)
{
return hash->hash->hash_len;
}
{
return hash->hash->hash_len;
}
@@
-195,7
+205,7
@@
char *silc_hash_get_supported(void)
/* Creates the hash value and returns it to the return_hash argument. */
void silc_hash_make(SilcHash hash, const unsigned char *data,
/* Creates the hash value and returns it to the return_hash argument. */
void silc_hash_make(SilcHash hash, const unsigned char *data,
-
ui
nt32 len, unsigned char *return_hash)
+
SilcUI
nt32 len, unsigned char *return_hash)
{
hash->hash->init(hash->context);
hash->hash->update(hash->context, (unsigned char *)data, len);
{
hash->hash->init(hash->context);
hash->hash->update(hash->context, (unsigned char *)data, len);
@@
-207,7
+217,7
@@
void silc_hash_make(SilcHash hash, const unsigned char *data,
caller. */
char *silc_hash_fingerprint(SilcHash hash, const unsigned char *data,
caller. */
char *silc_hash_fingerprint(SilcHash hash, const unsigned char *data,
-
ui
nt32 data_len)
+
SilcUI
nt32 data_len)
{
SilcHash new_hash = NULL;
unsigned char h[32];
{
SilcHash new_hash = NULL;
unsigned char h[32];
@@
-235,7
+245,7
@@
static const char co[]= "bcdfghklmnprstvzx";
fingerprint to the babbleprint. */
char *silc_hash_babbleprint(SilcHash hash, const unsigned char *data,
fingerprint to the babbleprint. */
char *silc_hash_babbleprint(SilcHash hash, const unsigned char *data,
-
ui
nt32 data_len)
+
SilcUI
nt32 data_len)
{
SilcHash new_hash = NULL;
char *babbleprint;
{
SilcHash new_hash = NULL;
char *babbleprint;