#include "ekg2-config.h"#include <ekg/win32.h>#include <ekg/debug.h>#include <ekg/recode.h>#include <stdint.h>#include <ekg/stuff.h>#include <ekg/xmalloc.h>#include "jabber.h"#include <stdio.h>#include <string.h>Struktury danych | |
| struct | EKG2_SHA1_CTX |
Definicje | |
| #define | SHA1HANDSOFF |
| #define | SHA1Init(ctx) Init(ctx, 1) |
| #define | SHA1Transform(state, buffer) Transform(state, buffer, 1) |
| #define | SHA1Update(ctx, data, len) Update(ctx, (unsigned char *) data, len, 1) |
| #define | SHA1Final(digest, ctx) Final(digest, ctx, 1) |
| #define | MD5Init(ctx) Init(ctx, 0) |
| #define | MD5Transform(state, buffer) Transform(state, buffer, 0) |
| #define | MD5Update(ctx, data, len) Update(ctx, (unsigned char *) data, len, 0) |
| #define | MD5Final(digest, ctx) Final(digest, ctx, 0) |
| #define | rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) |
| #define | blk0(i) block->l[i] |
| #define | blk(i) |
| #define | R0(v, w, x, y, z, i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); |
| #define | R1(v, w, x, y, z, i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); |
| #define | R2(v, w, x, y, z, i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); |
| #define | R3(v, w, x, y, z, i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); |
| #define | R4(v, w, x, y, z, i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); |
| #define | F(x, y, z) (((x) & (y)) | ((~x) & (z))) |
| #define | G(x, y, z) (((x) & (z)) | ((y) & (~z))) |
| #define | H(x, y, z) ((x) ^ (y) ^ (z)) |
| #define | I(x, y, z) ((y) ^ ((x) | (~z))) |
| #define | FF(a, b, c, d, x, s, ac) { (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); (a) = rol((a), (s)); (a) += (b); } |
| #define | GG(a, b, c, d, x, s, ac) { (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); (a) = rol((a), (s)); (a) += (b); } |
| #define | HH(a, b, c, d, x, s, ac) { (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); (a) = rol((a), (s)); (a) += (b); } |
| #define | II(a, b, c, d, x, s, ac) { (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); (a) = rol((a), (s)); (a) += (b); } |
| #define | S11 7 |
| #define | S12 12 |
| #define | S13 17 |
| #define | S14 22 |
| #define | S21 5 |
| #define | S22 9 |
| #define | S23 14 |
| #define | S24 20 |
| #define | S31 4 |
| #define | S32 11 |
| #define | S33 16 |
| #define | S34 23 |
| #define | S41 6 |
| #define | S42 10 |
| #define | S43 15 |
| #define | S44 21 |
Definicje typów | |
| typedef struct EKG2_SHA1_CTX | EKG2_MD5_CTX |
Funkcje | |
| static void | Init (EKG2_SHA1_CTX *context, int usesha) |
| static void | Transform (uint32_t state[5], unsigned char buffer[64], int usesha) |
| static void | Update (EKG2_SHA1_CTX *context, unsigned char *data, unsigned int len, int usesha) |
| static void | Final (unsigned char digest[20], EKG2_SHA1_CTX *context, int usesha) |
| static void | Encode (unsigned char *output, uint32_t *input, unsigned int len, int usesha) |
| static char * | base16_encode (const unsigned char *data) |
| char * | jabber_challange_digest (const char *sid, const char *password, const char *nonce, const char *cnonce, const char *xmpp_temp, const char *realm) |
| char * | jabber_dcc_digest (char *sid, char *initiator, char *target) |
| char * | jabber_digest (const char *sid, const char *password, int istlen) |
| char * | jabber_sha1_generic (char *buf, int len) |
Zmienne | |
| char * | config_console_charset |
| #define blk | ( | i | ) |
| #define F | ( | x, | ||
| y, | ||||
| z | ||||
| ) | (((x) & (y)) | ((~x) & (z))) |
| #define FF | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| x, | ||||
| s, | ||||
| ac | ||||
| ) | { (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); (a) = rol((a), (s)); (a) += (b); } |
| #define G | ( | x, | ||
| y, | ||||
| z | ||||
| ) | (((x) & (z)) | ((y) & (~z))) |
| #define GG | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| x, | ||||
| s, | ||||
| ac | ||||
| ) | { (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); (a) = rol((a), (s)); (a) += (b); } |
| #define H | ( | x, | ||
| y, | ||||
| z | ||||
| ) | ((x) ^ (y) ^ (z)) |
| #define HH | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| x, | ||||
| s, | ||||
| ac | ||||
| ) | { (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); (a) = rol((a), (s)); (a) += (b); } |
| #define I | ( | x, | ||
| y, | ||||
| z | ||||
| ) | ((y) ^ ((x) | (~z))) |
| #define II | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| x, | ||||
| s, | ||||
| ac | ||||
| ) | { (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); (a) = rol((a), (s)); (a) += (b); } |
| #define MD5Final | ( | digest, | ||
| ctx | ||||
| ) | Final(digest, ctx, 0) |
| #define MD5Init | ( | ctx | ) | Init(ctx, 0) |
| #define MD5Update | ( | ctx, | ||
| data, | ||||
| len | ||||
| ) | Update(ctx, (unsigned char *) data, len, 0) |
| #define rol | ( | value, | ||
| bits | ||||
| ) | (((value) << (bits)) | ((value) >> (32 - (bits)))) |
| #define S11 7 |
| #define S12 12 |
| #define S13 17 |
| #define S14 22 |
| #define S21 5 |
| #define S22 9 |
| #define S23 14 |
| #define S24 20 |
| #define S31 4 |
| #define S32 11 |
| #define S33 16 |
| #define S34 23 |
| #define S41 6 |
| #define S42 10 |
| #define S43 15 |
| #define S44 21 |
| #define SHA1Final | ( | digest, | ||
| ctx | ||||
| ) | Final(digest, ctx, 1) |
| #define SHA1HANDSOFF |
| #define SHA1Init | ( | ctx | ) | Init(ctx, 1) |
| #define SHA1Update | ( | ctx, | ||
| data, | ||||
| len | ||||
| ) | Update(ctx, (unsigned char *) data, len, 1) |
| typedef struct EKG2_SHA1_CTX EKG2_MD5_CTX |
| static char* base16_encode | ( | const unsigned char * | data | ) | [static] |
| static void Encode | ( | unsigned char * | output, | |
| uint32_t * | input, | |||
| unsigned int | len, | |||
| int | usesha | |||
| ) | [static] |
| static void Final | ( | unsigned char | digest[20], | |
| EKG2_SHA1_CTX * | context, | |||
| int | usesha | |||
| ) | [static] |
| static void Init | ( | EKG2_SHA1_CTX * | context, | |
| int | usesha | |||
| ) | [static] |
| char* jabber_challange_digest | ( | const char * | sid, | |
| const char * | password, | |||
| const char * | nonce, | |||
| const char * | cnonce, | |||
| const char * | xmpp_temp, | |||
| const char * | realm | |||
| ) |
Return base16 encoded hash for SASL MD5 CHALLANGE
| char* jabber_dcc_digest | ( | char * | sid, | |
| char * | initiator, | |||
| char * | target | |||
| ) |
[XXX] SOME TIME AGO, I had idea to connect jabber_dcc_digest() and jabber_digest() with one function, and use va_list for it... i don't know. jabber_dcc_digest()
Return SHA1 hash for SOCKS5 Bytestreams connections [DCC]
Make SHA1Update()'s on (uid, initiator and target)
| char* jabber_digest | ( | const char * | sid, | |
| const char * | password, | |||
| int | istlen | |||
| ) |
Return SHA1 hash for jabber:iq:auth
Make SHA1Update()'s on recoded to utf-8 (sid and password)
| char* jabber_sha1_generic | ( | char * | buf, | |
| int | len | |||
| ) |
| static void Transform | ( | uint32_t | state[5], | |
| unsigned char | buffer[64], | |||
| int | usesha | |||
| ) | [static] |
| static void Update | ( | EKG2_SHA1_CTX * | context, | |
| unsigned char * | data, | |||
| unsigned int | len, | |||
| int | usesha | |||
| ) | [static] |
| char* config_console_charset |
1.7.1