38#define MD5_BLOCK_LEN 64
39#define MD5_DIGEST_LEN 16
47static void hmac_md5(
const char *password,
char *challenge,
unsigned char *response)
49 struct Md5Ctx md5ctx = { 0 };
54 size_t secret_len = strlen(password);
70 memcpy(ipad, secret, secret_len);
71 memcpy(opad, secret, secret_len);
97 char ibuf[2048], obuf[1024];
154 int off = snprintf(obuf,
sizeof(obuf),
"%s ", adata->
conn->
account.
user);
180 mutt_error(
_(
"%s authentication failed"),
"CRAM-MD5");
IMAP authenticator multiplexor.
ImapAuthRes
Results of IMAP Authentication.
@ IMAP_AUTH_FAILURE
Authentication failed.
@ IMAP_AUTH_SUCCESS
Authentication successful.
@ IMAP_AUTH_UNAVAIL
Authentication method not permitted.
static void hmac_md5(const char *password, char *challenge, unsigned char *response)
Produce CRAM-MD5 challenge response.
size_t mutt_b64_encode(const char *in, size_t inlen, char *out, size_t outlen)
Convert raw bytes to null-terminated base64 string.
int mutt_b64_decode(const char *in, char *out, size_t olen)
Convert null-terminated base64 string to raw bytes.
int mutt_account_getpass(struct ConnAccount *cac)
Fetch password into ConnAccount, if necessary.
int mutt_account_getlogin(struct ConnAccount *cac)
Retrieve login info into ConnAccount, if necessary.
enum ImapAuthRes imap_auth_cram_md5(struct ImapAccountData *adata, const char *method)
Authenticate using CRAM-MD5 - Implements ImapAuth::authenticate() -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
int imap_cmd_start(struct ImapAccountData *adata, const char *cmdstr)
Given an IMAP command, send it to the server.
int imap_cmd_step(struct ImapAccountData *adata)
Reads server responses from an IMAP command.
bool imap_code(const char *s)
Was the command successful.
#define IMAP_CAP_AUTH_CRAM_MD5
RFC2195: CRAM-MD5 authentication.
#define IMAP_RES_RESPOND
+
#define IMAP_RES_OK
<tag> OK ...
#define IMAP_RES_CONTINUE
* ...
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
void mutt_md5_process_bytes(const void *buf, size_t buflen, struct Md5Ctx *md5ctx)
Process a block of data.
void * mutt_md5_bytes(const void *buffer, size_t len, void *resbuf)
Calculate the MD5 hash of a buffer.
void mutt_md5_process(const char *str, struct Md5Ctx *md5ctx)
Process a NULL-terminated string.
void mutt_md5_init_ctx(struct Md5Ctx *md5ctx)
Initialise the MD5 computation.
void * mutt_md5_finish_ctx(struct Md5Ctx *md5ctx, void *resbuf)
Process the remaining bytes in the buffer.
void mutt_md5_toascii(const void *digest, char *resbuf)
Convert a binary MD5 digest into ASCII Hexadecimal.
Convenience wrapper for the library headers.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
char * mutt_str_cat(char *buf, size_t buflen, const char *s)
Concatenate two strings.
Pop-specific Account data.
#define mutt_socket_send(conn, buf)
struct ConnAccount account
Account details: username, password, etc.
IMAP-specific Account data -.
ImapCapFlags capabilities
Capability flags.
struct Connection * conn
Connection to IMAP server.
Cursor for the MD5 hashing.