Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2005 Pekka Riikonen
+ Copyright (C) 1997 - 2006 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
new = silc_calloc(1, sizeof(*new));
+ if (!new)
+ return FALSE;
new->name = strdup(hash->name);
+ if (!new->name) {
+ silc_free(new);
+ return FALSE;
+ }
new->hash_len = hash->hash_len;
new->block_len = hash->block_len;
new->init = hash->init;
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;
}
char *ret;
if (!hash) {
- silc_hash_alloc("sha1", &new_hash);
+ if (!silc_hash_alloc("sha1", &new_hash))
+ return NULL;
hash = new_hash;
}
int i, k, out_len;
if (!hash) {
- silc_hash_alloc("sha1", &new_hash);
+ if (!silc_hash_alloc("sha1", &new_hash))
+ return NULL;
hash = new_hash;
}
/* Encode babbleprint */
out_len = (((hash->hash->hash_len + 1) / 2) + 1) * 6;
babbleprint = silc_calloc(out_len, sizeof(*babbleprint));
+ if (!babbleprint) {
+ silc_hash_free(new_hash);
+ return NULL;
+ }
babbleprint[0] = co[16];
check = 1;