Strophe 0.12
XMPP client library
Data Structures | Macros | Functions | Variables
scram.c File Reference

SCRAM-SHA1 helper functions. More...

Data Structures

union  common_hash_ctx
 

Macros

#define HMAC_BLOCK_SIZE_MAX   128
 

Functions

static void crypto_HMAC (const struct hash_alg *alg, const uint8_t *key, size_t key_len, const uint8_t *text, size_t len, uint8_t *digest)
 
static void SCRAM_Hi (const struct hash_alg *alg, const uint8_t *text, size_t len, const uint8_t *salt, size_t salt_len, uint32_t i, uint8_t *digest)
 
void SCRAM_ClientKey (const struct hash_alg *alg, const uint8_t *password, size_t len, const uint8_t *salt, size_t salt_len, uint32_t i, uint8_t *key)
 
void SCRAM_ClientSignature (const struct hash_alg *alg, const uint8_t *ClientKey, const uint8_t *AuthMessage, size_t len, uint8_t *sign)
 
void SCRAM_ClientProof (const struct hash_alg *alg, const uint8_t *ClientKey, const uint8_t *ClientSignature, uint8_t *proof)
 

Variables

static const uint8_t ipad = 0x36
 
static const uint8_t opad = 0x5C
 
const struct hash_alg scram_sha1
 
const struct hash_alg scram_sha256
 
const struct hash_alg scram_sha512
 

Detailed Description

SCRAM-SHA1 helper functions.

Macro Definition Documentation

◆ HMAC_BLOCK_SIZE_MAX

#define HMAC_BLOCK_SIZE_MAX   128

Function Documentation

◆ crypto_HMAC()

static void crypto_HMAC ( const struct hash_alg alg,
const uint8_t *  key,
size_t  key_len,
const uint8_t *  text,
size_t  len,
uint8_t *  digest 
)
static

◆ SCRAM_Hi()

static void SCRAM_Hi ( const struct hash_alg alg,
const uint8_t *  text,
size_t  len,
const uint8_t *  salt,
size_t  salt_len,
uint32_t  i,
uint8_t *  digest 
)
static

◆ SCRAM_ClientKey()

void SCRAM_ClientKey ( const struct hash_alg alg,
const uint8_t *  password,
size_t  len,
const uint8_t *  salt,
size_t  salt_len,
uint32_t  i,
uint8_t *  key 
)

◆ SCRAM_ClientSignature()

void SCRAM_ClientSignature ( const struct hash_alg alg,
const uint8_t *  ClientKey,
const uint8_t *  AuthMessage,
size_t  len,
uint8_t *  sign 
)

◆ SCRAM_ClientProof()

void SCRAM_ClientProof ( const struct hash_alg alg,
const uint8_t *  ClientKey,
const uint8_t *  ClientSignature,
uint8_t *  proof 
)

Variable Documentation

◆ ipad

const uint8_t ipad = 0x36
static

◆ opad

const uint8_t opad = 0x5C
static

◆ scram_sha1

const struct hash_alg scram_sha1
Initial value:
= {
"SCRAM-SHA-1",
(void (*)(const uint8_t *, size_t, uint8_t *))crypto_SHA1,
(void (*)(void *))crypto_SHA1_Init,
(void (*)(void *, const uint8_t *, size_t))crypto_SHA1_Update,
(void (*)(void *, uint8_t *))crypto_SHA1_Final}
#define SASL_MASK_SCRAMSHA1
Definition: common.h:158
void crypto_SHA1_Update(SHA1_CTX *context, const uint8_t *data, size_t len)
Definition: sha1.c:209
void crypto_SHA1_Final(SHA1_CTX *context, uint8_t *digest)
Definition: sha1.c:230
void crypto_SHA1(const uint8_t *data, size_t len, uint8_t *digest)
Definition: sha1.c:260
void crypto_SHA1_Init(SHA1_CTX *context)
Definition: sha1.c:197
#define SHA1_DIGEST_SIZE
Definition: sha1.h:24

◆ scram_sha256

const struct hash_alg scram_sha256
Initial value:
= {
"SCRAM-SHA-256",
(void (*)(const uint8_t *, size_t, uint8_t *))sha256_hash,
(void (*)(void *))sha256_init,
(void (*)(void *, const uint8_t *, size_t))sha256_process,
(void (*)(void *, uint8_t *))sha256_done}
#define SASL_MASK_SCRAMSHA256
Definition: common.h:159
void sha256_done(sha256_context *md, uint8_t *out)
Definition: sha256.c:163
void sha256_init(sha256_context *md)
Definition: sha256.c:118
void sha256_process(sha256_context *md, const uint8_t *in, size_t inlen)
Definition: sha256.c:132
void sha256_hash(const uint8_t *data, size_t len, uint8_t *digest)
Definition: sha256.c:204
#define SHA256_DIGEST_SIZE
Definition: sha256.h:23

◆ scram_sha512

const struct hash_alg scram_sha512
Initial value:
= {
"SCRAM-SHA-512",
(void (*)(const uint8_t *, size_t, uint8_t *))sha512_hash,
(void (*)(void *))sha512_init,
(void (*)(void *, const uint8_t *, size_t))sha512_process,
(void (*)(void *, uint8_t *))sha512_done}
#define SASL_MASK_SCRAMSHA512
Definition: common.h:160
void sha512_hash(const uint8_t *data, size_t len, uint8_t *digest)
Definition: sha512.c:195
void sha512_process(sha512_context *md, const uint8_t *in, size_t inlen)
Definition: sha512.c:120
void sha512_init(sha512_context *md)
Definition: sha512.c:106
void sha512_done(sha512_context *md, uint8_t *out)
Definition: sha512.c:151
#define SHA512_DIGEST_SIZE
Definition: sha512.h:23