diff options
Diffstat (limited to 'crypto/wp512.c')
-rw-r--r-- | crypto/wp512.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/crypto/wp512.c b/crypto/wp512.c index b226a126cfae..727d05a19ff4 100644 --- a/crypto/wp512.c +++ b/crypto/wp512.c | |||
@@ -981,9 +981,9 @@ static void wp512_process_buffer(struct wp512_ctx *wctx) { | |||
981 | 981 | ||
982 | } | 982 | } |
983 | 983 | ||
984 | static void wp512_init (void *ctx) { | 984 | static void wp512_init(struct crypto_tfm *tfm) { |
985 | struct wp512_ctx *wctx = crypto_tfm_ctx(tfm); | ||
985 | int i; | 986 | int i; |
986 | struct wp512_ctx *wctx = ctx; | ||
987 | 987 | ||
988 | memset(wctx->bitLength, 0, 32); | 988 | memset(wctx->bitLength, 0, 32); |
989 | wctx->bufferBits = wctx->bufferPos = 0; | 989 | wctx->bufferBits = wctx->bufferPos = 0; |
@@ -993,10 +993,10 @@ static void wp512_init (void *ctx) { | |||
993 | } | 993 | } |
994 | } | 994 | } |
995 | 995 | ||
996 | static void wp512_update(void *ctx, const u8 *source, unsigned int len) | 996 | static void wp512_update(struct crypto_tfm *tfm, const u8 *source, |
997 | unsigned int len) | ||
997 | { | 998 | { |
998 | 999 | struct wp512_ctx *wctx = crypto_tfm_ctx(tfm); | |
999 | struct wp512_ctx *wctx = ctx; | ||
1000 | int sourcePos = 0; | 1000 | int sourcePos = 0; |
1001 | unsigned int bits_len = len * 8; // convert to number of bits | 1001 | unsigned int bits_len = len * 8; // convert to number of bits |
1002 | int sourceGap = (8 - ((int)bits_len & 7)) & 7; | 1002 | int sourceGap = (8 - ((int)bits_len & 7)) & 7; |
@@ -1054,9 +1054,9 @@ static void wp512_update(void *ctx, const u8 *source, unsigned int len) | |||
1054 | 1054 | ||
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | static void wp512_final(void *ctx, u8 *out) | 1057 | static void wp512_final(struct crypto_tfm *tfm, u8 *out) |
1058 | { | 1058 | { |
1059 | struct wp512_ctx *wctx = ctx; | 1059 | struct wp512_ctx *wctx = crypto_tfm_ctx(tfm); |
1060 | int i; | 1060 | int i; |
1061 | u8 *buffer = wctx->buffer; | 1061 | u8 *buffer = wctx->buffer; |
1062 | u8 *bitLength = wctx->bitLength; | 1062 | u8 *bitLength = wctx->bitLength; |
@@ -1087,22 +1087,20 @@ static void wp512_final(void *ctx, u8 *out) | |||
1087 | wctx->bufferPos = bufferPos; | 1087 | wctx->bufferPos = bufferPos; |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | static void wp384_final(void *ctx, u8 *out) | 1090 | static void wp384_final(struct crypto_tfm *tfm, u8 *out) |
1091 | { | 1091 | { |
1092 | struct wp512_ctx *wctx = ctx; | ||
1093 | u8 D[64]; | 1092 | u8 D[64]; |
1094 | 1093 | ||
1095 | wp512_final (wctx, D); | 1094 | wp512_final(tfm, D); |
1096 | memcpy (out, D, WP384_DIGEST_SIZE); | 1095 | memcpy (out, D, WP384_DIGEST_SIZE); |
1097 | memset (D, 0, WP512_DIGEST_SIZE); | 1096 | memset (D, 0, WP512_DIGEST_SIZE); |
1098 | } | 1097 | } |
1099 | 1098 | ||
1100 | static void wp256_final(void *ctx, u8 *out) | 1099 | static void wp256_final(struct crypto_tfm *tfm, u8 *out) |
1101 | { | 1100 | { |
1102 | struct wp512_ctx *wctx = ctx; | ||
1103 | u8 D[64]; | 1101 | u8 D[64]; |
1104 | 1102 | ||
1105 | wp512_final (wctx, D); | 1103 | wp512_final(tfm, D); |
1106 | memcpy (out, D, WP256_DIGEST_SIZE); | 1104 | memcpy (out, D, WP256_DIGEST_SIZE); |
1107 | memset (D, 0, WP512_DIGEST_SIZE); | 1105 | memset (D, 0, WP512_DIGEST_SIZE); |
1108 | } | 1106 | } |