[libsoup/pgriffis/digest-sha256: 1/2] wip




commit 2fab883c6dff217d0e45fe1d8273397f64b47722
Author: Patrick Griffis <pgriffis igalia com>
Date:   Fri Oct 8 07:38:46 2021 -0500

    wip

 libsoup/auth/soup-auth-digest-private.h |  4 +++-
 libsoup/auth/soup-auth-digest.c         | 14 ++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/libsoup/auth/soup-auth-digest-private.h b/libsoup/auth/soup-auth-digest-private.h
index bb251ad0..ccc10bf0 100644
--- a/libsoup/auth/soup-auth-digest-private.h
+++ b/libsoup/auth/soup-auth-digest-private.h
@@ -8,7 +8,9 @@
 typedef enum {
        SOUP_AUTH_DIGEST_ALGORITHM_NONE,
        SOUP_AUTH_DIGEST_ALGORITHM_MD5,
-       SOUP_AUTH_DIGEST_ALGORITHM_MD5_SESS
+       SOUP_AUTH_DIGEST_ALGORITHM_MD5_SESS,
+        SOUP_AUTH_DIGEST_ALGORITHM_SHA256,
+        SOUP_AUTH_DIGEST_ALGORITHM_SHA256_SESS,
 } SoupAuthDigestAlgorithm;
 
 typedef enum {
diff --git a/libsoup/auth/soup-auth-digest.c b/libsoup/auth/soup-auth-digest.c
index 13b6cc16..f5023929 100644
--- a/libsoup/auth/soup-auth-digest.c
+++ b/libsoup/auth/soup-auth-digest.c
@@ -85,6 +85,10 @@ soup_auth_digest_parse_algorithm (const char *algorithm)
                return SOUP_AUTH_DIGEST_ALGORITHM_MD5;
        else if (!g_ascii_strcasecmp (algorithm, "MD5-sess"))
                return SOUP_AUTH_DIGEST_ALGORITHM_MD5_SESS;
+        else if (!g_ascii_strcasecmp (algorithm, "SHA256"))
+                return SOUP_AUTH_DIGEST_ALGORITHM_SHA256;
+        else if (!g_ascii_strcasecmp (algorithm, "SHA256-sess"))
+                return SOUP_AUTH_DIGEST_ALGORITHM_SHA256_SESS;
        else
                return -1;
 }
@@ -96,6 +100,10 @@ soup_auth_digest_get_algorithm (SoupAuthDigestAlgorithm algorithm)
                return g_strdup ("MD5");
        else if (algorithm == SOUP_AUTH_DIGEST_ALGORITHM_MD5_SESS)
                return g_strdup ("MD5-sess");
+       if (algorithm == SOUP_AUTH_DIGEST_ALGORITHM_SHA256)
+               return g_strdup ("SHA-256");
+       else if (algorithm == SOUP_AUTH_DIGEST_ALGORITHM_SHA256_SESS)
+               return g_strdup ("SHA-256-sess");
        else
                return NULL;
 }
@@ -267,7 +275,7 @@ soup_auth_digest_compute_hex_a1 (const char              *hex_urp,
                 * but you'd be wrong.
                 */
                memcpy (hex_a1, hex_urp, 33);
-       } else {
+       } else if (algorithm == SOUP_AUTH_DIGEST_ALGORITHM_MD5_SESS) {
                GChecksum *checksum;
 
                /* In MD5-sess, A1 is hex_urp:nonce:cnonce */
@@ -280,7 +288,9 @@ soup_auth_digest_compute_hex_a1 (const char              *hex_urp,
                g_checksum_update (checksum, (guchar *)cnonce, strlen (cnonce));
                 g_strlcpy (hex_a1, g_checksum_get_string (checksum), 33);
                g_checksum_free (checksum);
-       }
+       } else if (algorithm == SOUP_AUTH_DIGEST_ALGORITHM_SHA256) {
+                
+        }
 }
 
 static void


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