Remove libssl dependancy and always use sha1.c code

Apparently there are license issues with openssl, so
just use sha1.c always.   This means we can get rid of
SHA1.c

Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
Neil Brown 2006-06-02 06:12:19 +00:00
parent ab56093f3b
commit 8268ed7403
3 changed files with 27 additions and 47 deletions

View File

@ -32,7 +32,6 @@
TCC = tcc TCC = tcc
UCLIBC_GCC = $(shell for nm in i386-uclibc-linux-gcc i386-uclibc-gcc; do which $$nm > /dev/null && { echo $$nm ; exit; } ; done; echo false No uclibc found ) UCLIBC_GCC = $(shell for nm in i386-uclibc-linux-gcc i386-uclibc-gcc; do which $$nm > /dev/null && { echo $$nm ; exit; } ; done; echo false No uclibc found )
DIET_GCC = diet gcc DIET_GCC = diet gcc
LDLIBS=-lssl
KLIBC=/home/src/klibc/klibc-0.77 KLIBC=/home/src/klibc/klibc-0.77
@ -67,15 +66,15 @@ MAN8DIR = $(MANDIR)/man8
OBJS = mdadm.o config.o mdstat.o ReadMe.o util.o Manage.o Assemble.o Build.o \ OBJS = mdadm.o config.o mdstat.o ReadMe.o util.o Manage.o Assemble.o Build.o \
Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \ Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \
mdopen.o super0.o super1.o bitmap.o restripe.o sysfs.o mdopen.o super0.o super1.o bitmap.o restripe.o sysfs.o sha1.o
SRCS = mdadm.c config.c mdstat.c ReadMe.c util.c Manage.c Assemble.c Build.c \ SRCS = mdadm.c config.c mdstat.c ReadMe.c util.c Manage.c Assemble.c Build.c \
Create.c Detail.c Examine.c Grow.c Monitor.c dlink.c Kill.c Query.c \ Create.c Detail.c Examine.c Grow.c Monitor.c dlink.c Kill.c Query.c \
mdopen.c super0.c super1.c bitmap.c restripe.c sysfs.c mdopen.c super0.c super1.c bitmap.c restripe.c sysfs.c sha1.c
STATICSRC = SHA1.c sha1.c pwgr.c STATICSRC = pwgr.c
STATICOBJS = SHA1.o sha1.o pwgr.o STATICOBJS = pwgr.o
ASSEMBLE_SRCS := mdassemble.c Assemble.c config.c dlink.c util.c super0.c super1.c ASSEMBLE_SRCS := mdassemble.c Assemble.c config.c dlink.c util.c super0.c super1.c sha1.c
ASSEMBLE_FLAGS:= $(CFLAGS) -DMDASSEMBLE ASSEMBLE_FLAGS:= $(CFLAGS) -DMDASSEMBLE
ifdef MDASSEMBLE_AUTO ifdef MDASSEMBLE_AUTO
ASSEMBLE_SRCS += mdopen.c mdstat.c ASSEMBLE_SRCS += mdopen.c mdstat.c
@ -139,8 +138,6 @@ $(OBJS) : mdadm.h bitmap.h
sha1.o : sha1.c sha1.h md5.h sha1.o : sha1.c sha1.h md5.h
$(CC) $(CFLAGS) -DHAVE_STDINT_H -o sha1.o -c sha1.c $(CC) $(CFLAGS) -DHAVE_STDINT_H -o sha1.o -c sha1.c
SHA1.o : SHA1.c
$(CC) $(CFLAGS) -DHAVE_STDINT_H -o SHA1.o -c SHA1.c
install : mdadm install-man install : mdadm install-man
$(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm $(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm

19
SHA1.c
View File

@ -1,19 +0,0 @@
/* Simple wrapper for code in sha1.c, to
* provide SHA1() interface as provided by opensll.
* I do this because I cannot get SHA1 when staticly linking.
*
* sha1.c sha1.h md5.h all copied from coreutils-5.94
*/
#include "sha1.h"
unsigned char *SHA1(unsigned char *buf, int len, unsigned char *dest)
{
static unsigned char defdest[20];
if (dest == NULL) dest = defdest;
return (unsigned char *)sha1_buffer((const char*)buf,
len,
(void*)dest);
}

View File

@ -27,12 +27,9 @@
* Australia * Australia
*/ */
#define HAVE_STDINT_H 1
#include "mdadm.h" #include "mdadm.h"
#ifndef UCLIBC #include "sha1.h"
#include <openssl/sha.h> /* for SHA1 */
#else
extern unsigned char *SHA1(unsigned char *buf, int len, unsigned char *dest);
#endif
/* /*
* All handling for the 0.90.0 version superblock is in * All handling for the 0.90.0 version superblock is in
* this file. * this file.
@ -102,9 +99,10 @@ static void examine_super0(void *sbv, char *homehost)
printf(" UUID : %08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1, printf(" UUID : %08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
sb->set_uuid2, sb->set_uuid3); sb->set_uuid2, sb->set_uuid3);
if (homehost) { if (homehost) {
unsigned char *hash = SHA1((unsigned char *)homehost, char buf[20];
strlen(homehost), void *hash = sha1_buffer(homehost,
NULL); strlen(homehost),
buf);
if (memcmp(&sb->set_uuid2, hash, 8)==0) if (memcmp(&sb->set_uuid2, hash, 8)==0)
printf(" (local to host %s)", homehost); printf(" (local to host %s)", homehost);
} }
@ -261,9 +259,10 @@ static void detail_super0(void *sbv, char *homehost)
else else
printf("%08x", sb->set_uuid0); printf("%08x", sb->set_uuid0);
if (homehost) { if (homehost) {
unsigned char *hash = SHA1((unsigned char *)homehost, char buf[20];
strlen(homehost), void *hash = sha1_buffer(homehost,
NULL); strlen(homehost),
buf);
if (memcmp(&sb->set_uuid2, hash, 8)==0) if (memcmp(&sb->set_uuid2, hash, 8)==0)
printf(" (local to host %s)", homehost); printf(" (local to host %s)", homehost);
} }
@ -285,9 +284,10 @@ static void brief_detail_super0(void *sbv)
static int match_home0(void *sbv, char *homehost) static int match_home0(void *sbv, char *homehost)
{ {
mdp_super_t *sb = sbv; mdp_super_t *sb = sbv;
unsigned char *hash = SHA1((unsigned char *)homehost, char buf[20];
strlen(homehost), char *hash = sha1_buffer(homehost,
NULL); strlen(homehost),
buf);
return (memcmp(&sb->set_uuid2, hash, 8)==0); return (memcmp(&sb->set_uuid2, hash, 8)==0);
} }
@ -474,9 +474,10 @@ static int update_super0(struct mdinfo *info, void *sbv, char *update,
} }
if (strcmp(update, "uuid") == 0) { if (strcmp(update, "uuid") == 0) {
if (!uuid_set && homehost) { if (!uuid_set && homehost) {
unsigned char *hash = SHA1((unsigned char*)homehost, char buf[20];
strlen(homehost), char *hash = sha1_buffer(homehost,
NULL); strlen(homehost),
buf);
memcpy(info->uuid+2, hash, 8); memcpy(info->uuid+2, hash, 8);
} }
sb->set_uuid0 = info->uuid[0]; sb->set_uuid0 = info->uuid[0];
@ -557,9 +558,10 @@ static int init_super0(struct supertype *st, void **sbp, mdu_array_info_t *info,
if (rfd >= 0) if (rfd >= 0)
close(rfd); close(rfd);
if (homehost) { if (homehost) {
unsigned char *hash = SHA1((unsigned char*)homehost, char buf[20];
strlen(homehost), char *hash = sha1_buffer(homehost,
NULL); strlen(homehost),
buf);
memcpy(&sb->set_uuid2, hash, 8); memcpy(&sb->set_uuid2, hash, 8);
} }