projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
forcedeth: statistics supported
[powerpc.git]
/
crypto
/
sha512.c
diff --git
a/crypto/sha512.c
b/crypto/sha512.c
index
3e6e939
..
15eab9d
100644
(file)
--- a/
crypto/sha512.c
+++ b/
crypto/sha512.c
@@
-24,7
+24,7
@@
#define SHA384_DIGEST_SIZE 48
#define SHA512_DIGEST_SIZE 64
#define SHA384_DIGEST_SIZE 48
#define SHA512_DIGEST_SIZE 64
-#define SHA384_HMAC_BLOCK_SIZE
96
+#define SHA384_HMAC_BLOCK_SIZE
128
#define SHA512_HMAC_BLOCK_SIZE 128
struct sha512_ctx {
#define SHA512_HMAC_BLOCK_SIZE 128
struct sha512_ctx {
@@
-161,9
+161,9
@@
sha512_transform(u64 *state, u64 *W, const u8 *input)
}
static void
}
static void
-sha512_init(
void *ctx
)
+sha512_init(
struct crypto_tfm *tfm
)
{
{
-
struct sha512_ctx *sctx = ctx
;
+
struct sha512_ctx *sctx = crypto_tfm_ctx(tfm)
;
sctx->state[0] = H0;
sctx->state[1] = H1;
sctx->state[2] = H2;
sctx->state[0] = H0;
sctx->state[1] = H1;
sctx->state[2] = H2;
@@
-173,13
+173,12
@@
sha512_init(void *ctx)
sctx->state[6] = H6;
sctx->state[7] = H7;
sctx->count[0] = sctx->count[1] = sctx->count[2] = sctx->count[3] = 0;
sctx->state[6] = H6;
sctx->state[7] = H7;
sctx->count[0] = sctx->count[1] = sctx->count[2] = sctx->count[3] = 0;
- memset(sctx->buf, 0, sizeof(sctx->buf));
}
static void
}
static void
-sha384_init(
void *ctx
)
+sha384_init(
struct crypto_tfm *tfm
)
{
{
-
struct sha512_ctx *sctx = ctx
;
+
struct sha512_ctx *sctx = crypto_tfm_ctx(tfm)
;
sctx->state[0] = HP0;
sctx->state[1] = HP1;
sctx->state[2] = HP2;
sctx->state[0] = HP0;
sctx->state[1] = HP1;
sctx->state[2] = HP2;
@@
-189,13
+188,12
@@
sha384_init(void *ctx)
sctx->state[6] = HP6;
sctx->state[7] = HP7;
sctx->count[0] = sctx->count[1] = sctx->count[2] = sctx->count[3] = 0;
sctx->state[6] = HP6;
sctx->state[7] = HP7;
sctx->count[0] = sctx->count[1] = sctx->count[2] = sctx->count[3] = 0;
- memset(sctx->buf, 0, sizeof(sctx->buf));
}
static void
}
static void
-sha512_update(
void *ctx
, const u8 *data, unsigned int len)
+sha512_update(
struct crypto_tfm *tfm
, const u8 *data, unsigned int len)
{
{
-
struct sha512_ctx *sctx = ctx
;
+
struct sha512_ctx *sctx = crypto_tfm_ctx(tfm)
;
unsigned int i, index, part_len;
unsigned int i, index, part_len;
@@
-233,9
+231,9
@@
sha512_update(void *ctx, const u8 *data, unsigned int len)
}
static void
}
static void
-sha512_final(
void *ctx
, u8 *hash)
+sha512_final(
struct crypto_tfm *tfm
, u8 *hash)
{
{
-
struct sha512_ctx *sctx = ctx
;
+
struct sha512_ctx *sctx = crypto_tfm_ctx(tfm)
;
static u8 padding[128] = { 0x80, };
__be64 *dst = (__be64 *)hash;
__be32 bits[4];
static u8 padding[128] = { 0x80, };
__be64 *dst = (__be64 *)hash;
__be32 bits[4];
@@
-251,10
+249,10
@@
sha512_final(void *ctx, u8 *hash)
/* Pad out to 112 mod 128. */
index = (sctx->count[0] >> 3) & 0x7f;
pad_len = (index < 112) ? (112 - index) : ((128+112) - index);
/* Pad out to 112 mod 128. */
index = (sctx->count[0] >> 3) & 0x7f;
pad_len = (index < 112) ? (112 - index) : ((128+112) - index);
- sha512_update(
sctx
, padding, pad_len);
+ sha512_update(
tfm
, padding, pad_len);
/* Append length (before padding) */
/* Append length (before padding) */
- sha512_update(
sctx
, (const u8 *)bits, sizeof(bits));
+ sha512_update(
tfm
, (const u8 *)bits, sizeof(bits));
/* Store state in digest */
for (i = 0; i < 8; i++)
/* Store state in digest */
for (i = 0; i < 8; i++)
@@
-264,12
+262,11
@@
sha512_final(void *ctx, u8 *hash)
memset(sctx, 0, sizeof(struct sha512_ctx));
}
memset(sctx, 0, sizeof(struct sha512_ctx));
}
-static void sha384_final(
void *ctx
, u8 *hash)
+static void sha384_final(
struct crypto_tfm *tfm
, u8 *hash)
{
{
- struct sha512_ctx *sctx = ctx;
u8 D[64];
u8 D[64];
-
sha512_final(sctx
, D);
+
sha512_final(tfm
, D);
memcpy(hash, D, 48);
memset(D, 0, 64);
memcpy(hash, D, 48);
memset(D, 0, 64);
@@
-281,6
+278,7
@@
static struct crypto_alg sha512 = {
.cra_blocksize = SHA512_HMAC_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct sha512_ctx),
.cra_module = THIS_MODULE,
.cra_blocksize = SHA512_HMAC_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct sha512_ctx),
.cra_module = THIS_MODULE,
+ .cra_alignmask = 3,
.cra_list = LIST_HEAD_INIT(sha512.cra_list),
.cra_u = { .digest = {
.dia_digestsize = SHA512_DIGEST_SIZE,
.cra_list = LIST_HEAD_INIT(sha512.cra_list),
.cra_u = { .digest = {
.dia_digestsize = SHA512_DIGEST_SIZE,
@@
-295,6
+293,7
@@
static struct crypto_alg sha384 = {
.cra_flags = CRYPTO_ALG_TYPE_DIGEST,
.cra_blocksize = SHA384_HMAC_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct sha512_ctx),
.cra_flags = CRYPTO_ALG_TYPE_DIGEST,
.cra_blocksize = SHA384_HMAC_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct sha512_ctx),
+ .cra_alignmask = 3,
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(sha384.cra_list),
.cra_u = { .digest = {
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(sha384.cra_list),
.cra_u = { .digest = {