changeset 1134:4f6722b4d69e

switch from libmd to libcrypto libmd was the last illumos-specific interface required. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sat, 06 Oct 2018 23:59:02 -0400
parents 9a70df4e78e9
children c6aa5d10c97a
files CMakeLists.txt README math.c
diffstat 3 files changed, 8 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Sat Oct 06 23:46:44 2018 -0400
+++ b/CMakeLists.txt	Sat Oct 06 23:59:02 2018 -0400
@@ -102,7 +102,7 @@
 add_dependencies(blahg revisiontag)
 
 target_link_libraries(blahg
-	md
+	crypto
 	m
 	${JEFFPC_LIBRARY}
 )
--- a/README	Sat Oct 06 23:46:44 2018 -0400
+++ b/README	Sat Oct 06 23:59:02 2018 -0400
@@ -46,15 +46,10 @@
 Dependencies
 ============
 
-At present time, blahgd depends on a number of interfaces and features
-provided by illumos-based distros (e.g., OmniOS or OpenIndiana hipster).
-Specifically, blahgd requires:
-
-  - libmd.so (for SHA1)
-
-Other dependencies include:
+To build blahgd you must have:
 
   - flex & bison
+  - libcrypto
 
 Building and Installing
 =======================
--- a/math.c	Sat Oct 06 23:46:44 2018 -0400
+++ b/math.c	Sat Oct 06 23:59:02 2018 -0400
@@ -20,7 +20,7 @@
  * SOFTWARE.
  */
 
-#include <sha1.h>
+#include <openssl/sha.h>
 
 #include <jeffpc/val.h>
 #include <jeffpc/synch.h>
@@ -157,16 +157,16 @@
 	char pngpath[FILENAME_MAX];
 
 	const char *tex = str_cstr(val);
-	SHA1_CTX digest;
+	SHA_CTX digest;
 	struct stat statbuf;
 	unsigned char md[20];
 	char amd[41];
 	uint32_t id;
 	int ret;
 
-	SHA1Init(&digest);
-	SHA1Update(&digest, tex, strlen(tex));
-	SHA1Final(md, &digest);
+	VERIFY3S(SHA1_Init(&digest), ==, 1);
+	VERIFY3S(SHA1_Update(&digest, tex, strlen(tex)), ==, 1);
+	VERIFY3S(SHA1_Final(md, &digest), ==, 1);
 
 	hexdumpz(amd, md, 20, true);