Re-apply portability changes to current sha2.{c,h}.

Rather than attempt to apply 14 years' worth of changes to OpenBSD's sha2
I imported the current versions directly then re-applied the portability
changes.  This also allowed re-syncing digest-libc.c against upstream.
diff --git a/digest-libc.c b/digest-libc.c
index c2b0b24..12737e5 100644
--- a/digest-libc.c
+++ b/digest-libc.c
@@ -28,7 +28,11 @@
 #if 0
 #include <md5.h>
 #include <rmd160.h>
+#endif
+#ifdef HAVE_SHA1_H
 #include <sha1.h>
+#endif
+#ifdef HAVE_SHA2_H
 #include <sha2.h>
 #endif
 
@@ -83,30 +87,30 @@
 		"SHA256",
 		SHA256_BLOCK_LENGTH,
 		SHA256_DIGEST_LENGTH,
-		sizeof(SHA256_CTX),
-		(md_init_fn *) SHA256_Init,
-		(md_update_fn *) SHA256_Update,
-		(md_final_fn *) SHA256_Final
+		sizeof(SHA2_CTX),
+		(md_init_fn *) SHA256Init,
+		(md_update_fn *) SHA256Update,
+		(md_final_fn *) SHA256Final
 	},
 	{
 		SSH_DIGEST_SHA384,
 		"SHA384",
 		SHA384_BLOCK_LENGTH,
 		SHA384_DIGEST_LENGTH,
-		sizeof(SHA384_CTX),
-		(md_init_fn *) SHA384_Init,
-		(md_update_fn *) SHA384_Update,
-		(md_final_fn *) SHA384_Final
+		sizeof(SHA2_CTX),
+		(md_init_fn *) SHA384Init,
+		(md_update_fn *) SHA384Update,
+		(md_final_fn *) SHA384Final
 	},
 	{
 		SSH_DIGEST_SHA512,
 		"SHA512",
 		SHA512_BLOCK_LENGTH,
 		SHA512_DIGEST_LENGTH,
-		sizeof(SHA512_CTX),
-		(md_init_fn *) SHA512_Init,
-		(md_update_fn *) SHA512_Update,
-		(md_final_fn *) SHA512_Final
+		sizeof(SHA2_CTX),
+		(md_init_fn *) SHA512Init,
+		(md_update_fn *) SHA512Update,
+		(md_final_fn *) SHA512Final
 	}
 };