[olsr-dev] Developing a generic secure plugin

J. P. (spam-protected)
Fri Jun 17 21:21:29 CEST 2005


Hi,

The secure plugin in 0.4.9 can only handle one of
algorithms (either SHA1 or MD5). Even so, we have to
tell the plugin which algorithm to be used at the
compile time.

I am trying to modify the codes and let it handle
different algorithm according to algorithm that sender
use. After modification, I compiled and installed the
plugin with no errors. However, when I ran "olsrd" to
load the secure plugin, I got an error which I could
not solve. 

Any help are welcome.

Thanks in advance.

Error message:

"
---------- Plugin loader ----------
Library: olsrd_secure.so.0.5
DL loading failed: "/usr/lib/olsrd_secure.so.0.5:
undefined symbol: SHA1"!
-- PLUGIN LOADING FAILED! --
"

Here is how I did to the source code:
==================================
#include <openssl/sha.h>
#define CHECKSUM_SHA1 SHA1
#define SCHEME_SHA1   SHA1_INCLUDING_KEY

#include <openssl/ripemd.h>
#define CHECKSUM_RIPEMD160 RIPEMD160
#define SCHEME_RIPEMD160   RIPEMD160_INCLUDING_KEY

#include "md5.h"

static void
MD5_checksum(char *, olsr_u16_t, char *);

static void
MD5_checksum(char *data, olsr_u16_t data_len, char
*hashbuf)
{
  MD5_CTX context;

  MD5Init(&context);
  MD5Update(&context, data, data_len);
  MD5Final(hashbuf, &context);
}

#define CHECKSUM_MD5 MD5_checksum
#define SCHEME_MD5   MD5_INCLUDING_KEY
...
...
validate_packet(char *pck, int *size)
{
...
  memcpy(checksum_cache, pck, *size - SIGNATURE_SIZE);
  /* Then the key */
  memcpy(&checksum_cache[*size - SIGNATURE_SIZE],
aes_key, KEYLENGTH);

  switch(sig->sig.algorithm)
  {
  case(SHA1_INCLUDING_KEY):
  CHECKSUM_SHA1(checksum_cache, *size - SIGNATURE_SIZE
+ KEYLENGTH, sha1_hash); 
  break;

  case(RIPEMD160_INCLUDING_KEY):
  CHECKSUM_RIPEMD160(checksum_cache, *size -
SIGNATURE_SIZE + KEYLENGTH, sha1_hash); 
  break;

  case(MD5_INCLUDING_KEY):
  CHECKSUM_MD5(checksum_cache, *size - SIGNATURE_SIZE
+ KEYLENGTH, sha1_hash);
  break;
...
}
==============================================


__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com



More information about the Olsr-dev mailing list