Blame SOURCES/openssl-fips-0.9.8e-use-fipscheck.patch

5820f5
Do not create a fips canister but use a fipscheck equivalent method for
5820f5
integrity verification of both libssl and libcrypto shared libraries.
5820f5
diff -up openssl-fips-0.9.8e/apps/Makefile.use-fipscheck openssl-fips-0.9.8e/apps/Makefile
5820f5
--- openssl-fips-0.9.8e/apps/Makefile.use-fipscheck	2007-08-15 15:35:29.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/apps/Makefile	2009-03-26 15:16:09.000000000 +0100
5820f5
@@ -152,8 +152,6 @@ $(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(
5820f5
 	$(RM) $(EXE)
5820f5
 	shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
5820f5
 		shlib_target="$(SHLIB_TARGET)"; \
5820f5
-	elif [ -n "$(FIPSCANLIB)" ]; then \
5820f5
-	  FIPSLD_CC=$(CC); CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
5820f5
 	fi; \
5820f5
 	LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \
5820f5
 	[ "x$(FIPSCANLIB)" = "xlibfips" ] && LIBRARIES="$$LIBRARIES -lfips"; \
5820f5
diff -up openssl-fips-0.9.8e/fips/fips.c.use-fipscheck openssl-fips-0.9.8e/fips/fips.c
5820f5
--- openssl-fips-0.9.8e/fips/fips.c.use-fipscheck	2007-08-26 16:57:10.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/fips/fips.c	2009-04-15 11:43:59.000000000 +0200
5820f5
@@ -47,6 +47,8 @@
5820f5
  *
5820f5
  */
5820f5
 
5820f5
+#define _GNU_SOURCE
5820f5
+
5820f5
 #include <openssl/fips.h>
5820f5
 #include <openssl/rand.h>
5820f5
 #include <openssl/fips_rand.h>
5820f5
@@ -56,6 +58,9 @@
5820f5
 #include <openssl/rsa.h>
5820f5
 #include <string.h>
5820f5
 #include <limits.h>
5820f5
+#include <dlfcn.h>
5820f5
+#include <stdio.h>
5820f5
+#include <stdlib.h>
5820f5
 #include "fips_locl.h"
5820f5
 
5820f5
 #ifdef OPENSSL_FIPS
5820f5
@@ -163,6 +168,7 @@ int FIPS_selftest()
5820f5
 	&& FIPS_selftest_dsa();
5820f5
     }
5820f5
 
5820f5
+#if 0
5820f5
 extern const void         *FIPS_text_start(),  *FIPS_text_end();
5820f5
 extern const unsigned char FIPS_rodata_start[], FIPS_rodata_end[];
5820f5
 unsigned char              FIPS_signature [20] = { 0 };
5820f5
@@ -241,6 +247,206 @@ int FIPS_check_incore_fingerprint(void)
5820f5
 
5820f5
     return 1;
5820f5
     }
5820f5
+#else
5820f5
+/* we implement what libfipscheck does ourselves */
5820f5
+
5820f5
+static int
5820f5
+get_library_path(const char *libname, const char *symbolname, char *path, size_t pathlen)
5820f5
+{
5820f5
+	Dl_info info;
5820f5
+	void *dl, *sym;
5820f5
+	int rv = -1;
5820f5
+
5820f5
+        dl = dlopen(libname, RTLD_LAZY);
5820f5
+        if (dl == NULL) {
5820f5
+	        return -1;
5820f5
+        }       
5820f5
+
5820f5
+	sym = dlsym(dl, symbolname);
5820f5
+
5820f5
+	if (sym != NULL && dladdr(sym, &info)) {
5820f5
+		strncpy(path, info.dli_fname, pathlen-1);
5820f5
+		path[pathlen-1] = '\0';
5820f5
+		rv = 0;
5820f5
+	}
5820f5
+
5820f5
+	dlclose(dl);	
5820f5
+	
5820f5
+	return rv;
5820f5
+}
5820f5
+
5820f5
+static const char conv[] = "0123456789abcdef";
5820f5
+
5820f5
+static char *
5820f5
+bin2hex(void *buf, size_t len)
5820f5
+{
5820f5
+	char *hex, *p;
5820f5
+	unsigned char *src = buf;
5820f5
+	
5820f5
+	hex = malloc(len * 2 + 1);
5820f5
+	if (hex == NULL)
5820f5
+		return NULL;
5820f5
+
5820f5
+	p = hex;
5820f5
+
5820f5
+	while (len > 0) {
5820f5
+		unsigned c;
5820f5
+
5820f5
+		c = *src;
5820f5
+		src++;
5820f5
+
5820f5
+		*p = conv[c >> 4];
5820f5
+		++p;
5820f5
+		*p = conv[c & 0x0f];
5820f5
+		++p;
5820f5
+		--len;
5820f5
+	}
5820f5
+	*p = '\0';
5820f5
+	return hex;
5820f5
+}
5820f5
+
5820f5
+#define HMAC_PREFIX "." 
5820f5
+#define HMAC_SUFFIX ".hmac" 
5820f5
+#define READ_BUFFER_LENGTH 16384
5820f5
+
5820f5
+static char *
5820f5
+make_hmac_path(const char *origpath)
5820f5
+{
5820f5
+	char *path, *p;
5820f5
+	const char *fn;
5820f5
+
5820f5
+	path = malloc(sizeof(HMAC_PREFIX) + sizeof(HMAC_SUFFIX) + strlen(origpath));
5820f5
+	if(path == NULL) {
5820f5
+		return NULL;
5820f5
+	}
5820f5
+
5820f5
+	fn = strrchr(origpath, '/');
5820f5
+	if (fn == NULL) {
5820f5
+		fn = origpath;
5820f5
+	} else {
5820f5
+		++fn;
5820f5
+	}
5820f5
+
5820f5
+	strncpy(path, origpath, fn-origpath);
5820f5
+	p = path + (fn - origpath);
5820f5
+	p = stpcpy(p, HMAC_PREFIX);
5820f5
+	p = stpcpy(p, fn);
5820f5
+	p = stpcpy(p, HMAC_SUFFIX);
5820f5
+
5820f5
+	return path;
5820f5
+}
5820f5
+
5820f5
+static const char hmackey[] = "orboDeJITITejsirpADONivirpUkvarP";
5820f5
+
5820f5
+static int
5820f5
+compute_file_hmac(const char *path, void **buf, size_t *hmaclen)
5820f5
+{
5820f5
+	FILE *f = NULL;
5820f5
+	int rv = -1;
5820f5
+	unsigned char rbuf[READ_BUFFER_LENGTH];
5820f5
+	size_t len;
5820f5
+	unsigned int hlen;
5820f5
+	HMAC_CTX c;
5820f5
+
5820f5
+	HMAC_CTX_init(&c);
5820f5
+
5820f5
+	f = fopen(path, "r");
5820f5
+
5820f5
+	if (f == NULL) {
5820f5
+		goto end;
5820f5
+	}
5820f5
+
5820f5
+	HMAC_Init(&c, hmackey, sizeof(hmackey)-1, EVP_sha256());
5820f5
+
5820f5
+	while ((len=fread(rbuf, 1, sizeof(rbuf), f)) != 0) {
5820f5
+		HMAC_Update(&c, rbuf, len);
5820f5
+	}
5820f5
+
5820f5
+	len = sizeof(rbuf);
5820f5
+	/* reuse rbuf for hmac */
5820f5
+	HMAC_Final(&c, rbuf, &hlen);
5820f5
+
5820f5
+	*buf = malloc(hlen);
5820f5
+	if (*buf == NULL) {
5820f5
+		goto end;
5820f5
+	}
5820f5
+
5820f5
+	*hmaclen = hlen;
5820f5
+
5820f5
+	memcpy(*buf, rbuf, hlen);
5820f5
+
5820f5
+	rv = 0;
5820f5
+end:
5820f5
+	HMAC_CTX_cleanup(&c);
5820f5
+
5820f5
+	if (f)
5820f5
+		fclose(f);
5820f5
+
5820f5
+	return rv;
5820f5
+}
5820f5
+
5820f5
+static int
5820f5
+FIPSCHECK_verify(const char *libname, const char *symbolname)
5820f5
+{
5820f5
+	char path[PATH_MAX+1];
5820f5
+	int rv;
5820f5
+	FILE *hf;
5820f5
+	char *hmacpath, *p;
5820f5
+	char *hmac = NULL;
5820f5
+	size_t n;
5820f5
+	
5820f5
+	rv = get_library_path(libname, symbolname, path, sizeof(path));
5820f5
+
5820f5
+	if (rv < 0)
5820f5
+		return 0;
5820f5
+
5820f5
+	hmacpath = make_hmac_path(path);
5820f5
+
5820f5
+	hf = fopen(hmacpath, "r");
5820f5
+	if (hf == NULL) {
5820f5
+		free(hmacpath);
5820f5
+		return 0;
5820f5
+	}
5820f5
+
5820f5
+	if (getline(&hmac, &n, hf) > 0) {
5820f5
+		void *buf;
5820f5
+		size_t hmaclen;
5820f5
+		char *hex;
5820f5
+
5820f5
+		if ((p=strchr(hmac, '\n')) != NULL)
5820f5
+			*p = '\0';
5820f5
+
5820f5
+		if (compute_file_hmac(path, &buf, &hmaclen) < 0) {
5820f5
+			rv = -4;
5820f5
+			goto end;
5820f5
+		}
5820f5
+
5820f5
+		if ((hex=bin2hex(buf, hmaclen)) == NULL) {
5820f5
+			free(buf);
5820f5
+			rv = -5;
5820f5
+			goto end;
5820f5
+		}
5820f5
+
5820f5
+		if (strcmp(hex, hmac) != 0) {
5820f5
+			rv = -1;
5820f5
+		}
5820f5
+		free(buf);
5820f5
+		free(hex);
5820f5
+	}
5820f5
+
5820f5
+end:
5820f5
+	free(hmac);
5820f5
+	free(hmacpath);
5820f5
+	fclose(hf);
5820f5
+
5820f5
+	if (rv < 0)
5820f5
+		return 0;
5820f5
+
5820f5
+	/* check successful */
5820f5
+	return 1;	
5820f5
+}
5820f5
+
5820f5
+#endif
5820f5
 
5820f5
 int FIPS_mode_set(int onoff)
5820f5
     {
5820f5
@@ -278,16 +484,17 @@ int FIPS_mode_set(int onoff)
5820f5
 	    }
5820f5
 #endif
5820f5
 
5820f5
-	if(fips_signature_witness() != FIPS_signature)
5820f5
+	if(!FIPSCHECK_verify("libcrypto.so.0.9.8e","FIPS_mode_set"))
5820f5
 	    {
5820f5
-	    FIPSerr(FIPS_F_FIPS_MODE_SET,FIPS_R_CONTRADICTING_EVIDENCE);
5820f5
+	    FIPSerr(FIPS_F_FIPS_MODE_SET,FIPS_R_FINGERPRINT_DOES_NOT_MATCH);
5820f5
 	    fips_selftest_fail = 1;
5820f5
 	    ret = 0;
5820f5
 	    goto end;
5820f5
 	    }
5820f5
 
5820f5
-	if(!FIPS_check_incore_fingerprint())
5820f5
+	if(!FIPSCHECK_verify("libssl.so.0.9.8e","SSL_CTX_new"))
5820f5
 	    {
5820f5
+	    FIPSerr(FIPS_F_FIPS_MODE_SET,FIPS_R_FINGERPRINT_DOES_NOT_MATCH);
5820f5
 	    fips_selftest_fail = 1;
5820f5
 	    ret = 0;
5820f5
 	    goto end;
5820f5
@@ -403,11 +610,13 @@ int fips_clear_owning_thread(void)
5820f5
 	return ret;
5820f5
 	}
5820f5
 
5820f5
+#if 0
5820f5
 unsigned char *fips_signature_witness(void)
5820f5
 	{
5820f5
 	extern unsigned char FIPS_signature[];
5820f5
 	return FIPS_signature;
5820f5
 	}
5820f5
+#endif
5820f5
 
5820f5
 /* Generalized public key test routine. Signs and verifies the data
5820f5
  * supplied in tbs using mesage digest md and setting option digest
5820f5
diff -up openssl-fips-0.9.8e/fips/fips_locl.h.use-fipscheck openssl-fips-0.9.8e/fips/fips_locl.h
5820f5
--- openssl-fips-0.9.8e/fips/fips_locl.h.use-fipscheck	2007-08-15 15:35:31.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/fips/fips_locl.h	2009-03-26 15:15:39.000000000 +0100
5820f5
@@ -63,7 +63,9 @@ int fips_is_owning_thread(void);
5820f5
 int fips_set_owning_thread(void);
5820f5
 void fips_set_selftest_fail(void);
5820f5
 int fips_clear_owning_thread(void);
5820f5
+#if 0
5820f5
 unsigned char *fips_signature_witness(void);
5820f5
+#endif
5820f5
 
5820f5
 #define FIPS_MAX_CIPHER_TEST_SIZE	16
5820f5
 
5820f5
diff -up openssl-fips-0.9.8e/fips/Makefile.use-fipscheck openssl-fips-0.9.8e/fips/Makefile
5820f5
--- openssl-fips-0.9.8e/fips/Makefile.use-fipscheck	2007-08-15 15:35:30.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/fips/Makefile	2009-04-15 11:41:25.000000000 +0200
5820f5
@@ -62,9 +62,9 @@ testapps:
5820f5
 
5820f5
 all:
5820f5
 	@if [ -z "$(FIPSLIBDIR)" ]; then \
5820f5
-		$(MAKE) -e subdirs lib fips_premain_dso$(EXE_EXT); \
5820f5
+		$(MAKE) -e subdirs lib; \
5820f5
 	else \
5820f5
-		$(MAKE) -e lib fips_premain_dso$(EXE_EXT) fips_standalone_sha1$(EXE_EXT); \
5820f5
+		$(MAKE) -e lib; \
5820f5
 	fi
5820f5
 
5820f5
 # Idea behind fipscanister.o is to "seize" the sequestered code between
5820f5
@@ -109,7 +109,6 @@ fipscanister.o: fips_start.o $(LIBOBJ) $
5820f5
 		HP-UX|OSF1|SunOS) set -x; /usr/ccs/bin/ld -r -o $@ $$objs ;; \
5820f5
 		*) set -x; $(CC) $$cflags -r -o $@ $$objs ;; \
5820f5
 	esac fi
5820f5
-	./fips_standalone_sha1 fipscanister.o > fipscanister.o.sha1
5820f5
 
5820f5
 # If another exception is immediately required, assign approprite
5820f5
 # site-specific ld command to FIPS_SITE_LD environment variable.
5820f5
@@ -141,8 +140,24 @@ links:
5820f5
 lib:	$(LIB)
5820f5
 	@touch lib
5820f5
 
5820f5
-$(LIB):	$(FIPSLIBDIR)fipscanister.o
5820f5
-	$(AR) $(LIB) $(FIPSLIBDIR)fipscanister.o
5820f5
+$(LIB):	$(LIBOBJ) $(FIPS_OBJ_LISTS)
5820f5
+	FIPS_ASM=""; \
5820f5
+	list="$(BN_ASM)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/bn/$$i" ; done; \
5820f5
+	list="$(AES_ASM_OBJ)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/aes/$$i" ; done; \
5820f5
+	list="$(DES_ENC)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/des/$$i" ; done; \
5820f5
+	list="$(SHA1_ASM_OBJ)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/sha/$$i" ; done; \
5820f5
+	if [ -n "$(CPUID_OBJ)" ]; then \
5820f5
+		CPUID=../crypto/$(CPUID_OBJ) ; \
5820f5
+	else \
5820f5
+		CPUID="" ; \
5820f5
+	fi ; \
5820f5
+	objs="$(LIBOBJ) $(FIPS_EX_OBJ) $$CPUID $$FIPS_ASM"; \
5820f5
+	for i in $(FIPS_OBJ_LISTS); do \
5820f5
+		dir=`dirname $$i`; script="s|^|$$dir/|;s| | $$dir/|g"; \
5820f5
+		objs="$$objs `sed "$$script" $$i`"; \
5820f5
+	done; \
5820f5
+	objs="$$objs" ; \
5820f5
+	$(AR) $(LIB) $$objs 
5820f5
 	$(RANLIB) $(LIB) || echo Never mind.
5820f5
 
5820f5
 $(FIPSCANLIB):	$(FIPSCANLOC)
5820f5
@@ -154,7 +169,7 @@ $(FIPSCANLIB):	$(FIPSCANLOC)
5820f5
 	$(RANLIB) ../$(FIPSCANLIB).a || echo Never mind.
5820f5
 	@touch lib
5820f5
 
5820f5
-shared:	lib subdirs fips_premain_dso$(EXE_EXT)
5820f5
+shared:	lib subdirs
5820f5
 
5820f5
 libs:
5820f5
 	@target=lib; $(RECURSIVE_MAKE)
5820f5
@@ -178,10 +193,6 @@ install:
5820f5
 	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
5820f5
 	done;
5820f5
 	@target=install; $(RECURSIVE_MAKE)
5820f5
-	@cp -p -f fipscanister.o fipscanister.o.sha1 fips_premain.c \
5820f5
-		fips_premain.c.sha1 \
5820f5
-		$(INSTALL_PREFIX)$(INSTALLTOP)/lib/; \
5820f5
-	chmod 0444 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/fips*
5820f5
 
5820f5
 lint:
5820f5
 	@target=lint; $(RECURSIVE_MAKE)
5820f5
diff -up openssl-fips-0.9.8e/fips/sha/fips_standalone_sha1.c.use-fipscheck openssl-fips-0.9.8e/fips/sha/fips_standalone_sha1.c
5820f5
--- openssl-fips-0.9.8e/fips/sha/fips_standalone_sha1.c.use-fipscheck	2007-08-15 15:35:46.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/fips/sha/fips_standalone_sha1.c	2009-04-15 11:58:37.000000000 +0200
5820f5
@@ -62,20 +62,20 @@ void OPENSSL_cleanse(void *p,size_t len)
5820f5
 
5820f5
 #ifdef OPENSSL_FIPS
5820f5
 
5820f5
-static void hmac_init(SHA_CTX *md_ctx,SHA_CTX *o_ctx,
5820f5
+static void hmac_init(SHA256_CTX *md_ctx,SHA256_CTX *o_ctx,
5820f5
 		      const char *key)
5820f5
     {
5820f5
-    int len=strlen(key);
5820f5
+    size_t len=strlen(key);
5820f5
     int i;
5820f5
     unsigned char keymd[HMAC_MAX_MD_CBLOCK];
5820f5
     unsigned char pad[HMAC_MAX_MD_CBLOCK];
5820f5
 
5820f5
     if (len > SHA_CBLOCK)
5820f5
 	{
5820f5
-	SHA1_Init(md_ctx);
5820f5
-	SHA1_Update(md_ctx,key,len);
5820f5
-	SHA1_Final(keymd,md_ctx);
5820f5
-	len=20;
5820f5
+	SHA256_Init(md_ctx);
5820f5
+	SHA256_Update(md_ctx,key,len);
5820f5
+	SHA256_Final(keymd,md_ctx);
5820f5
+	len=SHA256_DIGEST_LENGTH;
5820f5
 	}
5820f5
     else
5820f5
 	memcpy(keymd,key,len);
5820f5
@@ -83,22 +83,22 @@ static void hmac_init(SHA_CTX *md_ctx,SH
5820f5
 
5820f5
     for(i=0 ; i < HMAC_MAX_MD_CBLOCK ; i++)
5820f5
 	pad[i]=0x36^keymd[i];
5820f5
-    SHA1_Init(md_ctx);
5820f5
-    SHA1_Update(md_ctx,pad,SHA_CBLOCK);
5820f5
+    SHA256_Init(md_ctx);
5820f5
+    SHA256_Update(md_ctx,pad,SHA256_CBLOCK);
5820f5
 
5820f5
     for(i=0 ; i < HMAC_MAX_MD_CBLOCK ; i++)
5820f5
 	pad[i]=0x5c^keymd[i];
5820f5
-    SHA1_Init(o_ctx);
5820f5
-    SHA1_Update(o_ctx,pad,SHA_CBLOCK);
5820f5
+    SHA256_Init(o_ctx);
5820f5
+    SHA256_Update(o_ctx,pad,SHA256_CBLOCK);
5820f5
     }
5820f5
 
5820f5
-static void hmac_final(unsigned char *md,SHA_CTX *md_ctx,SHA_CTX *o_ctx)
5820f5
+static void hmac_final(unsigned char *md,SHA256_CTX *md_ctx,SHA256_CTX *o_ctx)
5820f5
     {
5820f5
-    unsigned char buf[20];
5820f5
+    unsigned char buf[SHA256_DIGEST_LENGTH];
5820f5
 
5820f5
-    SHA1_Final(buf,md_ctx);
5820f5
-    SHA1_Update(o_ctx,buf,sizeof buf);
5820f5
-    SHA1_Final(md,o_ctx);
5820f5
+    SHA256_Final(buf,md_ctx);
5820f5
+    SHA256_Update(o_ctx,buf,sizeof buf);
5820f5
+    SHA256_Final(md,o_ctx);
5820f5
     }
5820f5
 
5820f5
 #endif
5820f5
@@ -106,7 +106,7 @@ static void hmac_final(unsigned char *md
5820f5
 int main(int argc,char **argv)
5820f5
     {
5820f5
 #ifdef OPENSSL_FIPS
5820f5
-    static char key[]="etaonrishdlcupfm";
5820f5
+    static char key[]="orboDeJITITejsirpADONivirpUkvarP";
5820f5
     int n,binary=0;
5820f5
 
5820f5
     if(argc < 2)
5820f5
@@ -125,8 +125,8 @@ int main(int argc,char **argv)
5820f5
     for(; n < argc ; ++n)
5820f5
 	{
5820f5
 	FILE *f=fopen(argv[n],"rb");
5820f5
-	SHA_CTX md_ctx,o_ctx;
5820f5
-	unsigned char md[20];
5820f5
+	SHA256_CTX md_ctx,o_ctx;
5820f5
+	unsigned char md[SHA256_DIGEST_LENGTH];
5820f5
 	int i;
5820f5
 
5820f5
 	if(!f)
5820f5
@@ -139,7 +139,7 @@ int main(int argc,char **argv)
5820f5
 	for( ; ; )
5820f5
 	    {
5820f5
 	    char buf[1024];
5820f5
-	    int l=fread(buf,1,sizeof buf,f);
5820f5
+	    size_t l=fread(buf,1,sizeof buf,f);
5820f5
 
5820f5
 	    if(l == 0)
5820f5
 		{
5820f5
@@ -151,18 +151,18 @@ int main(int argc,char **argv)
5820f5
 		else
5820f5
 		    break;
5820f5
 		}
5820f5
-	    SHA1_Update(&md_ctx,buf,l);
5820f5
+	    SHA256_Update(&md_ctx,buf,l);
5820f5
 	    }
5820f5
 	hmac_final(md,&md_ctx,&o_ctx);
5820f5
 
5820f5
 	if (binary)
5820f5
 	    {
5820f5
-	    fwrite(md,20,1,stdout);
5820f5
+	    fwrite(md,SHA256_DIGEST_LENGTH,1,stdout);
5820f5
 	    break;	/* ... for single(!) file */
5820f5
 	    }
5820f5
 
5820f5
-	printf("HMAC-SHA1(%s)= ",argv[n]);
5820f5
-	for(i=0 ; i < 20 ; ++i)
5820f5
+/*	printf("HMAC-SHA1(%s)= ",argv[n]); */
5820f5
+	for(i=0 ; i < SHA256_DIGEST_LENGTH ; ++i)
5820f5
 	    printf("%02x",md[i]);
5820f5
 	printf("\n");
5820f5
 	}
5820f5
diff -up openssl-fips-0.9.8e/fips/sha/Makefile.use-fipscheck openssl-fips-0.9.8e/fips/sha/Makefile
5820f5
--- openssl-fips-0.9.8e/fips/sha/Makefile.use-fipscheck	2009-03-26 15:16:04.000000000 +0100
5820f5
+++ openssl-fips-0.9.8e/fips/sha/Makefile	2009-04-15 11:57:17.000000000 +0200
5820f5
@@ -47,7 +47,7 @@ lib:	$(LIBOBJ)
5820f5
 	@echo $(LIBOBJ) > lib
5820f5
 
5820f5
 ../fips_standalone_sha1$(EXE_EXT): fips_standalone_sha1.o
5820f5
-	FIPS_SHA_ASM=""; for i in $(SHA1_ASM_OBJ) sha1dgst.o ; do FIPS_SHA_ASM="$$FIPS_SHA_ASM ../../crypto/sha/$$i" ; done; \
5820f5
+	FIPS_SHA_ASM=""; for i in $(SHA1_ASM_OBJ) sha256.o ; do FIPS_SHA_ASM="$$FIPS_SHA_ASM ../../crypto/sha/$$i" ; done; \
5820f5
 	$(CC) -o $@ $(CFLAGS) fips_standalone_sha1.o $$FIPS_SHA_ASM
5820f5
 
5820f5
 files:
5820f5
diff -up openssl-fips-0.9.8e/Makefile.org.use-fipscheck openssl-fips-0.9.8e/Makefile.org
5820f5
--- openssl-fips-0.9.8e/Makefile.org.use-fipscheck	2009-03-26 15:15:39.000000000 +0100
5820f5
+++ openssl-fips-0.9.8e/Makefile.org	2009-03-26 15:15:39.000000000 +0100
5820f5
@@ -355,10 +355,6 @@ libcrypto$(SHLIB_EXT): libcrypto.a $(SHA
5820f5
 			$(MAKE) SHLIBDIRS='crypto' SHLIBDEPS='-lfips' build-shared; \
5820f5
 			$(AR) libcrypto.a fips/fipscanister.o ; \
5820f5
 		else \
5820f5
-			if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
5820f5
-				FIPSLD_CC=$(CC); CC=fips/fipsld; \
5820f5
-				export CC FIPSLD_CC; \
5820f5
-			fi; \
5820f5
 			$(MAKE) -e SHLIBDIRS='crypto' build-shared; \
5820f5
 		fi \
5820f5
 	else \
5820f5
@@ -379,9 +375,8 @@ libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT
5820f5
 fips/fipscanister.o:	build_fips
5820f5
 libfips$(SHLIB_EXT):		fips/fipscanister.o
5820f5
 	@if [ "$(SHLIB_TARGET)" != "" ]; then \
5820f5
-		FIPSLD_CC=$(CC); CC=fips/fipsld; export CC FIPSLD_CC; \
5820f5
 		$(MAKE) -f Makefile.shared -e $(BUILDENV) \
5820f5
-			CC=$${CC} LIBNAME=fips THIS=$@ \
5820f5
+			CC=$(CC) LIBNAME=fips THIS=$@ \
5820f5
 			LIBEXTRAS=fips/fipscanister.o \
5820f5
 			LIBDEPS="$(EX_LIBS)" \
5820f5
 			LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
5820f5
@@ -467,7 +462,7 @@ openssl.pc: Makefile
5820f5
 	    echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
5820f5
 	    echo 'Version: '$(VERSION); \
5820f5
 	    echo 'Requires: '; \
5820f5
-	    echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
5820f5
+	    echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)';\
5820f5
 	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
5820f5
 
5820f5
 Makefile: Makefile.org Configure config
5820f5
diff -up openssl-fips-0.9.8e/test/Makefile.use-fipscheck openssl-fips-0.9.8e/test/Makefile
5820f5
--- openssl-fips-0.9.8e/test/Makefile.use-fipscheck	2007-08-26 16:57:41.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/test/Makefile	2009-04-15 11:37:30.000000000 +0200
5820f5
@@ -395,8 +395,7 @@ FIPS_BUILD_CMD=shlib_target=; if [ -n "$
5820f5
 	if [ "$(FIPSCANLIB)" = "libfips" ]; then \
5820f5
 		LIBRARIES="-L$(TOP) -lfips"; \
5820f5
 	else \
5820f5
-		FIPSLD_CC=$(CC); CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
5820f5
-		LIBRARIES="$${FIPSLIBDIR:-$(TOP)/fips/}fipscanister.o"; \
5820f5
+		LIBRARIES="$(LIBCRYPTO)"; \
5820f5
 	fi; \
5820f5
 	$(MAKE) -f $(TOP)/Makefile.shared -e \
5820f5
 		CC=$${CC} APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \
5820f5
@@ -407,9 +406,6 @@ FIPS_CRYPTO_BUILD_CMD=shlib_target=; if 
5820f5
 		shlib_target="$(SHLIB_TARGET)"; \
5820f5
 	fi; \
5820f5
 	LIBRARIES="$(LIBSSL) $(LIBCRYPTO) $(LIBKRB5)"; \
5820f5
-	if [ -z "$(SHARED_LIBS)" ] ; then \
5820f5
-		FIPSLD_CC=$(CC); CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
5820f5
-	fi; \
5820f5
 	[ "$(FIPSCANLIB)" = "libfips" ] && LIBRARIES="$$LIBRARIES -lfips"; \
5820f5
 	$(MAKE) -f $(TOP)/Makefile.shared -e \
5820f5
 		CC=$${CC} APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \