Strophe: scram.c File Reference

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",
SASL_MASK_SCRAMSHA1,
SHA1_DIGEST_SIZE,
(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}
SASL_MASK_SCRAMSHA1
#define SASL_MASK_SCRAMSHA1
Definition common.h:158
crypto_SHA1_Update
void crypto_SHA1_Update(SHA1_CTX *context, const uint8_t *data, size_t len)
Definition sha1.c:209
crypto_SHA1_Final
void crypto_SHA1_Final(SHA1_CTX *context, uint8_t *digest)
Definition sha1.c:230
crypto_SHA1
void crypto_SHA1(const uint8_t *data, size_t len, uint8_t *digest)
Definition sha1.c:260
crypto_SHA1_Init
void crypto_SHA1_Init(SHA1_CTX *context)
Definition sha1.c:197
SHA1_DIGEST_SIZE
#define SHA1_DIGEST_SIZE
Definition sha1.h:24

## ◆ scram_sha256

const struct hash_alg scram_sha256

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

## ◆ scram_sha512

const struct hash_alg scram_sha512

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