mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
UPSTREAM: crypto: x86/poly1305 - unify Poly1305 state struct with generic code
In preparation of exposing a Poly1305 library interface directly from the accelerated x86 driver, align the state descriptor of the x86 code with the one used by the generic driver. This is needed to make the library interface unified between all implementations. Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]> (cherry picked from commit ad8f5b88383ea685f2b8df2a12ee3e08089a1287) Bug: 152722841 Signed-off-by: Jason A. Donenfeld <[email protected]> Change-Id: I235100cceaa2b45f8c4a394a23fffec13482a0c5 Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
cc6aec0f93
commit
26781dba9f
4 changed files with 43 additions and 73 deletions
|
|
@ -46,10 +46,10 @@ unsigned int crypto_poly1305_setdesckey(struct poly1305_desc_ctx *dctx,
|
|||
{
|
||||
if (!dctx->sset) {
|
||||
if (!dctx->rset && srclen >= POLY1305_BLOCK_SIZE) {
|
||||
poly1305_core_setkey(&dctx->r, src);
|
||||
poly1305_core_setkey(dctx->r, src);
|
||||
src += POLY1305_BLOCK_SIZE;
|
||||
srclen -= POLY1305_BLOCK_SIZE;
|
||||
dctx->rset = true;
|
||||
dctx->rset = 1;
|
||||
}
|
||||
if (srclen >= POLY1305_BLOCK_SIZE) {
|
||||
dctx->s[0] = get_unaligned_le32(src + 0);
|
||||
|
|
|
|||
|
|
@ -22,20 +22,20 @@ struct poly1305_state {
|
|||
};
|
||||
|
||||
struct poly1305_desc_ctx {
|
||||
/* key */
|
||||
struct poly1305_key r;
|
||||
/* finalize key */
|
||||
u32 s[4];
|
||||
/* accumulator */
|
||||
struct poly1305_state h;
|
||||
/* partial buffer */
|
||||
u8 buf[POLY1305_BLOCK_SIZE];
|
||||
/* bytes used in partial buffer */
|
||||
unsigned int buflen;
|
||||
/* r key has been set */
|
||||
bool rset;
|
||||
/* s key has been set */
|
||||
/* how many keys have been set in r[] */
|
||||
unsigned short rset;
|
||||
/* whether s[] has been set */
|
||||
bool sset;
|
||||
/* finalize key */
|
||||
u32 s[4];
|
||||
/* accumulator */
|
||||
struct poly1305_state h;
|
||||
/* key */
|
||||
struct poly1305_key r[1];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue