Revision: 516
http://vde.svn.sourceforge.net/vde/?rev=516&view=rev
Author: rd235
Date: 2011-11-28 11:44:35 +0000 (Mon, 28 Nov 2011)
Log Message:
-----------
passwd hash: now we use libmhash instead of libssl
Modified Paths:
--------------
trunk/vdetelweb/configure.ac
trunk/vdetelweb/vdetelweb.c
Modified: trunk/vdetelweb/configure.ac
===================================================================
--- trunk/vdetelweb/configure.ac 2011-11-23 17:38:57 UTC (rev 515)
+++ trunk/vdetelweb/configure.ac 2011-11-28 11:44:35 UTC (rev 516)
@@ -26,7 +26,7 @@
# Checks for libraries.
AC_CHECK_LIB([lwipv6], [lwip_init],, AC_MSG_ERROR([liblwipv6 missing]),
[-lpthread])
-AC_CHECK_LIB([ssl], [SHA1_Init],, AC_MSG_ERROR([libssl (openssl) missing]),
[-lssl])
+AC_CHECK_LIB([mhash], [mhash_init],, AC_MSG_ERROR([mhash missing]), [-lmhash])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Modified: trunk/vdetelweb/vdetelweb.c
===================================================================
--- trunk/vdetelweb/vdetelweb.c 2011-11-23 17:38:57 UTC (rev 515)
+++ trunk/vdetelweb/vdetelweb.c 2011-11-28 11:44:35 UTC (rev 516)
@@ -53,7 +53,7 @@
#include "vdetelweb.h"
#include <lwipv6.h>
#include <limits.h>
-#include <openssl/sha.h>
+#include <mhash.h>
int daemonize;
int telnet;
@@ -108,19 +108,19 @@
static char hex[]="0123456789abcdef";
int sha1passwdok(const char *pw) {
- unsigned char out[SHA_DIGEST_LENGTH];
- char outstr[SHA_DIGEST_LENGTH*2+1];
+ unsigned char out[mhash_get_block_size(MHASH_SHA1)];
+ char outstr[mhash_get_block_size(MHASH_SHA1)*2+1];
int i;
- SHA_CTX c;
- SHA1_Init(&c);
- SHA1_Update(&c, pw, strlen(pw));
- SHA1_Final(out, &c);
- for (i=0; i<SHA_DIGEST_LENGTH; i++) {
+ MHASH td;
+ td=mhash_init(MHASH_SHA1);
+ mhash(td, pw, strlen(pw));
+ mhash_deinit(td, out);
+ for (i=0; i<mhash_get_block_size(MHASH_SHA1); i++) {
outstr[2*i]=hex[out[i] >> 4];
outstr[2*i+1]=hex[out[i] & 0xf];
}
outstr[2*i]=0;
- return (memcmp(outstr,passwd,SHA_DIGEST_LENGTH)==0);
+ return (memcmp(outstr,passwd,mhash_get_block_size(MHASH_SHA1))==0);
}
static void sig_handler(int sig)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
vde-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vde-users