shithub: openh264

Download patch

ref: 4f5fd952b636e739faef2c76f74b21ee11bf6dd2
parent: e8a2cf6d1f84035a7af4766e6a7b2120ef5f16c1
author: Martin Storsjö <[email protected]>
date: Fri Jan 17 05:39:42 EST 2014

Use the bundled sha1 implementation instead of relying on openssl

This simplifies running tests on platforms where OpenSSL isn't
commonly available.

--- a/Makefile
+++ b/Makefile
@@ -82,7 +82,7 @@
 H264ENC_LDFLAGS = -L. $(call LINK_LIB,encoder) $(call LINK_LIB,processing) $(call LINK_LIB,common)
 H264ENC_DEPS = $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
 
-CODEC_UNITTEST_LDFLAGS = -L. -lgtest -ldecoder -lcrypto -lencoder -lprocessing -lcommon
+CODEC_UNITTEST_LDFLAGS = -L. -lgtest -ldecoder -lencoder -lprocessing -lcommon
 CODEC_UNITTEST_DEPS = $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
 
 .PHONY: test gtest-bootstrap clean
--- a/test/sha1.h
+++ b/test/sha1.h
@@ -77,6 +77,12 @@
                 const unsigned char *,
                 unsigned);
 
+#define SHA_DIGEST_LENGTH 20
+#define SHA_CTX SHA1Context
+#define SHA1_Init(ctx) SHA1Reset(ctx)
+#define SHA1_Update(ctx, d, l) SHA1Input(ctx, d, l)
+#define SHA1_Final(d, ctx) SHA1Result(ctx, d)
+
 #ifdef __cplusplus
 }
 #endif
--- a/test/utils/HashFunctions.h
+++ b/test/utils/HashFunctions.h
@@ -3,7 +3,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <openssl/sha.h>
+#include "../sha1.h"
 
 static bool CompareHash(const unsigned char* digest, const char* hashStr) {
   char hashStrCmp[SHA_DIGEST_LENGTH * 2 + 1];