iPXE
|
Hyper Text Transfer Protocol (HTTP) Digest authentication. More...
#include <stdio.h>
#include <errno.h>
#include <strings.h>
#include <ipxe/uri.h>
#include <ipxe/md5.h>
#include <ipxe/base16.h>
#include <ipxe/vsprintf.h>
#include <ipxe/http.h>
Go to the source code of this file.
Data Structures | |
struct | http_digest_field |
An HTTP Digest "WWW-Authenticate" response field. More... | |
Macros | |
#define | EACCES_USERNAME __einfo_error ( EINFO_EACCES_USERNAME ) |
#define | EINFO_EACCES_USERNAME |
#define | HTTP_DIGEST_FIELD(_name) |
Define an HTTP Digest "WWW-Authenticate" response field. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | http_digest_field (struct http_transaction *http, struct http_digest_field *field, char *value) |
Set HTTP Digest "WWW-Authenticate" response field value. More... | |
static int | http_parse_digest_auth (struct http_transaction *http, char *line) |
Parse HTTP "WWW-Authenticate" header for Digest authentication. More... | |
static void | http_digest_init (struct md5_context *ctx) |
Initialise HTTP Digest. More... | |
static void | http_digest_update (struct md5_context *ctx, const char *string) |
Update HTTP Digest with new data. More... | |
static void | http_digest_final (struct md5_context *ctx, char *out, size_t len) |
Finalise HTTP Digest. More... | |
static int | http_digest_authenticate (struct http_transaction *http) |
Perform HTTP Digest authentication. More... | |
static int | http_format_digest_auth (struct http_transaction *http, char *buf, size_t len) |
Construct HTTP "Authorization" header for Digest authentication. More... | |
REQUIRING_SYMBOL (http_digest_auth) | |
REQUIRE_OBJECT (httpauth) | |
Variables | |
static struct http_digest_field | http_digest_fields [] |
HTTP Digest "WWW-Authenticate" fields. More... | |
struct http_authentication http_digest_auth | __http_authentication |
HTTP Digest authentication scheme. More... | |
Hyper Text Transfer Protocol (HTTP) Digest authentication.
Definition in file httpdigest.c.
#define EACCES_USERNAME __einfo_error ( EINFO_EACCES_USERNAME ) |
Definition at line 43 of file httpdigest.c.
#define EINFO_EACCES_USERNAME |
Definition at line 44 of file httpdigest.c.
#define HTTP_DIGEST_FIELD | ( | _name | ) |
Define an HTTP Digest "WWW-Authenticate" response field.
Definition at line 57 of file httpdigest.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Set HTTP Digest "WWW-Authenticate" response field value.
http | HTTP transaction |
field | Response field |
value | Field value |
Definition at line 71 of file httpdigest.c.
References http_digest_field::offset, and value.
|
static |
Parse HTTP "WWW-Authenticate" header for Digest authentication.
http | HTTP transaction |
line | Remaining header line |
rc | Return status code |
Definition at line 95 of file httpdigest.c.
References http_request_auth::auth, http_request::auth, http_response::flags, http_digest_fields, HTTP_RESPONSE_RETRY, http_token(), key, http_digest_field::name, http_transaction::request, http_transaction::response, strcasecmp(), and value.
|
static |
Initialise HTTP Digest.
ctx | Digest context |
string | Initial string |
Definition at line 127 of file httpdigest.c.
References ctx, digest_init(), and md5_algorithm.
Referenced by http_digest_authenticate().
|
static |
Update HTTP Digest with new data.
ctx | Digest context |
string | String to append |
Definition at line 139 of file httpdigest.c.
References ctx, digest_update(), md5_algorithm, and strlen().
Referenced by http_digest_authenticate().
|
static |
Finalise HTTP Digest.
ctx | Digest context |
out | Buffer for digest output |
len | Buffer length |
Definition at line 155 of file httpdigest.c.
References ctx, digest_final(), len, md5_algorithm, MD5_DIGEST_SIZE, and out.
Referenced by http_digest_authenticate().
|
static |
Perform HTTP Digest authentication.
http | HTTP transaction |
rc | Return status code |
Definition at line 170 of file httpdigest.c.
References http_request_auth_digest::algorithm, http_request::auth, http_response::auth, base16_encoded_len(), http_request_auth_digest::cnonce, ctx, DBGC, http_request_auth::digest, http_response_auth::digest, EACCES_USERNAME, EINVAL, http_digest_final(), http_digest_init(), HTTP_DIGEST_NC, http_digest_update(), MD5_DIGEST_SIZE, http_request::method, http_method::name, password, uri::password, http_request_auth_digest::qop, random(), http_transaction::request, http_request_auth_digest::response, http_transaction::response, rsp, snprintf(), strcasecmp(), http_request::uri, http_transaction::uri, uri::user, and http_request_auth_digest::username.
|
static |
Construct HTTP "Authorization" header for Digest authentication.
http | HTTP transaction |
buf | Buffer |
len | Length of buffer |
len | Length of header value, or negative error |
Definition at line 262 of file httpdigest.c.
References http_request_auth_digest::algorithm, assert(), http_request::auth, http_response::auth, http_request_auth_digest::cnonce, http_request_auth::digest, http_response_auth::digest, HTTP_DIGEST_NC, len, NULL, http_request_auth_digest::qop, http_transaction::request, http_request_auth_digest::response, http_transaction::response, rsp, ssnprintf(), http_request::uri, and http_request_auth_digest::username.
REQUIRING_SYMBOL | ( | http_digest_auth | ) |
REQUIRE_OBJECT | ( | httpauth | ) |
|
static |
HTTP Digest "WWW-Authenticate" fields.
Definition at line 80 of file httpdigest.c.
Referenced by http_parse_digest_auth().
struct http_authentication http_digest_auth __http_authentication |
HTTP Digest authentication scheme.
Definition at line 300 of file httpdigest.c.