#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include "sysendian.h"
#include "sha256.h"
Go to the source code of this file.
|
#define | Ch(x, y, z) ((x & (y ^ z)) ^ z) |
|
#define | Maj(x, y, z) ((x & (y | z)) | (y & z)) |
|
#define | SHR(x, n) (x >> n) |
|
#define | ROTR(x, n) ((x >> n) | (x << (32 - n))) |
|
#define | S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) |
|
#define | S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) |
|
#define | s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) |
|
#define | s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) |
|
#define | RND(a, b, c, d, e, f, g, h, k) |
|
#define | RNDr(S, W, i, k) |
|
|
void | libscrypt_SHA256_Init (SHA256_CTX *ctx) |
|
void | libscrypt_SHA256_Update (SHA256_CTX *ctx, const void *in, size_t len) |
|
void | libscrypt_SHA256_Final (unsigned char digest[32], SHA256_CTX *ctx) |
|
void | libscrypt_HMAC_SHA256_Init (HMAC_SHA256_CTX *ctx, const void *_K, size_t Klen) |
|
void | libscrypt_HMAC_SHA256_Update (HMAC_SHA256_CTX *ctx, const void *in, size_t len) |
|
void | libscrypt_HMAC_SHA256_Final (unsigned char digest[32], HMAC_SHA256_CTX *ctx) |
|
void | libscrypt_PBKDF2_SHA256 (const uint8_t *passwd, size_t passwdlen, const uint8_t *salt, size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen) |
| PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and write the output to buf. More...
|
|
#define Ch |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| ((x & (y ^ z)) ^ z) |
#define Maj |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| ((x & (y | z)) | (y & z)) |
#define RND |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
e, |
|
|
|
f, |
|
|
|
g, |
|
|
|
h, |
|
|
|
k |
|
) |
| |
#define RNDr |
( |
|
S, |
|
|
|
W, |
|
|
|
i, |
|
|
|
k |
|
) |
| |
Value:RND(
S[(64 - i) % 8],
S[(65 - i) % 8], \
S[(66 - i) % 8],
S[(67 - i) % 8], \
S[(68 - i) % 8],
S[(69 - i) % 8], \
S[(70 - i) % 8],
S[(71 - i) % 8], \
W[i] + k)
#define RND(a, b, c, d, e, f, g, h, k)
Definition at line 80 of file sha256.c.
#define ROTR |
( |
|
x, |
|
|
|
n |
|
) |
| ((x >> n) | (x << (32 - n))) |
#define SHR |
( |
|
x, |
|
|
|
n |
|
) |
| (x >> n) |
void libscrypt_HMAC_SHA256_Final |
( |
unsigned char |
digest[32], |
|
|
HMAC_SHA256_CTX * |
ctx |
|
) |
| |
void libscrypt_HMAC_SHA256_Init |
( |
HMAC_SHA256_CTX * |
ctx, |
|
|
const void * |
_K, |
|
|
size_t |
Klen |
|
) |
| |
void libscrypt_HMAC_SHA256_Update |
( |
HMAC_SHA256_CTX * |
ctx, |
|
|
const void * |
in, |
|
|
size_t |
len |
|
) |
| |
void libscrypt_PBKDF2_SHA256 |
( |
const uint8_t * |
passwd, |
|
|
size_t |
passwdlen, |
|
|
const uint8_t * |
salt, |
|
|
size_t |
saltlen, |
|
|
uint64_t |
c, |
|
|
uint8_t * |
buf, |
|
|
size_t |
dkLen |
|
) |
| |
PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and write the output to buf.
The value dkLen must be at most 32 * (2^32 - 1).
Definition at line 362 of file sha256.c.
void libscrypt_SHA256_Final |
( |
unsigned char |
digest[32], |
|
|
SHA256_CTX * |
ctx |
|
) |
| |
void libscrypt_SHA256_Update |
( |
SHA256_CTX * |
ctx, |
|
|
const void * |
in, |
|
|
size_t |
len |
|
) |
| |