37 #define DEFAULT_CHARSET "utf-8"
38 #define DEFAULT_ALGORITHM "md5-sess"
53 static const char *
const digest_challenge_opts[] = {
75 static const char *
const qop_opts[] = {
98 static const char *
const cipher_opts[] = {
112 int done_algorithm = 0;
113 int disable_qop_auth_conf = 0;
116 memset (out, 0,
sizeof (*out));
119 if (strlen (challenge) >= 2048)
122 while (*challenge !=
'\0')
145 out->
nonce = strdup (value);
160 while (*subsubopts !=
'\0')
182 if (disable_qop_auth_conf)
247 while (*subsubopts !=
'\0')
283 disable_qop_auth_conf = 1;
330 static const char *
const digest_response_opts[] = {
352 memset (out, 0,
sizeof (*out));
355 if (strlen (response) >= 4096)
358 while (*response !=
'\0')
378 out->
realm = strdup (value);
388 out->
nonce = strdup (value);
398 out->
cnonce = strdup (value);
409 if (strlen (value) != 8)
411 out->
nc = strtoul (value, NULL, 16);
420 if (strcmp (value,
"auth") == 0)
422 else if (strcmp (value,
"auth-int") == 0)
424 else if (strcmp (value,
"auth-conf") == 0)
477 if (strcmp (value,
"3des") == 0)
479 else if (strcmp (value,
"des") == 0)
481 else if (strcmp (value,
"rc4-40") == 0)
483 else if (strcmp (value,
"rc4") == 0)
485 else if (strcmp (value,
"rc4-56") == 0)
487 else if (strcmp (value,
"aes-cbc") == 0)
525 static const char *
const digest_responseauth_opts[] = {
536 memset (out, 0,
sizeof (*out));
539 if (strlen (finish) >= 2048)
542 while (*finish !=
'\0')
570 char *subopts = len ? strndup (challenge, len) : strdup (challenge);
576 rc = parse_challenge (subopts, out);
587 char *subopts = len ? strndup (response, len) : strdup (response);
593 rc = parse_response (subopts, out);
604 char *subopts = len ? strndup (finish, len) : strdup (finish);
610 rc = parse_finish (subopts, out);
int digest_md5_parse_challenge(const char *challenge, size_t len, digest_md5_challenge *out)
int digest_md5_parse_response(const char *response, size_t len, digest_md5_response *out)
#define DEFAULT_ALGORITHM
int digest_md5_parse_finish(const char *finish, size_t len, digest_md5_finish *out)
@ DIGEST_MD5_QOP_AUTH_INT
@ DIGEST_MD5_QOP_AUTH_CONF
@ DIGEST_MD5_CIPHER_RC4_56
@ DIGEST_MD5_CIPHER_AES_CBC
@ DIGEST_MD5_CIPHER_RC4_40
#define DIGEST_MD5_RESPONSE_LENGTH
int digest_md5_validate_challenge(digest_md5_challenge *c)
int digest_md5_validate_response(digest_md5_response *r)
int digest_md5_validate_finish(digest_md5_finish *f)
int digest_md5_getsubopt(char **optionp, const char *const *tokens, char **valuep)
unsigned long servermaxbuf
char rspauth[DIGEST_MD5_RESPONSE_LENGTH+1]
char response[DIGEST_MD5_RESPONSE_LENGTH+1]
unsigned long clientmaxbuf