in reply to Can I do secure memory management in Perl scripts for cryptographic applications?

mmap might do most of what you want, if you're very careful. It will create a scalar tied to a specific region of memory allocated by the OS. If you are very careful with how you access it (see the docs), it will stay in that region. If OS permissions permit, you might be able to write a small module in XS or Inline::C which would use mlock to prevent the pages from being swapped out.

The biggest problem with all this is that it's very hard to tell if everything's working like it's supposed to. How do you write a test to make sure your data hasn't been exposed to the possibility of being written to swap?

  • Comment on Re: Can I do secure memory management in Perl scripts for cryptographic applications?