Mercurial > pidgin
comparison src/cipher.c @ 12389:e024601d45c7
[gaim-migrate @ 14695]
How about we allow callers to pass in the entity body, rather than forcing them to hash it themselves?
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 07 Dec 2005 11:01:49 +0000 |
parents | 4e045668b9d0 |
children | c01aa6ea4947 |
comparison
equal
deleted
inserted
replaced
12388:4e045668b9d0 | 12389:e024601d45c7 |
---|---|
1847 gchar *gaim_cipher_http_digest_calculate_response( | 1847 gchar *gaim_cipher_http_digest_calculate_response( |
1848 const gchar *algorithm, | 1848 const gchar *algorithm, |
1849 const gchar *method, | 1849 const gchar *method, |
1850 const gchar *digest_uri, | 1850 const gchar *digest_uri, |
1851 const gchar *qop, | 1851 const gchar *qop, |
1852 const gchar *hashed_entity, | 1852 const gchar *entity, |
1853 size_t hashed_entity_len, | |
1854 const gchar *nonce, | 1853 const gchar *nonce, |
1855 const gchar *nonce_count, | 1854 const gchar *nonce_count, |
1856 const gchar *client_nonce, | 1855 const gchar *client_nonce, |
1857 const gchar *session_key) | 1856 const gchar *session_key) |
1858 { | 1857 { |
1886 gaim_cipher_context_append(context, (guchar *)":", 1); | 1885 gaim_cipher_context_append(context, (guchar *)":", 1); |
1887 gaim_cipher_context_append(context, (guchar *)digest_uri, strlen(digest_uri)); | 1886 gaim_cipher_context_append(context, (guchar *)digest_uri, strlen(digest_uri)); |
1888 | 1887 |
1889 if (qop != NULL && !strcasecmp(qop, "auth-int")) | 1888 if (qop != NULL && !strcasecmp(qop, "auth-int")) |
1890 { | 1889 { |
1891 if (hashed_entity == NULL) | 1890 GaimCipherContext *context2; |
1891 gchar entity_hash[33]; | |
1892 | |
1893 if (entity == NULL) | |
1892 { | 1894 { |
1893 gaim_cipher_context_destroy(context); | 1895 gaim_cipher_context_destroy(context); |
1894 gaim_debug_error("cipher", "Required hashed_entity missing for auth-int digest calculation."); | 1896 gaim_debug_error("cipher", "Required entity missing for auth-int digest calculation."); |
1895 return NULL; | 1897 return NULL; |
1896 } | 1898 } |
1897 | 1899 |
1900 context2 = gaim_cipher_context_new(cipher, NULL); | |
1901 gaim_cipher_context_append(context2, (guchar *)entity, strlen(entity)); | |
1902 gaim_cipher_context_digest_to_str(context2, sizeof(entity_hash), entity_hash, NULL); | |
1903 gaim_cipher_context_destroy(context2); | |
1904 | |
1898 gaim_cipher_context_append(context, (guchar *)":", 1); | 1905 gaim_cipher_context_append(context, (guchar *)":", 1); |
1899 gaim_cipher_context_append(context, (guchar *)hashed_entity, hashed_entity_len); | 1906 gaim_cipher_context_append(context, (guchar *)entity_hash, strlen(entity_hash)); |
1900 } | 1907 } |
1901 | 1908 |
1902 gaim_cipher_context_digest_to_str(context, sizeof(hash2), hash2, NULL); | 1909 gaim_cipher_context_digest_to_str(context, sizeof(hash2), hash2, NULL); |
1903 gaim_cipher_context_destroy(context); | 1910 gaim_cipher_context_destroy(context); |
1904 | 1911 |