Skip to content

Commit

Permalink
pkeyutl: Fix regression with -kdflen option
Browse files Browse the repository at this point in the history
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #17461)

(cherry picked from commit b82fd89)
  • Loading branch information
t8m authored and paulidale committed Jan 12, 2022
1 parent b64b8e3 commit 3755dc2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions apps/pkeyutl.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,23 +464,23 @@ int pkeyutl_main(int argc, char **argv)
}
goto end;
}
if (kdflen != 0) {
buf_outlen = kdflen;
rv = 1;
if (rawin) {
/* rawin allocates the buffer in do_raw_keyop() */
rv = do_raw_keyop(pkey_op, mctx, pkey, in, filesize, NULL, 0,
&buf_out, (size_t *)&buf_outlen);
} else {
if (rawin) {
/* rawin allocates the buffer in do_raw_keyop() */
rv = do_raw_keyop(pkey_op, mctx, pkey, in, filesize, NULL, 0,
&buf_out, (size_t *)&buf_outlen);
if (kdflen != 0) {
buf_outlen = kdflen;
rv = 1;
} else {
rv = do_keyop(ctx, pkey_op, NULL, (size_t *)&buf_outlen,
buf_in, (size_t)buf_inlen);
if (rv > 0 && buf_outlen != 0) {
buf_out = app_malloc(buf_outlen, "buffer output");
rv = do_keyop(ctx, pkey_op,
buf_out, (size_t *)&buf_outlen,
buf_in, (size_t)buf_inlen);
}
}
if (rv > 0 && buf_outlen != 0) {
buf_out = app_malloc(buf_outlen, "buffer output");
rv = do_keyop(ctx, pkey_op,
buf_out, (size_t *)&buf_outlen,
buf_in, (size_t)buf_inlen);
}
}
if (rv <= 0) {
Expand Down

0 comments on commit 3755dc2

Please sign in to comment.