|
@@ -251,6 +251,7 @@ static int skcipher_sendmsg(struct kiocb *unused, struct socket *sock,
|
|
struct af_alg_control con = {};
|
|
struct af_alg_control con = {};
|
|
long copied = 0;
|
|
long copied = 0;
|
|
bool enc = 0;
|
|
bool enc = 0;
|
|
|
|
+ bool init = 0;
|
|
int err;
|
|
int err;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
@@ -259,6 +260,7 @@ static int skcipher_sendmsg(struct kiocb *unused, struct socket *sock,
|
|
if (err)
|
|
if (err)
|
|
return err;
|
|
return err;
|
|
|
|
|
|
|
|
+ init = 1;
|
|
switch (con.op) {
|
|
switch (con.op) {
|
|
case ALG_OP_ENCRYPT:
|
|
case ALG_OP_ENCRYPT:
|
|
enc = 1;
|
|
enc = 1;
|
|
@@ -280,7 +282,7 @@ static int skcipher_sendmsg(struct kiocb *unused, struct socket *sock,
|
|
if (!ctx->more && ctx->used)
|
|
if (!ctx->more && ctx->used)
|
|
goto unlock;
|
|
goto unlock;
|
|
|
|
|
|
- if (!ctx->used) {
|
|
|
|
|
|
+ if (init) {
|
|
ctx->enc = enc;
|
|
ctx->enc = enc;
|
|
if (con.iv)
|
|
if (con.iv)
|
|
memcpy(ctx->iv, con.iv->iv, ivsize);
|
|
memcpy(ctx->iv, con.iv->iv, ivsize);
|