This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients benjamin.peterson, christian.heimes, gregory.p.smith, pitrou, vstinner
Date 2013-10-31.22:19:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1383257994.08.0.398391096456.issue17405@psf.upfronthosting.co.za>
In-reply-to
Content
Some comments:

- I don't have small files which just contain one function. Do you expect that we may add other security-related functions? You may add a "pysecurity.c" file. (It's maybe a stupid idea.)

- Why only a few hash functions (sha1, sha3)? We must use the same policy for all hash functions: always force memset() or never use memset().

- Why not touching the ssl module? PySSL_dealloc() and context_dealloc() for example.

- Would it be possible to use a custom memory allocator which would memset() the memory before releasing it for security related objects? If yes, would it be possible to switch it on or off at runtime? It may be interesting if memset() has a visible overhead on performances.

Antoine wrote:

"I think I still don't understand the use case within Python. Why would you want to clear the internal state of a hash object? If you can read the computer's memory, you probably have access to sensitive data already?"

Data are usually duplicated in many places. I'm also dubious that memset() adds any security. If it has no impact on performance, why not using memset() for hash functions and security modules like ssl.

But for example, ssl.RAND_bytes() stores its result in a common bytes object. The bytes type doesn't use a custom memory allocator, and so the secret random bytes will still be present in memory after the bytes object has been "deleted". If you really care of security, you may need a security allocator which reset all memory blocks on free(), not only a few modules.

And what happens when you pass data to a C module which copies the data somewhere. Does it later reset correctly the memory when data becomes useless?

@Christian: Do you have examples of other projects clearing the memory when objects are destroyed?
History
Date User Action Args
2013-10-31 22:19:54vstinnersetrecipients: + vstinner, gregory.p.smith, pitrou, christian.heimes, benjamin.peterson
2013-10-31 22:19:54vstinnersetmessageid: <1383257994.08.0.398391096456.issue17405@psf.upfronthosting.co.za>
2013-10-31 22:19:54vstinnerlinkissue17405 messages
2013-10-31 22:19:53vstinnercreate