summaryrefslogtreecommitdiff
path: root/super0.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-06-02 06:12:19 +0000
committerNeil Brown <neilb@suse.de>2006-06-02 06:12:19 +0000
commit8268ed740379a94300d20db6f1df1702320fe6fd (patch)
treea8fbae0338aaee137f22c5e5c28a30f54133b316 /super0.c
parentab56093f3b0fd59c49a5cdef22c0480e589f0989 (diff)
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>
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/super0.c b/super0.c
index f14f076c..0f993a25 100644
--- a/super0.c
+++ b/super0.c
@@ -27,12 +27,9 @@
* Australia
*/
+#define HAVE_STDINT_H 1
#include "mdadm.h"
-#ifndef UCLIBC
-#include <openssl/sha.h> /* for SHA1 */
-#else
-extern unsigned char *SHA1(unsigned char *buf, int len, unsigned char *dest);
-#endif
+#include "sha1.h"
/*
* All handling for the 0.90.0 version superblock is in
* 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,
sb->set_uuid2, sb->set_uuid3);
if (homehost) {
- unsigned char *hash = SHA1((unsigned char *)homehost,
- strlen(homehost),
- NULL);
+ char buf[20];
+ void *hash = sha1_buffer(homehost,
+ strlen(homehost),
+ buf);
if (memcmp(&sb->set_uuid2, hash, 8)==0)
printf(" (local to host %s)", homehost);
}
@@ -261,9 +259,10 @@ static void detail_super0(void *sbv, char *homehost)
else
printf("%08x", sb->set_uuid0);
if (homehost) {
- unsigned char *hash = SHA1((unsigned char *)homehost,
- strlen(homehost),
- NULL);
+ char buf[20];
+ void *hash = sha1_buffer(homehost,
+ strlen(homehost),
+ buf);
if (memcmp(&sb->set_uuid2, hash, 8)==0)
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)
{
mdp_super_t *sb = sbv;
- unsigned char *hash = SHA1((unsigned char *)homehost,
- strlen(homehost),
- NULL);
+ char buf[20];
+ char *hash = sha1_buffer(homehost,
+ strlen(homehost),
+ buf);
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 (!uuid_set && homehost) {
- unsigned char *hash = SHA1((unsigned char*)homehost,
- strlen(homehost),
- NULL);
+ char buf[20];
+ char *hash = sha1_buffer(homehost,
+ strlen(homehost),
+ buf);
memcpy(info->uuid+2, hash, 8);
}
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)
close(rfd);
if (homehost) {
- unsigned char *hash = SHA1((unsigned char*)homehost,
- strlen(homehost),
- NULL);
+ char buf[20];
+ char *hash = sha1_buffer(homehost,
+ strlen(homehost),
+ buf);
memcpy(&sb->set_uuid2, hash, 8);
}