projects
/
silc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
704f131
)
Use SILC_HASH_MAXLEN in hash buffer instead of fixed values.
author
Pekka Riikonen
<priikone@silcnet.org>
Sat, 19 Nov 2005 20:45:58 +0000
(20:45 +0000)
committer
Pekka Riikonen
<priikone@silcnet.org>
Sat, 19 Nov 2005 20:45:58 +0000
(20:45 +0000)
14 files changed:
CHANGES
patch
|
blob
|
history
apps/silcd/command.c
patch
|
blob
|
history
apps/silcd/command_reply.c
patch
|
blob
|
history
apps/silcd/idlist.c
patch
|
blob
|
history
apps/silcd/packet_receive.c
patch
|
blob
|
history
apps/silcd/server.c
patch
|
blob
|
history
lib/silcclient/client_channel.c
patch
|
blob
|
history
lib/silcclient/client_notify.c
patch
|
blob
|
history
lib/silcclient/command.c
patch
|
blob
|
history
lib/silccrypt/silchash.c
patch
|
blob
|
history
lib/silccrypt/silchash.h
patch
|
blob
|
history
lib/silccrypt/silchmac.c
patch
|
blob
|
history
lib/silccrypt/silcpkcs.c
patch
|
blob
|
history
lib/silcske/silcske.c
patch
|
blob
|
history
diff --git
a/CHANGES
b/CHANGES
index 4753229ac6610496ea826e70d8889ceab546f555..25d7ebb3756c39cc941ebb2ec8b5883858e560a0 100644
(file)
--- a/
CHANGES
+++ b/
CHANGES
@@
-8,6
+8,9
@@
Sat Nov 19 17:34:51 EET 2005 Pekka Riikonen <priikone@silcnet.org>
Affected files are apps/silcd/protocol.c and
lib/silcclient/protocol.c.
Affected files are apps/silcd/protocol.c and
lib/silcclient/protocol.c.
+ * Added SILC_HASH_MAXLEN to lib/silccrypt/silchash.h, and changed
+ all hash buffers to use that instead of fixed values.
+
Wed Nov 16 15:47:12 EET 2005 Pekka Riikonen <priikone@silcnet.org>
* Added SHA-256 to crypto library. The SHA-256 takes now
Wed Nov 16 15:47:12 EET 2005 Pekka Riikonen <priikone@silcnet.org>
* Added SHA-256 to crypto library. The SHA-256 takes now
diff --git
a/apps/silcd/command.c
b/apps/silcd/command.c
index 13a0c3ce176794d35293f4b8e0e200c16605548b..fce57cfd6b9035b898aadf9fd0d2925ccf7d025a 100644
(file)
--- a/
apps/silcd/command.c
+++ b/
apps/silcd/command.c
@@
-3111,7
+3111,7
@@
SILC_SERVER_CMD_FUNC(cmode)
if (mode_mask & SILC_CHANNEL_MODE_HMAC) {
if (!(channel->mode & SILC_CHANNEL_MODE_HMAC)) {
/* HMAC to use protect the traffic */
if (mode_mask & SILC_CHANNEL_MODE_HMAC) {
if (!(channel->mode & SILC_CHANNEL_MODE_HMAC)) {
/* HMAC to use protect the traffic */
- unsigned char hash[
32
];
+ unsigned char hash[
SILC_HASH_MAXLEN
];
SilcHmac newhmac;
/* Get hmac */
SilcHmac newhmac;
/* Get hmac */
@@
-3147,7
+3147,7
@@
SILC_SERVER_CMD_FUNC(cmode)
/* Hmac mode is unset. Remove the hmac and revert back to
default hmac */
SilcHmac newhmac;
/* Hmac mode is unset. Remove the hmac and revert back to
default hmac */
SilcHmac newhmac;
- unsigned char hash[
32
];
+ unsigned char hash[
SILC_HASH_MAXLEN
];
hmac = channel->hmac_name;
/* Delete old hmac and allocate default one */
hmac = channel->hmac_name;
/* Delete old hmac and allocate default one */
@@
-4112,7
+4112,7
@@
SILC_SERVER_CMD_FUNC(watch)
SilcServer server = cmd->server;
char *add_nick, *del_nick;
SilcUInt32 add_nick_len, del_nick_len, tmp_len, pk_len;
SilcServer server = cmd->server;
char *add_nick, *del_nick;
SilcUInt32 add_nick_len, del_nick_len, tmp_len, pk_len;
- unsigned char hash[
16
], *tmp, *pk, *nick;
+ unsigned char hash[
SILC_HASH_MAXLEN
], *tmp, *pk, *nick;
SilcClientEntry client;
SilcClientID *client_id = NULL;
SilcUInt16 old_ident;
SilcClientEntry client;
SilcClientID *client_id = NULL;
SilcUInt16 old_ident;
diff --git
a/apps/silcd/command_reply.c
b/apps/silcd/command_reply.c
index 506c7f1e79b7094791a0a9e17c834b2bdecf159e..78dd08cfd9a358188b1e27e1bdbbd63b43d6f280 100644
(file)
--- a/
apps/silcd/command_reply.c
+++ b/
apps/silcd/command_reply.c
@@
-331,7
+331,7
@@
silc_server_command_reply_whois_save(SilcServerCommandReplyContext cmd)
if (server->server_type != SILC_ROUTER && !client->data.public_key) {
SilcAttributePayload attr;
SilcAttributeObjPk pk;
if (server->server_type != SILC_ROUTER && !client->data.public_key) {
SilcAttributePayload attr;
SilcAttributeObjPk pk;
- unsigned char f[
20
];
+ unsigned char f[
SILC_HASH_MAXLEN
];
SilcDList attrs = silc_attribute_payload_parse(tmp, len);
SILC_LOG_DEBUG(("Take client public key from attributes"));
SilcDList attrs = silc_attribute_payload_parse(tmp, len);
SILC_LOG_DEBUG(("Take client public key from attributes"));
diff --git
a/apps/silcd/idlist.c
b/apps/silcd/idlist.c
index 0a1561ce63dc62f5fb631d1c33d76af1bb94f876..a0e676e002fc41cfe01164b82103e6fb049b52f6 100644
(file)
--- a/
apps/silcd/idlist.c
+++ b/
apps/silcd/idlist.c
@@
-507,7
+507,7
@@
int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
{
SilcIDCacheList list = NULL;
SilcIDCacheEntry id_cache = NULL;
{
SilcIDCacheList list = NULL;
SilcIDCacheEntry id_cache = NULL;
- unsigned char hash[
32
];
+ unsigned char hash[
SILC_HASH_MAXLEN
];
SilcClientID client_id;
SILC_LOG_DEBUG(("Start"));
SilcClientID client_id;
SILC_LOG_DEBUG(("Start"));
diff --git
a/apps/silcd/packet_receive.c
b/apps/silcd/packet_receive.c
index 86c17cc2a10dc5ca8511d5582a74183cdcf88e5d..3a692fd3b688bd036202ab733d1c141ab0676b9c 100644
(file)
--- a/
apps/silcd/packet_receive.c
+++ b/
apps/silcd/packet_receive.c
@@
-752,7
+752,7
@@
void silc_server_notify(SilcServer server,
/* Get the hmac */
tmp = silc_argument_get_arg_type(args, 4, &tmp_len);
if (tmp) {
/* Get the hmac */
tmp = silc_argument_get_arg_type(args, 4, &tmp_len);
if (tmp) {
- unsigned char hash[
32
];
+ unsigned char hash[
SILC_HASH_MAXLEN
];
if (channel->hmac)
silc_hmac_free(channel->hmac);
if (channel->hmac)
silc_hmac_free(channel->hmac);
diff --git
a/apps/silcd/server.c
b/apps/silcd/server.c
index f5a2ffe71fd2d1fcb9d9ac48ca36d3541245f459..92afbb91b5a9b62d115b9c41fc74d7df25f0eaac 100644
(file)
--- a/
apps/silcd/server.c
+++ b/
apps/silcd/server.c
@@
-4129,7
+4129,7
@@
bool silc_server_create_channel_key(SilcServer server,
SilcUInt32 key_len)
{
int i;
SilcUInt32 key_len)
{
int i;
- unsigned char channel_key[32], hash[
32
];
+ unsigned char channel_key[32], hash[
SILC_HASH_MAXLEN
];
SilcUInt32 len;
if (channel->mode & SILC_CHANNEL_MODE_PRIVKEY) {
SilcUInt32 len;
if (channel->mode & SILC_CHANNEL_MODE_PRIVKEY) {
@@
-4212,7
+4212,7
@@
SilcChannelEntry silc_server_save_channel_key(SilcServer server,
{
SilcChannelKeyPayload payload = NULL;
SilcChannelID *id = NULL;
{
SilcChannelKeyPayload payload = NULL;
SilcChannelID *id = NULL;
- unsigned char *tmp, hash[
32
];
+ unsigned char *tmp, hash[
SILC_HASH_MAXLEN
];
SilcUInt32 tmp_len;
char *cipher;
SilcUInt32 tmp_len;
char *cipher;
diff --git
a/lib/silcclient/client_channel.c
b/lib/silcclient/client_channel.c
index b052ea23cf561512b0fd86a2a4d28809160a28a0..496d124cf71ae2508a47e570157397b7721d82f4 100644
(file)
--- a/
lib/silcclient/client_channel.c
+++ b/
lib/silcclient/client_channel.c
@@
-402,7
+402,7
@@
void silc_client_save_channel_key(SilcClient client,
SilcBuffer key_payload,
SilcChannelEntry channel)
{
SilcBuffer key_payload,
SilcChannelEntry channel)
{
- unsigned char *id_string, *key, *cipher, *hmac, hash[
32
];
+ unsigned char *id_string, *key, *cipher, *hmac, hash[
SILC_HASH_MAXLEN
];
SilcUInt32 tmp_len;
SilcChannelID *id;
SilcChannelKeyPayload payload;
SilcUInt32 tmp_len;
SilcChannelID *id;
SilcChannelKeyPayload payload;
@@
-535,7
+535,7
@@
bool silc_client_add_channel_private_key(SilcClient client,
SilcChannelPrivateKey *ret_key)
{
SilcChannelPrivateKey entry;
SilcChannelPrivateKey *ret_key)
{
SilcChannelPrivateKey entry;
- unsigned char hash[
32
];
+ unsigned char hash[
SILC_HASH_MAXLEN
];
SilcSKEKeyMaterial *keymat;
assert(client && channel);
SilcSKEKeyMaterial *keymat;
assert(client && channel);
diff --git
a/lib/silcclient/client_notify.c
b/lib/silcclient/client_notify.c
index eb1f97edb9d95bcb1bae370c21cbeba5946468a0..75b113ad69c370644611e29e2643f0f35870dac2 100644
(file)
--- a/
lib/silcclient/client_notify.c
+++ b/
lib/silcclient/client_notify.c
@@
-826,7
+826,7
@@
void silc_client_notify_by_server(SilcClient client,
/* Get the hmac */
hmac = silc_argument_get_arg_type(args, 4, &tmp_len);
if (hmac) {
/* Get the hmac */
hmac = silc_argument_get_arg_type(args, 4, &tmp_len);
if (hmac) {
- unsigned char hash[
32
];
+ unsigned char hash[
SILC_HASH_MAXLEN
];
if (channel->hmac)
silc_hmac_free(channel->hmac);
if (channel->hmac)
silc_hmac_free(channel->hmac);
diff --git
a/lib/silcclient/command.c
b/lib/silcclient/command.c
index 0122fee97007d4129bb0c21be8320322224e3ac5..a64353b9a999abf87349f894d99200eda52d79a7 100644
(file)
--- a/
lib/silcclient/command.c
+++ b/
lib/silcclient/command.c
@@
-1190,7
+1190,7
@@
SILC_CLIENT_CMD_FUNC(join)
} else if (!strcasecmp(cmd->argv[i], "-auth")) {
SilcPublicKey pubkey = cmd->client->public_key;
SilcPrivateKey privkey = cmd->client->private_key;
} else if (!strcasecmp(cmd->argv[i], "-auth")) {
SilcPublicKey pubkey = cmd->client->public_key;
SilcPrivateKey privkey = cmd->client->private_key;
- unsigned char *pk, pkhash[
20
], *pubdata;
+ unsigned char *pk, pkhash[
SILC_HASH_MAXLEN
], *pubdata;
SilcUInt32 pk_len;
if (cmd->argc >= i + 3) {
SilcUInt32 pk_len;
if (cmd->argc >= i + 3) {
diff --git
a/lib/silccrypt/silchash.c
b/lib/silccrypt/silchash.c
index d315b5068ca6ea595d49aa838f65c32db22ca1f5..9f0b58e3af2ab7943797a175f6a66ae5b0614011 100644
(file)
--- a/
lib/silccrypt/silchash.c
+++ b/
lib/silccrypt/silchash.c
@@
-331,7
+331,7
@@
char *silc_hash_fingerprint(SilcHash hash, const unsigned char *data,
SilcUInt32 data_len)
{
SilcHash new_hash = NULL;
SilcUInt32 data_len)
{
SilcHash new_hash = NULL;
- unsigned char h[
32
];
+ unsigned char h[
SILC_HASH_MAXLEN
];
char *ret;
if (!hash) {
char *ret;
if (!hash) {
@@
-360,7
+360,7
@@
char *silc_hash_babbleprint(SilcHash hash, const unsigned char *data,
{
SilcHash new_hash = NULL;
char *babbleprint;
{
SilcHash new_hash = NULL;
char *babbleprint;
- unsigned char hval[
32
];
+ unsigned char hval[
SILC_HASH_MAXLEN
];
unsigned int a, b, c, d, e, check;
int i, k, out_len;
unsigned int a, b, c, d, e, check;
int i, k, out_len;
diff --git
a/lib/silccrypt/silchash.h
b/lib/silccrypt/silchash.h
index 206427ebe4892bd857a3c30f6f9e0588510f0f7d..b8698281349ec2b80ff907678bdc5850173b9ea6 100644
(file)
--- a/
lib/silccrypt/silchash.h
+++ b/
lib/silccrypt/silchash.h
@@
-84,6
+84,7
@@
extern DLLAPI const SilcHashObject silc_default_hash[];
/* Default HASH function in the SILC protocol */
#define SILC_DEFAULT_HASH "sha1"
/* Default HASH function in the SILC protocol */
#define SILC_DEFAULT_HASH "sha1"
+#define SILC_HASH_MAXLEN 64
/* Macros */
/* Macros */
diff --git
a/lib/silccrypt/silchmac.c
b/lib/silccrypt/silchmac.c
index 2ec0160a08cec5f2d161aa7552ee3dac1a8da035..fe4af46c2c37c04b62a6501f3b2feb4d2a2cf3c2 100644
(file)
--- a/
lib/silccrypt/silchmac.c
+++ b/
lib/silccrypt/silchmac.c
@@
-54,7
+54,7
@@
static void silc_hmac_init_internal(SilcHmac hmac, unsigned char *key,
{
SilcHash hash = hmac->hash;
SilcUInt32 block_len;
{
SilcHash hash = hmac->hash;
SilcUInt32 block_len;
- unsigned char hvalue[
20
];
+ unsigned char hvalue[
SILC_HASH_MAXLEN
];
int i;
memset(hmac->inner_pad, 0, sizeof(hmac->inner_pad));
int i;
memset(hmac->inner_pad, 0, sizeof(hmac->inner_pad));
@@
-405,7
+405,7
@@
void silc_hmac_make_truncated(SilcHmac hmac, unsigned char *data,
SilcUInt32 truncated_len,
unsigned char *return_hash)
{
SilcUInt32 truncated_len,
unsigned char *return_hash)
{
- unsigned char hvalue[
20
];
+ unsigned char hvalue[
SILC_HASH_MAXLEN
];
SILC_LOG_DEBUG(("Making HMAC for message"));
SILC_LOG_DEBUG(("Making HMAC for message"));
@@
-449,7
+449,7
@@
void silc_hmac_final(SilcHmac hmac, unsigned char *return_hash,
SilcUInt32 *return_len)
{
SilcHash hash = hmac->hash;
SilcUInt32 *return_len)
{
SilcHash hash = hmac->hash;
- unsigned char mac[
20
];
+ unsigned char mac[
SILC_HASH_MAXLEN
];
silc_hash_final(hash, mac);
silc_hash_init(hash);
silc_hash_final(hash, mac);
silc_hash_init(hash);
diff --git
a/lib/silccrypt/silcpkcs.c
b/lib/silccrypt/silcpkcs.c
index 6ce2f9fa389670e4c9991ee72267c4f418e8749a..50c3620734c6ffd4977947973c107dd1f04dde9d 100644
(file)
--- a/
lib/silccrypt/silcpkcs.c
+++ b/
lib/silccrypt/silcpkcs.c
@@
-406,7
+406,7
@@
bool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len)
{
unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len)
{
- unsigned char hashr[
32
];
+ unsigned char hashr[
SILC_HASH_MAXLEN
];
SilcUInt32 hash_len;
int ret;
SilcUInt32 hash_len;
int ret;
@@
-430,7
+430,7
@@
bool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
unsigned char *data,
SilcUInt32 data_len)
{
unsigned char *data,
SilcUInt32 data_len)
{
- unsigned char hashr[
32
];
+ unsigned char hashr[
SILC_HASH_MAXLEN
];
SilcUInt32 hash_len;
int ret;
SilcUInt32 hash_len;
int ret;
diff --git
a/lib/silcske/silcske.c
b/lib/silcske/silcske.c
index f3db0baf289fe17d7445cbc5469db0805b4814a9..26690f7a86d8727c7f106598fe49c748b83bddce 100644
(file)
--- a/
lib/silcske/silcske.c
+++ b/
lib/silcske/silcske.c
@@
-399,7
+399,7
@@
SilcSKEStatus silc_ske_initiator_phase_2(SilcSKE ske,
/* Compute signature data if we are doing mutual authentication */
if (private_key && ske->start_payload->flags & SILC_SKE_SP_FLAG_MUTUAL) {
/* Compute signature data if we are doing mutual authentication */
if (private_key && ske->start_payload->flags & SILC_SKE_SP_FLAG_MUTUAL) {
- unsigned char hash[
32
], sign[2048 + 1];
+ unsigned char hash[
SILC_HASH_MAXLEN
], sign[2048 + 1];
SilcUInt32 hash_len, sign_len;
SILC_LOG_DEBUG(("We are doing mutual authentication"));
SilcUInt32 hash_len, sign_len;
SILC_LOG_DEBUG(("We are doing mutual authentication"));
@@
-464,7
+464,7
@@
static void silc_ske_initiator_finish_final(SilcSKE ske,
void *context)
{
SilcSKEKEPayload *payload;
void *context)
{
SilcSKEKEPayload *payload;
- unsigned char hash[
32
];
+ unsigned char hash[
SILC_HASH_MAXLEN
];
SilcUInt32 hash_len;
SilcPublicKey public_key = NULL;
SilcUInt32 hash_len;
SilcPublicKey public_key = NULL;
@@
-854,7
+854,7
@@
static void silc_ske_responder_phase2_final(SilcSKE ske,
if (ske->start_payload &&
ske->start_payload->flags & SILC_SKE_SP_FLAG_MUTUAL) {
SilcPublicKey public_key = NULL;
if (ske->start_payload &&
ske->start_payload->flags & SILC_SKE_SP_FLAG_MUTUAL) {
SilcPublicKey public_key = NULL;
- unsigned char hash[
32
];
+ unsigned char hash[
SILC_HASH_MAXLEN
];
SilcUInt32 hash_len;
/* Decode the public key */
SilcUInt32 hash_len;
/* Decode the public key */
@@
-1017,7
+1017,7
@@
SilcSKEStatus silc_ske_responder_finish(SilcSKE ske,
SilcSKEStatus status = SILC_SKE_STATUS_OK;
SilcBuffer payload_buf;
SilcMPInt *KEY;
SilcSKEStatus status = SILC_SKE_STATUS_OK;
SilcBuffer payload_buf;
SilcMPInt *KEY;
- unsigned char hash[
32
], sign[2048 + 1], *pk;
+ unsigned char hash[
SILC_HASH_MAXLEN
], sign[2048 + 1], *pk;
SilcUInt32 hash_len, sign_len, pk_len;
SILC_LOG_DEBUG(("Start"));
SilcUInt32 hash_len, sign_len, pk_len;
SILC_LOG_DEBUG(("Start"));
@@
-1747,7
+1747,7
@@
silc_ske_process_key_material_data(unsigned char *data,
SilcSKEKeyMaterial *key)
{
SilcBuffer buf;
SilcSKEKeyMaterial *key)
{
SilcBuffer buf;
- unsigned char hashd[
32
];
+ unsigned char hashd[
SILC_HASH_MAXLEN
];
SilcUInt32 hash_len = req_hmac_key_len;
SilcUInt32 enc_key_len = req_enc_key_len / 8;
SilcUInt32 hash_len = req_hmac_key_len;
SilcUInt32 enc_key_len = req_enc_key_len / 8;
@@
-1783,7
+1783,8
@@
silc_ske_process_key_material_data(unsigned char *data,
buf->data[0] = 2;
if (enc_key_len > hash_len) {
SilcBuffer dist;
buf->data[0] = 2;
if (enc_key_len > hash_len) {
SilcBuffer dist;
- unsigned char k1[32], k2[32], k3[32];
+ unsigned char k1[SILC_HASH_MAXLEN], k2[SILC_HASH_MAXLEN],
+ k3[SILC_HASH_MAXLEN];
unsigned char *dtmp;
/* XXX */
unsigned char *dtmp;
/* XXX */
@@
-1845,7
+1846,8
@@
silc_ske_process_key_material_data(unsigned char *data,
buf->data[0] = 3;
if (enc_key_len > hash_len) {
SilcBuffer dist;
buf->data[0] = 3;
if (enc_key_len > hash_len) {
SilcBuffer dist;
- unsigned char k1[32], k2[32], k3[32];
+ unsigned char k1[SILC_HASH_MAXLEN], k2[SILC_HASH_MAXLEN],
+ k3[SILC_HASH_MAXLEN];
unsigned char *dtmp;
/* XXX */
unsigned char *dtmp;
/* XXX */