diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-03-22 14:23:33 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-03-22 15:07:47 +0100 |
commit | 7401d5c1100a35dd5eafa602fad6d334dea98225 (patch) | |
tree | c25a471376a4d93d6d42bc3bcdf846e11446aec2 /uclient-utils.h | |
parent | 134709fa39d575970cb62d6f070d02f67bc57744 (diff) | |
download | uclient-7401d5c1100a35dd5eafa602fad6d334dea98225.tar.gz |
add utilities for calculating http digest hashes
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'uclient-utils.h')
-rw-r--r-- | uclient-utils.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/uclient-utils.h b/uclient-utils.h index a7eaf1c..83ab09a 100644 --- a/uclient-utils.h +++ b/uclient-utils.h @@ -3,14 +3,28 @@ #include <stdbool.h> +struct http_digest_data { + const char *uri; + const char *method; + + const char *auth_hash; /* H(A1) */ + const char *qop; + const char *nc; + const char *nonce; + const char *cnonce; +}; + static inline int base64_len(int len) { return ((len + 2) / 3) * 4; } void base64_encode(const void *inbuf, unsigned int len, void *out); +void bin_to_hex(char *dest, const void *buf, int len); int uclient_urldecode(const char *in, char *out, bool decode_plus); +void http_digest_calculate_auth_hash(char *dest, const char *user, const char *realm, const char *password); +void http_digest_calculate_response(char *dest, const struct http_digest_data *data); #endif |