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
/
silchmac.c
diff --git
a/lib/silccrypt/silchmac.c
b/lib/silccrypt/silchmac.c
index 77dce315b4693961ee662c34300b4eb7dac9f15b..babadd05788bb6a4aac42eced701b0a0d147fb18 100644
(file)
--- a/
lib/silccrypt/silchmac.c
+++ b/
lib/silccrypt/silchmac.c
@@
-27,7
+27,7
@@
struct SilcHmacStruct {
bool allocated_hash; /* TRUE if the hash was allocated */
unsigned char *key;
bool allocated_hash; /* TRUE if the hash was allocated */
unsigned char *key;
-
ui
nt32 key_len;
+
SilcUI
nt32 key_len;
unsigned char inner_pad[64];
unsigned char outer_pad[64];
unsigned char inner_pad[64];
unsigned char outer_pad[64];
@@
-49,7
+49,7
@@
SilcHmacObject silc_default_hmacs[] =
};
static void silc_hmac_init_internal(SilcHmac hmac, unsigned char *key,
};
static void silc_hmac_init_internal(SilcHmac hmac, unsigned char *key,
-
ui
nt32 key_len)
+
SilcUI
nt32 key_len)
{
SilcHash hash = hmac->hash;
unsigned char hvalue[20];
{
SilcHash hash = hmac->hash;
unsigned char hvalue[20];
@@
-86,6
+86,16
@@
bool silc_hmac_register(SilcHmacObject *hmac)
SILC_LOG_DEBUG(("Registering new HMAC `%s'", hmac->name));
SILC_LOG_DEBUG(("Registering new HMAC `%s'", hmac->name));
+ /* Check for existing */
+ if (silc_hmac_list) {
+ SilcHmacObject *entry;
+ silc_dlist_start(silc_hmac_list);
+ while ((entry = silc_dlist_get(silc_hmac_list)) != SILC_LIST_END) {
+ if (!strcmp(entry->name, hmac->name))
+ return FALSE;
+ }
+ }
+
new = silc_calloc(1, sizeof(*new));
new->name = strdup(hmac->name);
new->len = hmac->len;
new = silc_calloc(1, sizeof(*new));
new->name = strdup(hmac->name);
new->len = hmac->len;
@@
-211,7
+221,7
@@
void silc_hmac_free(SilcHmac hmac)
/* Returns the length of the MAC that the HMAC will produce. */
/* Returns the length of the MAC that the HMAC will produce. */
-
ui
nt32 silc_hmac_len(SilcHmac hmac)
+
SilcUI
nt32 silc_hmac_len(SilcHmac hmac)
{
return hmac->hmac->len;
}
{
return hmac->hmac->len;
}
@@
-279,7
+289,7
@@
char *silc_hmac_get_supported()
/* Sets the HMAC key used in the HMAC creation */
void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
/* Sets the HMAC key used in the HMAC creation */
void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
-
ui
nt32 key_len)
+
SilcUI
nt32 key_len)
{
if (hmac->key) {
memset(hmac->key, 0, hmac->key_len);
{
if (hmac->key) {
memset(hmac->key, 0, hmac->key_len);
@@
-294,8
+304,8
@@
void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
uses the internal key set with silc_hmac_set_key. */
void silc_hmac_make(SilcHmac hmac, unsigned char *data,
uses the internal key set with silc_hmac_set_key. */
void silc_hmac_make(SilcHmac hmac, unsigned char *data,
-
ui
nt32 data_len, unsigned char *return_hash,
-
ui
nt32 *return_len)
+
SilcUI
nt32 data_len, unsigned char *return_hash,
+
SilcUI
nt32 *return_len)
{
SILC_LOG_DEBUG(("Making HMAC for message"));
{
SILC_LOG_DEBUG(("Making HMAC for message"));
@@
-308,10
+318,10
@@
void silc_hmac_make(SilcHmac hmac, unsigned char *data,
key. The key is sent as argument to the function. */
void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
key. The key is sent as argument to the function. */
void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
-
ui
nt32 data_len,
- unsigned char *key,
ui
nt32 key_len,
+
SilcUI
nt32 data_len,
+ unsigned char *key,
SilcUI
nt32 key_len,
unsigned char *return_hash,
unsigned char *return_hash,
-
ui
nt32 *return_len)
+
SilcUI
nt32 *return_len)
{
SILC_LOG_DEBUG(("Making HMAC for message"));
{
SILC_LOG_DEBUG(("Making HMAC for message"));
@@
-326,8
+336,8
@@
void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
routine allows these dangerous truncations. */
void silc_hmac_make_truncated(SilcHmac hmac, unsigned char *data,
routine allows these dangerous truncations. */
void silc_hmac_make_truncated(SilcHmac hmac, unsigned char *data,
-
ui
nt32 data_len,
-
ui
nt32 truncated_len,
+
SilcUI
nt32 data_len,
+
SilcUI
nt32 truncated_len,
unsigned char *return_hash)
{
unsigned char hvalue[20];
unsigned char *return_hash)
{
unsigned char hvalue[20];
@@
-351,7
+361,7
@@
void silc_hmac_init(SilcHmac hmac)
/* Same as above but with specific key */
void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
/* Same as above but with specific key */
void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
-
ui
nt32 key_len)
+
SilcUI
nt32 key_len)
{
SilcHash hash = hmac->hash;
{
SilcHash hash = hmac->hash;
@@
-368,7
+378,7
@@
void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
/* Add data to be used in the MAC computation. */
void silc_hmac_update(SilcHmac hmac, const unsigned char *data,
/* Add data to be used in the MAC computation. */
void silc_hmac_update(SilcHmac hmac, const unsigned char *data,
-
ui
nt32 data_len)
+
SilcUI
nt32 data_len)
{
SilcHash hash = hmac->hash;
hash->hash->update(hmac->hash_context, (unsigned char *)data, data_len);
{
SilcHash hash = hmac->hash;
hash->hash->update(hmac->hash_context, (unsigned char *)data, data_len);
@@
-377,7
+387,7
@@
void silc_hmac_update(SilcHmac hmac, const unsigned char *data,
/* Compute the final MAC. */
void silc_hmac_final(SilcHmac hmac, unsigned char *return_hash,
/* Compute the final MAC. */
void silc_hmac_final(SilcHmac hmac, unsigned char *return_hash,
-
ui
nt32 *return_len)
+
SilcUI
nt32 *return_len)
{
SilcHash hash = hmac->hash;
unsigned char mac[20];
{
SilcHash hash = hmac->hash;
unsigned char mac[20];