[network-manager-openconnect/NM_0_8] Use GChecksum for sha1, not OpenSSL (cherry picked from commit a79c67b6c9ed4271651fc0b367f6d3439b801



commit 70690fdc95c5f95e17e82727bf208d97e0caa383
Author: David Woodhouse <David Woodhouse intel com>
Date:   Fri Jun 1 00:20:52 2012 +0100

    Use GChecksum for sha1, not OpenSSL
    (cherry picked from commit a79c67b6c9ed4271651fc0b367f6d3439b8013af)
    
    Conflicts:
    	auth-dialog/main.c

 auth-dialog/main.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index aa9e409..58ab793 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -994,19 +994,16 @@ if (0) {
 
 	xmlconfig = get_gconf_setting(gcl, config_path, NM_OPENCONNECT_KEY_XMLCONFIG);
 	if (xmlconfig) {
-		unsigned char sha1[SHA_DIGEST_LENGTH];
-		char sha1_text[SHA_DIGEST_LENGTH * 2];
-		EVP_MD_CTX c;
-		int i;
+		GChecksum *sha1;
+		const char *sha1_text;
 
-		EVP_MD_CTX_init(&c);
-		EVP_Digest(xmlconfig, strlen(xmlconfig), sha1, NULL, EVP_sha1(), NULL);
-		EVP_MD_CTX_cleanup(&c);
+		sha1 = g_checksum_new (G_CHECKSUM_SHA1);
+		g_checksum_update (sha1, (gpointer) xmlconfig, strlen(xmlconfig));
+		sha1_text = g_checksum_get_string(sha1);
 
-		for (i = 0; i < SHA_DIGEST_LENGTH; i++)
-			sprintf(&sha1_text[i*2], "%02x", sha1[i]);
+		openconnect_set_xmlsha1 (vpninfo, (char *)sha1_text, strlen(sha1_text) + 1);
+		g_checksum_free(sha1);
 
-		openconnect_set_xmlsha1(vpninfo, sha1_text, sizeof(sha1_text));
 		parse_xmlconfig(xmlconfig);
 		g_free(xmlconfig);
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]