From: Milan Broz <gmazyland@gmail.com>
To: ".. ink .." <mhogomchungu@gmail.com>,
"dm-crypt@saout.de" <dm-crypt@saout.de>
Subject: Re: [dm-crypt] unsafe??? use of memset
Date: Tue, 30 Dec 2014 15:26:02 +0100 [thread overview]
Message-ID: <54A2B5FA.7040606@gmail.com> (raw)
In-Reply-To: <CAFnMBaQZp63DCZB9f9K1tPia237OGWjVQ6c2oYM7VNSDWqk_Vw@mail.gmail.com>
On 12/30/2014 02:57 PM, .. ink .. wrote:
>
> a lot of people like this one[2] advises against the use of memset to clear memory but crypsetup seems to
> ignore this advice and use memset a lot like in[1].
>
> Any reason why cryptseup is ignoring this advice?
Why ignore? It worked with old compilers (and VC is not the issue here).
This is opensource, so I usually respond with "send a patch" to these messages...
But actually I have patch for that for weeks. I have just another issues which have
unfortunately much higher priority in my life and I am not going commit half-baked patch.
FYI:
I fixed it is kernel dmcrypt, there we can use memzero_explicit()
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/md/dm-crypt.c?id=1a71d6ffe18c0d0f03fc8531949cc8ed41d702ee
Cryptsetup will follow (hopefully soon with other fixes).
And it is nothing critical.
There is a nice description of problem
https://cryptocoding.net/index.php/Coding_rules#Prevent_compiler_interference_with_security-critical_operations
Actually I want to replace zero memset with zero it with code used in BLAKE2.
It is simple and should work.
static inline void secure_zero_memory(void *v, size_t n)
{
volatile uint8_t *p = (volatile uint8_t *)v;
while(n--) *p++ = 0;
}
Milan
>
> [1] https://code.google.com/p/cryptsetup/source/browse/lib/tcrypt/tcrypt.c#272
> [2] http://edc.tversu.ru/elib/inf/0088/0596003943_secureprgckbk-chp-13-sect-2.html
next prev parent reply other threads:[~2014-12-30 14:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-30 13:57 [dm-crypt] unsafe??? use of memset .. ink ..
2014-12-30 14:26 ` Milan Broz [this message]
2014-12-30 16:47 ` Arno Wagner
2014-12-30 16:38 ` Arno Wagner
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=54A2B5FA.7040606@gmail.com \
--to=gmazyland@gmail.com \
--cc=dm-crypt@saout.de \
--cc=mhogomchungu@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.