Blame SOURCES/bacula-non-free-code.patch

2785c5
diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in
2785c5
index 009f157..a813a7c 100644
2785c5
--- a/src/lib/Makefile.in
2785c5
+++ b/src/lib/Makefile.in
2785c5
@@ -39,7 +39,7 @@ INCLUDE_FILES = ../baconfig.h ../bacula.h ../bc_types.h \
2785c5
 		fnmatch.h guid_to_name.h htable.h lex.h \
2785c5
 		lib.h md5.h mem_pool.h message.h mntent_cache.h \
2785c5
 		openssl.h plugins.h protos.h queue.h rblist.h \
2785c5
-		runscript.h rwlock.h serial.h sellist.h sha1.h \
2785c5
+		runscript.h rwlock.h serial.h sellist.h \
2785c5
 		smartall.h status.h tls.h tree.h var.h \
2785c5
 		waitq.h watchdog.h workq.h \
2785c5
 		parse_conf.h ini.h \
2785c5
@@ -55,7 +55,7 @@ LIBBAC_SRCS = attr.c base64.c berrno.c bsys.c binflate.c bget_msg.c \
2785c5
 	      guid_to_name.c hmac.c jcr.c lex.c alist.c dlist.c \
2785c5
 	      md5.c message.c mem_pool.c mntent_cache.c openssl.c \
2785c5
 	      plugins.c priv.c queue.c bregex.c \
2785c5
-	      rwlock.c scan.c sellist.c serial.c sha1.c \
2785c5
+	      rwlock.c scan.c sellist.c serial.c \
2785c5
 	      signal.c smartall.c rblist.c tls.c tree.c \
2785c5
 	      util.c var.c watchdog.c workq.c btimers.c \
2785c5
 	      address_conf.c breg.c htable.c lockmgr.c devlock.c
2785c5
@@ -193,13 +193,6 @@ md5sum: Makefile md5.o
2785c5
 	$(RMF) md5.o
2785c5
 	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) md5.c
2785c5
 
2785c5
-sha1sum: Makefile sha1.o
2785c5
-	$(RMF) sha1.o
2785c5
-	$(CXX) -DSHA1_SUM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)	$(CFLAGS) sha1.c
2785c5
-	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ sha1.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
2785c5
-	$(RMF) sha1.o
2785c5
-	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) sha1.c
2785c5
-
2785c5
 bsnprintf: Makefile bsnprintf.o
2785c5
 	$(RMF) bsnprintf.o
2785c5
 	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) bsnprintf.c
2785c5
@@ -250,7 +243,7 @@ libtool-clean:
2785c5
 
2785c5
 clean:	libtool-clean
2785c5
 	@$(RMF) core a.out *.o *.bak *.tex *.pdf *~ *.intpro *.extpro 1 2 3
2785c5
-	@$(RMF) rwlock_test md5sum sha1sum
2785c5
+	@$(RMF) rwlock_test md5sum
2785c5
 
2785c5
 realclean: clean
2785c5
 	@$(RMF) tags
2785c5
diff --git a/src/lib/lib.h b/src/lib/lib.h
2785c5
index b81f89f..c82dc29 100644
2785c5
--- a/src/lib/lib.h
2785c5
+++ b/src/lib/lib.h
2785c5
@@ -59,7 +59,6 @@
2785c5
 #include "fnmatch.h"
2785c5
 #endif
2785c5
 #include "md5.h"
2785c5
-#include "sha1.h"
2785c5
 #include "tree.h"
2785c5
 #include "watchdog.h"
2785c5
 #include "btimers.h"
2785c5
diff --git a/src/lib/sha1.c b/src/lib/sha1.c
2785c5
deleted file mode 100644
2785c5
index 7e58128..0000000
2785c5
--- a/src/lib/sha1.c
2785c5
+++ /dev/null
2785c5
@@ -1,510 +0,0 @@
2785c5
-/*
2785c5
- *  sha1.c
2785c5
- *
2785c5
- *  Description:
2785c5
- *      This file implements the Secure Hashing Algorithm 1 as
2785c5
- *      defined in FIPS PUB 180-1 published April 17, 1995.
2785c5
- *
2785c5
- *      The SHA-1, produces a 160-bit message digest for a given
2785c5
- *      data stream.  It should take about 2**n steps to find a
2785c5
- *      message with the same digest as a given message and
2785c5
- *      2**(n/2) to find any two messages with the same digest,
2785c5
- *      when n is the digest size in bits.  Therefore, this
2785c5
- *      algorithm can serve as a means of providing a
2785c5
- *      "fingerprint" for a message.
2785c5
- *
2785c5
- *  Portability Issues:
2785c5
- *      SHA-1 is defined in terms of 32-bit "words".  This code
2785c5
- *      uses <stdint.h> (included via "sha1.h" to define 32 and 8
2785c5
- *      bit unsigned integer types.  If your C compiler does not
2785c5
- *      support 32 bit unsigned integers, this code is not
2785c5
- *      appropriate.
2785c5
- *
2785c5
- *  Caveats:
2785c5
- *      SHA-1 is designed to work with messages less than 2^64 bits
2785c5
- *      long.  Although SHA-1 allows a message digest to be generated
2785c5
- *      for messages of any number of bits less than 2^64, this
2785c5
- *      implementation only works with messages with a length that is
2785c5
- *      a multiple of the size of an 8-bit character.
2785c5
- *
2785c5
- *  See sha1.h for copyright
2785c5
- */
2785c5
-
2785c5
-#include "sha1.h"
2785c5
-
2785c5
-/*
2785c5
- *  Define the SHA1 circular left shift macro
2785c5
- */
2785c5
-#define SHA1CircularShift(bits,word) \
2785c5
-                (((word) << (bits)) | ((word) >> (32-(bits))))
2785c5
-
2785c5
-/* Local Function Prototyptes */
2785c5
-static void SHA1PadMessage(SHA1Context *);
2785c5
-static void SHA1ProcessMessageBlock(SHA1Context *);
2785c5
-
2785c5
-/*
2785c5
- *  SHA1Init
2785c5
- *
2785c5
- *  Description:
2785c5
- *      This function will initialize the SHA1Context in preparation
2785c5
- *      for computing a new SHA1 message digest.
2785c5
- *
2785c5
- *  Parameters:
2785c5
- *      context: [in/out]
2785c5
- *          The context to reset.
2785c5
- *
2785c5
- *  Returns:
2785c5
- *      sha Error Code.
2785c5
- *
2785c5
- */
2785c5
-int SHA1Init(SHA1Context *context)
2785c5
-{
2785c5
-    if (!context)
2785c5
-    {
2785c5
-        return shaNull;
2785c5
-    }
2785c5
-
2785c5
-    context->Length_Low             = 0;
2785c5
-    context->Length_High            = 0;
2785c5
-    context->Message_Block_Index    = 0;
2785c5
-
2785c5
-    context->Intermediate_Hash[0]   = 0x67452301;
2785c5
-    context->Intermediate_Hash[1]   = 0xEFCDAB89;
2785c5
-    context->Intermediate_Hash[2]   = 0x98BADCFE;
2785c5
-    context->Intermediate_Hash[3]   = 0x10325476;
2785c5
-    context->Intermediate_Hash[4]   = 0xC3D2E1F0;
2785c5
-
2785c5
-    context->Computed   = 0;
2785c5
-    context->Corrupted  = 0;
2785c5
-
2785c5
-    return shaSuccess;
2785c5
-}
2785c5
-
2785c5
-/*
2785c5
- *  SHA1Final
2785c5
- *
2785c5
- *  Description:
2785c5
- *      This function will return the 160-bit message digest into the
2785c5
- *      Message_Digest array  provided by the caller.
2785c5
- *      NOTE: The first octet of hash is stored in the 0th element,
2785c5
- *            the last octet of hash in the 19th element.
2785c5
- *
2785c5
- *  Parameters:
2785c5
- *      context: [in/out]
2785c5
- *          The context to use to calculate the SHA-1 hash.
2785c5
- *      Message_Digest: [out]
2785c5
- *          Where the digest is returned.
2785c5
- *
2785c5
- *  Returns:
2785c5
- *      sha Error Code.
2785c5
- *
2785c5
- */
2785c5
-int SHA1Final(SHA1Context *context,
2785c5
-              uint8_t Message_Digest[SHA1HashSize])
2785c5
-{
2785c5
-    int i;
2785c5
-
2785c5
-    if (!context || !Message_Digest) {
2785c5
-        return shaNull;
2785c5
-    }
2785c5
-
2785c5
-    if (context->Corrupted) {
2785c5
-        return context->Corrupted;
2785c5
-    }
2785c5
-
2785c5
-    if (!context->Computed) {
2785c5
-        SHA1PadMessage(context);
2785c5
-        for(i=0; i<64; ++i) {
2785c5
-            /* message may be sensitive, clear it out */
2785c5
-            context->Message_Block[i] = 0;
2785c5
-        }
2785c5
-        context->Length_Low = 0;    /* and clear length */
2785c5
-        context->Length_High = 0;
2785c5
-        context->Computed = 1;
2785c5
-
2785c5
-    }
2785c5
-
2785c5
-    for(i = 0; i < SHA1HashSize; ++i) {
2785c5
-        Message_Digest[i] = context->Intermediate_Hash[i>>2]
2785c5
-                            >> 8 * ( 3 - ( i & 0x03 ) );
2785c5
-    }
2785c5
-
2785c5
-    return shaSuccess;
2785c5
-}
2785c5
-
2785c5
-/*
2785c5
- *  SHA1Update
2785c5
- *
2785c5
- *  Description:
2785c5
- *      This function accepts an array of octets as the next portion
2785c5
- *      of the message.
2785c5
- *
2785c5
- *  Parameters:
2785c5
- *      context: [in/out]
2785c5
- *          The SHA context to update
2785c5
- *      message_array: [in]
2785c5
- *          An array of characters representing the next portion of
2785c5
- *          the message.
2785c5
- *      length: [in]
2785c5
- *          The length of the message in message_array
2785c5
- *
2785c5
- *  Returns:
2785c5
- *      sha Error Code.
2785c5
- *
2785c5
- */
2785c5
-int SHA1Update(SHA1Context    *context,
2785c5
-               const uint8_t  *message_array,
2785c5
-               unsigned       length)
2785c5
-{
2785c5
-    if (!length) {
2785c5
-        return shaSuccess;
2785c5
-    }
2785c5
-
2785c5
-    if (!context || !message_array) {
2785c5
-        return shaNull;
2785c5
-    }
2785c5
-
2785c5
-    if (context->Computed) {
2785c5
-        context->Corrupted = shaStateError;
2785c5
-
2785c5
-        return shaStateError;
2785c5
-    }
2785c5
-
2785c5
-    if (context->Corrupted) {
2785c5
-         return context->Corrupted;
2785c5
-    }
2785c5
-    while(length-- && !context->Corrupted) {
2785c5
-       context->Message_Block[context->Message_Block_Index++] =
2785c5
-                    (*message_array & 0xFF);
2785c5
-
2785c5
-       context->Length_Low += 8;
2785c5
-       if (context->Length_Low == 0) {
2785c5
-           context->Length_High++;
2785c5
-           if (context->Length_High == 0) {
2785c5
-               /* Message is too long */
2785c5
-               context->Corrupted = 1;
2785c5
-           }
2785c5
-       }
2785c5
-
2785c5
-       if (context->Message_Block_Index == 64) {
2785c5
-           SHA1ProcessMessageBlock(context);
2785c5
-       }
2785c5
-
2785c5
-       message_array++;
2785c5
-    }
2785c5
-
2785c5
-    return shaSuccess;
2785c5
-}
2785c5
-
2785c5
-/*
2785c5
- *  SHA1ProcessMessageBlock
2785c5
- *
2785c5
- *  Description:
2785c5
- *      This function will process the next 512 bits of the message
2785c5
- *      stored in the Message_Block array.
2785c5
- *
2785c5
- *  Parameters:
2785c5
- *      None.
2785c5
- *
2785c5
- *  Returns:
2785c5
- *      Nothing.
2785c5
- *
2785c5
- *  Comments:
2785c5
-
2785c5
- *      Many of the variable names in this code, especially the
2785c5
- *      single character names, were used because those were the
2785c5
- *      names used in the publication.
2785c5
- *
2785c5
- *
2785c5
- */
2785c5
-static void SHA1ProcessMessageBlock(SHA1Context *context)
2785c5
-{
2785c5
-    const uint32_t K[] =    {       /* Constants defined in SHA-1   */
2785c5
-                            0x5A827999,
2785c5
-                            0x6ED9EBA1,
2785c5
-                            0x8F1BBCDC,
2785c5
-                            0xCA62C1D6
2785c5
-                            };
2785c5
-    int           t;                 /* Loop counter                */
2785c5
-    uint32_t      temp;              /* Temporary word value        */
2785c5
-    uint32_t      W[80];             /* Word sequence               */
2785c5
-    uint32_t      A, B, C, D, E;     /* Word buffers                */
2785c5
-
2785c5
-    /*
2785c5
-     *  Initialize the first 16 words in the array W
2785c5
-     */
2785c5
-    for(t = 0; t < 16; t++) {
2785c5
-        W[t] = context->Message_Block[t * 4] << 24;
2785c5
-        W[t] |= context->Message_Block[t * 4 + 1] << 16;
2785c5
-        W[t] |= context->Message_Block[t * 4 + 2] << 8;
2785c5
-        W[t] |= context->Message_Block[t * 4 + 3];
2785c5
-    }
2785c5
-
2785c5
-    for(t = 16; t < 80; t++) {
2785c5
-       W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
2785c5
-    }
2785c5
-
2785c5
-    A = context->Intermediate_Hash[0];
2785c5
-    B = context->Intermediate_Hash[1];
2785c5
-    C = context->Intermediate_Hash[2];
2785c5
-    D = context->Intermediate_Hash[3];
2785c5
-    E = context->Intermediate_Hash[4];
2785c5
-
2785c5
-    for(t = 0; t < 20; t++) {
2785c5
-        temp =  SHA1CircularShift(5,A) +
2785c5
-                ((B & C) | ((~B) & D)) + E + W[t] + K[0];
2785c5
-        E = D;
2785c5
-        D = C;
2785c5
-        C = SHA1CircularShift(30,B);
2785c5
-
2785c5
-        B = A;
2785c5
-        A = temp;
2785c5
-    }
2785c5
-
2785c5
-    for(t = 20; t < 40; t++) {
2785c5
-        temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
2785c5
-        E = D;
2785c5
-        D = C;
2785c5
-        C = SHA1CircularShift(30,B);
2785c5
-        B = A;
2785c5
-        A = temp;
2785c5
-    }
2785c5
-
2785c5
-    for(t = 40; t < 60; t++) {
2785c5
-        temp = SHA1CircularShift(5,A) +
2785c5
-               ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
2785c5
-        E = D;
2785c5
-        D = C;
2785c5
-        C = SHA1CircularShift(30,B);
2785c5
-        B = A;
2785c5
-        A = temp;
2785c5
-    }
2785c5
-
2785c5
-    for(t = 60; t < 80; t++) {
2785c5
-        temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
2785c5
-        E = D;
2785c5
-        D = C;
2785c5
-        C = SHA1CircularShift(30,B);
2785c5
-        B = A;
2785c5
-        A = temp;
2785c5
-    }
2785c5
-
2785c5
-    context->Intermediate_Hash[0] += A;
2785c5
-    context->Intermediate_Hash[1] += B;
2785c5
-    context->Intermediate_Hash[2] += C;
2785c5
-    context->Intermediate_Hash[3] += D;
2785c5
-    context->Intermediate_Hash[4] += E;
2785c5
-
2785c5
-    context->Message_Block_Index = 0;
2785c5
-}
2785c5
-
2785c5
-/*
2785c5
- *  SHA1PadMessage
2785c5
- *
2785c5
-
2785c5
- *  Description:
2785c5
- *      According to the standard, the message must be padded to an even
2785c5
- *      512 bits.  The first padding bit must be a '1'.  The last 64
2785c5
- *      bits represent the length of the original message.  All bits in
2785c5
- *      between should be 0.  This function will pad the message
2785c5
- *      according to those rules by filling the Message_Block array
2785c5
- *      accordingly.  It will also call the ProcessMessageBlock function
2785c5
- *      provided appropriately.  When it returns, it can be assumed that
2785c5
- *      the message digest has been computed.
2785c5
- *
2785c5
- *  Parameters:
2785c5
- *      context: [in/out]
2785c5
- *          The context to pad
2785c5
- *      ProcessMessageBlock: [in]
2785c5
- *          The appropriate SHA*ProcessMessageBlock function
2785c5
- *  Returns:
2785c5
- *      Nothing.
2785c5
- *
2785c5
- */
2785c5
-
2785c5
-static void SHA1PadMessage(SHA1Context *context)
2785c5
-{
2785c5
-    /*
2785c5
-     *  Check to see if the current message block is too small to hold
2785c5
-     *  the initial padding bits and length.  If so, we will pad the
2785c5
-     *  block, process it, and then continue padding into a second
2785c5
-     *  block.
2785c5
-     */
2785c5
-    if (context->Message_Block_Index > 55) {
2785c5
-        context->Message_Block[context->Message_Block_Index++] = 0x80;
2785c5
-        while(context->Message_Block_Index < 64) {
2785c5
-            context->Message_Block[context->Message_Block_Index++] = 0;
2785c5
-        }
2785c5
-
2785c5
-        SHA1ProcessMessageBlock(context);
2785c5
-
2785c5
-        while(context->Message_Block_Index < 56) {
2785c5
-            context->Message_Block[context->Message_Block_Index++] = 0;
2785c5
-        }
2785c5
-    } else {
2785c5
-        context->Message_Block[context->Message_Block_Index++] = 0x80;
2785c5
-        while(context->Message_Block_Index < 56) {
2785c5
-
2785c5
-            context->Message_Block[context->Message_Block_Index++] = 0;
2785c5
-        }
2785c5
-    }
2785c5
-
2785c5
-    /*
2785c5
-     *  Store the message length as the last 8 octets
2785c5
-     */
2785c5
-    context->Message_Block[56] = context->Length_High >> 24;
2785c5
-    context->Message_Block[57] = context->Length_High >> 16;
2785c5
-    context->Message_Block[58] = context->Length_High >> 8;
2785c5
-    context->Message_Block[59] = context->Length_High;
2785c5
-    context->Message_Block[60] = context->Length_Low >> 24;
2785c5
-    context->Message_Block[61] = context->Length_Low >> 16;
2785c5
-    context->Message_Block[62] = context->Length_Low >> 8;
2785c5
-    context->Message_Block[63] = context->Length_Low;
2785c5
-
2785c5
-    SHA1ProcessMessageBlock(context);
2785c5
-}
2785c5
-
2785c5
-#ifdef TEST_DRIVER
2785c5
-
2785c5
-/*
2785c5
- *  sha1test.c
2785c5
- *
2785c5
- *  Description:
2785c5
- *      This file will exercise the SHA-1 code performing the three
2785c5
- *      tests documented in FIPS PUB 180-1 plus one which calls
2785c5
- *      SHA1Input with an exact multiple of 512 bits, plus a few
2785c5
- *      error test checks.
2785c5
- *
2785c5
- *  Portability Issues:
2785c5
- *      None.
2785c5
- *
2785c5
- */
2785c5
-
2785c5
-#include <stdint.h>
2785c5
-#include <stdio.h>
2785c5
-#include <string.h>
2785c5
-#include "sha1.h"
2785c5
-
2785c5
-/*
2785c5
- *  Define patterns for testing
2785c5
- */
2785c5
-#define TEST1   "abc"
2785c5
-#define TEST2a  "abcdbcdecdefdefgefghfghighijhi"
2785c5
-
2785c5
-#define TEST2b  "jkijkljklmklmnlmnomnopnopq"
2785c5
-#define TEST2   TEST2a TEST2b
2785c5
-#define TEST3   "a"
2785c5
-#define TEST4a  "01234567012345670123456701234567"
2785c5
-#define TEST4b  "01234567012345670123456701234567"
2785c5
-    /* an exact multiple of 512 bits */
2785c5
-#define TEST4   TEST4a TEST4b
2785c5
-char *testarray[4] =
2785c5
-{
2785c5
-    TEST1,
2785c5
-    TEST2,
2785c5
-    TEST3,
2785c5
-    TEST4
2785c5
-};
2785c5
-long int repeatcount[4] = { 1, 1, 1000000, 10 };
2785c5
-char *resultarray[4] =
2785c5
-{
2785c5
-    "A9 99 3E 36 47 06 81 6A BA 3E 25 71 78 50 C2 6C 9C D0 D8 9D",
2785c5
-    "84 98 3E 44 1C 3B D2 6E BA AE 4A A1 F9 51 29 E5 E5 46 70 F1",
2785c5
-    "34 AA 97 3C D4 C4 DA A4 F6 1E EB 2B DB AD 27 31 65 34 01 6F",
2785c5
-    "DE A3 56 A2 CD DD 90 C7 A7 EC ED C5 EB B5 63 93 4F 46 04 52"
2785c5
-};
2785c5
-
2785c5
-int main()
2785c5
-{
2785c5
-    SHA1Context sha;
2785c5
-    int i, j, err;
2785c5
-    uint8_t Message_Digest[20];
2785c5
-
2785c5
-    /*
2785c5
-     *  Perform SHA-1 tests
2785c5
-     */
2785c5
-    for(j = 0; j < 4; ++j) {
2785c5
-        printf( "\nTest %d: %d, '%s'\n",
2785c5
-                j+1,
2785c5
-                repeatcount[j],
2785c5
-                testarray[j]);
2785c5
-
2785c5
-        err = SHA1Init(&sha);
2785c5
-        if (err) {
2785c5
-            fprintf(stderr, "SHA1Reset Error %d.\n", err );
2785c5
-            break;    /* out of for j loop */
2785c5
-        }
2785c5
-
2785c5
-        for(i = 0; i < repeatcount[j]; ++i) {
2785c5
-
2785c5
-            err = SHA1Input(&sha,
2785c5
-                  (const unsigned char *) testarray[j],
2785c5
-                  strlen(testarray[j]));
2785c5
-            if (err) {
2785c5
-                fprintf(stderr, "SHA1Input Error %d.\n", err );
2785c5
-                break;    /* out of for i loop */
2785c5
-            }
2785c5
-        }
2785c5
-
2785c5
-        err = SHA1Final(&sha, Message_Digest);
2785c5
-        if (err) {
2785c5
-            fprintf(stderr,
2785c5
-            "SHA1Result Error %d, could not compute message digest.\n",
2785c5
-            err );
2785c5
-        }
2785c5
-        else
2785c5
-        {
2785c5
-            printf("\t");
2785c5
-            for(i = 0; i < 20 ; ++i) {
2785c5
-                printf("%02X ", Message_Digest[i]);
2785c5
-            }
2785c5
-            printf("\n");
2785c5
-        }
2785c5
-        printf("Should match:\n");
2785c5
-        printf("\t%s\n", resultarray[j]);
2785c5
-    }
2785c5
-
2785c5
-    /* Test some error returns */
2785c5
-    err = SHA1Input(&sha,(const unsigned char *) testarray[1], 1);
2785c5
-    printf ("\nError %d. Should be %d.\n", err, shaStateError );
2785c5
-    err = SHA1Init(0);
2785c5
-    printf ("\nError %d. Should be %d.\n", err, shaNull );
2785c5
-    return 0;
2785c5
-}
2785c5
-
2785c5
-#endif /* TEST_DRIVER */
2785c5
-
2785c5
-#ifdef SHA1_SUM
2785c5
-/*
2785c5
- * Reads a single ASCII file and prints the HEX sha1 sum.
2785c5
- */
2785c5
-#include <stdio.h>
2785c5
-int main(int argc, char *argv[])
2785c5
-{
2785c5
-   FILE *fd;
2785c5
-   SHA1Context ctx;
2785c5
-   char buf[5000];
2785c5
-   char signature[25];
2785c5
-
2785c5
-   if (argc < 1) {
2785c5
-      printf("Must have filename\n");
2785c5
-      exit(1);
2785c5
-   }
2785c5
-   fd = fopen(argv[1], "rb");
2785c5
-   if (!fd) {
2785c5
-      berrno be;
2785c5
-      printf("Could not open %s: ERR=%s\n", argv[1], be.bstrerror(errno));
2785c5
-      exit(1);
2785c5
-   }
2785c5
-   SHA1Init(&ctx;;
2785c5
-   while (fgets(buf, sizeof(buf), fd)) {
2785c5
-      SHA1Update(&ctx, (unsigned char *)buf, strlen(buf));
2785c5
-   }
2785c5
-   SHA1Final(&ctx, (unsigned char *)signature);
2785c5
-   for (int i=0; i < 20; i++) {
2785c5
-      printf("%02x", signature[i]& 0xFF);
2785c5
-   }
2785c5
-   printf("  %s\n", argv[1]);
2785c5
-   fclose(fd);
2785c5
-}
2785c5
-#endif
2785c5
diff --git a/src/lib/sha1.h b/src/lib/sha1.h
2785c5
deleted file mode 100644
2785c5
index 437fe19..0000000
2785c5
--- a/src/lib/sha1.h
2785c5
+++ /dev/null
2785c5
@@ -1,107 +0,0 @@
2785c5
-/*
2785c5
- *  sha1.h
2785c5
- *
2785c5
- *  Description:
2785c5
- *      This is the header file for code which implements the Secure
2785c5
- *      Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
2785c5
- *      April 17, 1995.
2785c5
- *
2785c5
- *      Many of the variable names in this code, especially the
2785c5
- *      single character names, were used because those were the names
2785c5
- *      used in the publication.
2785c5
- *
2785c5
- *      Please read the file sha1.c for more information.
2785c5
- *
2785c5
- * Full Copyright Statement
2785c5
- *
2785c5
- *    Copyright (C) The Internet Society (2001).  All Rights Reserved.
2785c5
- *
2785c5
- *    This document and translations of it may be copied and furnished to
2785c5
- *    others, and derivative works that comment on or otherwise explain it
2785c5
- *    or assist in its implementation may be prepared, copied, published
2785c5
- *    and distributed, in whole or in part, without restriction of any
2785c5
- *    kind, provided that the above copyright notice and this paragraph are
2785c5
- *    included on all such copies and derivative works.  However, this
2785c5
- *    document itself may not be modified in any way, such as by removing
2785c5
- *    the copyright notice or references to the Internet Society or other
2785c5
- *    Internet organizations, except as needed for the purpose of
2785c5
- *    developing Internet standards in which case the procedures for
2785c5
- *    copyrights defined in the Internet Standards process must be
2785c5
- *    followed, or as required to translate it into languages other than
2785c5
- *    English.
2785c5
- *
2785c5
- *    The limited permissions granted above are perpetual and will not be
2785c5
- *    revoked by the Internet Society or its successors or assigns.
2785c5
- *
2785c5
- *    This document and the information contained herein is provided on an
2785c5
- *    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
2785c5
- *    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
2785c5
- *    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
2785c5
- *    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
2785c5
- *    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
2785c5
- *
2785c5
- * Acknowledgement
2785c5
- *
2785c5
- *    Funding for the RFC Editor function is currently provided by the
2785c5
- *    Internet Society.
2785c5
- *
2785c5
- */
2785c5
-
2785c5
-#ifndef _SHA1_H_
2785c5
-#define _SHA1_H_
2785c5
-
2785c5
-#include "bacula.h"
2785c5
-
2785c5
-/*
2785c5
- * If you do not have the ISO standard stdint.h header file, then you
2785c5
- * must typdef the following:
2785c5
- *    name              meaning
2785c5
- *  uint32_t         unsigned 32 bit integer
2785c5
- *  uint8_t          unsigned 8 bit integer (i.e., unsigned char)
2785c5
- *  int32_t          integer of 32 bits
2785c5
- *
2785c5
- */
2785c5
-
2785c5
-#ifndef _SHA_enum_
2785c5
-#define _SHA_enum_
2785c5
-enum
2785c5
-{
2785c5
-    shaSuccess = 0,
2785c5
-    shaNull,            /* Null pointer parameter */
2785c5
-    shaInputTooLong,    /* input data too long */
2785c5
-    shaStateError       /* called Input after Result */
2785c5
-};
2785c5
-#endif
2785c5
-#define SHA1HashSize 20
2785c5
-
2785c5
-/*
2785c5
- *  This structure will hold context information for the SHA-1
2785c5
- *  hashing operation
2785c5
- */
2785c5
-typedef struct SHA1Context
2785c5
-{
2785c5
-    uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest  */
2785c5
-
2785c5
-    uint32_t Length_Low;            /* Message length in bits      */
2785c5
-    uint32_t Length_High;           /* Message length in bits      */
2785c5
-
2785c5
-			       /* Index into message block array   */
2785c5
-    int32_t Message_Block_Index;
2785c5
-    uint8_t Message_Block[64];      /* 512-bit message blocks      */
2785c5
-
2785c5
-    int Computed;               /* Is the digest computed?         */
2785c5
-    int Corrupted;             /* Is the message digest corrupted? */
2785c5
-} SHA1Context;
2785c5
-
2785c5
-/*
2785c5
- *  Function Prototypes
2785c5
- */
2785c5
-
2785c5
-int SHA1Init(SHA1Context *);
2785c5
-int SHA1Update(SHA1Context *,
2785c5
-	       const uint8_t *,
2785c5
-	       unsigned int);
2785c5
-int SHA1Final(SHA1Context *,
2785c5
-	       uint8_t Message_Digest[SHA1HashSize]);
2785c5
-
2785c5
-#endif