From: Kees Cook <keescook@chromium.org>
To: Joao Moreira <jmoreira@suse.de>
Cc: Kernel Hardening <kernel-hardening@lists.openwall.com>,
LKML <linux-kernel@vger.kernel.org>, X86 ML <x86@kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [RFC PATCH v2 3/4] Fix twofish crypto functions prototype casts
Date: Mon, 6 May 2019 15:19:55 -0700 [thread overview]
Message-ID: <CAGXu5jKt9NuGeHumTkO2aD1MoBdP-OwRTXu1_qq0r8_t=Y6sMw@mail.gmail.com> (raw)
In-Reply-To: <20190506191950.9521-4-jmoreira@suse.de>
On Mon, May 6, 2019 at 12:20 PM Joao Moreira <jmoreira@suse.de> wrote:
> RFC: twofish_enc_blk_ctr_3way is assigned both to .ecb and to .ctr,
> what makes its declaration through the macro undoable, as thought in
> this patch. Suggestions on how to fix this are welcome.
This looks like a typo in the original code (due to the lack of type checking!)
typedef void (*common_glue_func_t)(void *ctx, u8 *dst, const u8 *src);
...
#define GLUE_FUNC_CAST(fn) ((common_glue_func_t)(fn))
...
void twofish_enc_blk_ctr_3way(void *ctx, u128 *dst, const u128 *src,
le128 *iv)
static const struct common_glue_ctx twofish_ctr = {
...
.fn_u = { .ecb = GLUE_FUNC_CAST(twofish_enc_blk_ctr_3way) }
...
return glue_ctr_req_128bit(&twofish_ctr, req);
int glue_ctr_req_128bit(const struct common_glue_ctx *gctx,
struct skcipher_request *req)
...
gctx->funcs[i].fn_u.ctr(ctx, dst, src, &ctrblk);
The twofish_ctr structure is actually only ever using the .ctr
assignment in the code, but it's a union, so the assignment via .ecb
is the same as .ctr.
--
Kees Cook
next prev parent reply other threads:[~2019-05-06 22:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-06 19:19 [RFC PATCH v2 0/4] x86/crypto: Fix crypto function casts Joao Moreira
2019-05-06 19:19 ` [RFC PATCH v2 1/4] Fix serpent crypto functions prototype casts Joao Moreira
2019-05-06 19:19 ` [RFC PATCH v2 2/4] Fix camellia " Joao Moreira
2019-05-06 19:19 ` [RFC PATCH v2 3/4] Fix twofish " Joao Moreira
2019-05-06 22:19 ` Kees Cook [this message]
2019-05-06 19:19 ` [RFC PATCH v2 4/4] Fix cast6 " Joao Moreira
2019-05-06 21:54 ` [RFC PATCH v2 0/4] x86/crypto: Fix crypto function casts Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGXu5jKt9NuGeHumTkO2aD1MoBdP-OwRTXu1_qq0r8_t=Y6sMw@mail.gmail.com' \
--to=keescook@chromium.org \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=jmoreira@suse.de \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®