[Gambas-user] [Gambas Bug Tracker] Bug #984: error compiling again 0.9 openssl, only 1.0 compiles

bugtracker at ...3416... bugtracker at ...3416...
Tue Aug 30 17:41:56 CEST 2016


http://gambaswiki.org/bugtracker/edit?object=BUG.984&from=L21haW4-

Comment #22 by PICCORO LENZ MCKAY:

hi Thal, thanks for the article, interesting, i read some of the article! seems the hmac funtions related theres's not tests that certified that are right! for the future, i recomended rewrite the module using a good software as polarssl, but now lets help with this problem:

its' hmac related code right implemented? or its hmac property documented to right implemented!
i ignored the hmac problem due i made more test with my patches, recompile again and clean install and still all other related works perfectly, and any other can certified the path works and its right implemented!

and tobias, sorry for patch, i not sync the code, here the patch:

--- c_digest.c.old 
+++ c_digest.c 
@@ -139,6 +139,55 @@
  * the behaviour described in their manpage.
  */
 #if OPENSSL_VERSION_NUMBER < 0x10100000L
+/*
+ * Special treatment for OpenSSL 0.9.8*. The version hex below is 0.9.8zh.
+ * The *_new() and *_free() routines were called *_create() and *_destroy()
+ * there.
+ */
+#if OPENSSL_VERSION_NUMBER <= 0x0090821fL
+inline int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
+{
+	/* Don't assume ctx->md_data was cleaned in EVP_Digest_Final,
+	 * because sometimes only copies of the context are ever finalised.
+	 */
+	if (ctx->digest && ctx->digest->cleanup
+	 && !M_EVP_MD_CTX_test_flags(ctx,EVP_MD_CTX_FLAG_CLEANED))
+		ctx->digest->cleanup(ctx);
+	if (ctx->digest && ctx->digest->ctx_size && ctx->md_data
+	  && !M_EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) {
+		OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size);
+		OPENSSL_free(ctx->md_data);
+	}
+#ifndef OPENSSL_NO_ENGINE
+	if(ctx->engine)
+		/* The EVP_MD we used belongs to an ENGINE, release the
+		 * functional reference we held for this reason. */
+		do_engine_finish(ctx->engine);
+#endif
+	memset(ctx,'\0',sizeof *ctx);
+	return 1;
+}
+
+inline void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
+{
+	memset(ctx, '\0', sizeof *ctx);
+}
+
+inline EVP_MD_CTX *EVP_MD_CTX_new(void)
+{
+	EVP_MD_CTX *ctx = OPENSSL_malloc(sizeof *ctx);
+
+	if (ctx)
+		EVP_MD_CTX_init(ctx);
+	return ctx;
+}
+
+inline void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
+{
+	EVP_MD_CTX_cleanup(ctx);
+	OPENSSL_free(ctx);
+}
+#else /* Anything recent */
 static void OPENSSL_clear_free(void *str, size_t num)
 {
 	OPENSSL_cleanse(str, num);
@@ -191,6 +240,7 @@
     OPENSSL_free(ctx);
 }
 #endif
+#endif
 
 /**G
  * Hash the given string using this digest algorithm.

PICCORO LENZ MCKAY changed the state of the bug to: Accepted.






More information about the User mailing list