Dillo v3.1.1-98-g318d1f14
Loading...
Searching...
No Matches
digest.c File Reference
#include <stdlib.h>
#include "digest.h"
#include "md5.h"
#include "msg.h"
#include "../dlib/dlib.h"
Include dependency graph for digest.c:

Go to the source code of this file.

Functions

static Dstrmd5hexdigest (const Dstr *data)
 
char * a_Digest_create_cnonce (void)
 Returns a pointer to a newly allocated string containing a cnonce.
 
int a_Digest_compute_digest (AuthRealm_t *realm, const char *username, const char *passwd)
 This portion only has to be calculated once.
 
static DstrDigest_create_response (AuthRealm_t *realm, const char *method, const char *digest_uri, const Dstr *entity_body)
 This portion is calculatd for each request.
 
static void Digest_Dstr_append_token_value (Dstr *str, int delimiter, const char *token, const char *value, int quoted)
 
char * a_Digest_authorization_hdr (AuthRealm_t *realm, const DilloUrl *url, const char *digest_uri)
 Construct Digest Authorization header.
 

Variables

static const char * ALGORITHM2STR [] = { NULL, "MD5", "MD5-sess" }
 
static const char * QOP2STR [] = { NULL, "auth", "auth-int" }
 
static const char hexchars [] = "0123456789abcdef"
 

Function Documentation

◆ a_Digest_authorization_hdr()

char * a_Digest_authorization_hdr ( AuthRealm_t realm,
const DilloUrl url,
const char *  digest_uri 
)

Construct Digest Authorization header.

Field ordering: furaisanjin reports that his DVD recorder requires the order that IE happens to use: "username, realm, nonce, uri, cnonce, nc, algorithm, response, qop". It apparently doesn't use "opaque", so that's been left where it already was.

Definition at line 169 of file digest.c.

References AuthRealm_t::algorithm, ALGORITHM2STR, ALGORITHMNOTSET, AuthRealm_t::cnonce, Digest_create_response(), Digest_Dstr_append_token_value(), dStr_free(), dStr_new(), dStr_sprintfa(), AuthRealm_t::name, AuthRealm_t::nonce, AuthRealm_t::nonce_count, AuthRealm_t::opaque, AuthRealm_t::qop, QOP2STR, QOPNOTSET, Dstr::str, URL_DATA, URL_FLAGS, URL_Post, and AuthRealm_t::username.

Referenced by a_Auth_get_auth_str().

◆ a_Digest_compute_digest()

int a_Digest_compute_digest ( AuthRealm_t realm,
const char *  username,
const char *  passwd 
)

◆ a_Digest_create_cnonce()

char * a_Digest_create_cnonce ( void  )

Returns a pointer to a newly allocated string containing a cnonce.

Definition at line 41 of file digest.c.

References dNew, and hexchars.

Referenced by Auth_do_auth_dialog_cb().

◆ Digest_create_response()

static Dstr * Digest_create_response ( AuthRealm_t realm,
const char *  method,
const char *  digest_uri,
const Dstr entity_body 
)
static

◆ Digest_Dstr_append_token_value()

static void Digest_Dstr_append_token_value ( Dstr str,
int  delimiter,
const char *  token,
const char *  value,
int  quoted 
)
static

Definition at line 142 of file digest.c.

References dStr_append(), dStr_append_c(), and dStr_sprintfa().

Referenced by a_Digest_authorization_hdr().

◆ md5hexdigest()

static Dstr * md5hexdigest ( const Dstr data)
static

Variable Documentation

◆ ALGORITHM2STR

const char* ALGORITHM2STR[] = { NULL, "MD5", "MD5-sess" }
static

Definition at line 18 of file digest.c.

Referenced by a_Digest_authorization_hdr().

◆ hexchars

const char hexchars[] = "0123456789abcdef"
static

Definition at line 20 of file digest.c.

Referenced by a_Digest_create_cnonce().

◆ QOP2STR

const char* QOP2STR[] = { NULL, "auth", "auth-int" }
static

Definition at line 19 of file digest.c.

Referenced by a_Digest_authorization_hdr(), and Digest_create_response().