Comments (8)
On Fri, Aug 09, 2013 at 12:17:40AM -0700, satvikc wrote:
A high-level design for memory locking is given below. I am just mentioning types for brevity.
Maybe we should try a simpler approach first. I think we should look
at Memory and gadgets together as they are closly related.
Regards
ppk
from raaz.
I have a few questions
- How to malloc with the given alignment? There are functions available in Foreign.ForeignPtr to allocate a ForeignPtr but it says nowhere about alignment.
- How to read data directly from the given handle to the given buffer? We would not want to first read say using ByteString and then store in the given address for security reasons. We would also want the handle to be unbuffered.
There is some code available at
https://github.com/satvikc/raaz/blob/x-memory/raaz-primitives/Raaz/Util/SecureMemory.hs
Right now I am just using list instead of a tree for simplicity. We can change that later once we get this working.
from raaz.
On Mon, Aug 12, 2013 at 09:58:40PM -0700, satvikc wrote:
I have a few questions
- How to malloc with the given alignment? There are functions
available in Foreign.ForeignPtr to allocate a ForeignPtr but it
says nowhere about alignment.
I think the alignment is taken careof by
mallocForeignPtr. However, be careful: In the case of secure
memory pool, we should be aligning against page boundary instead
of word boundary.
- How to read data directly from the given handle to the given
buffer? We would not want to first read say using ByteString and
then store in the given address for security reasons. We would
also want the handle to be unbuffered.
You can reuse the function that you wrote for Ptr with the help of
the function withForeignPtr.
Regards
ppk
from raaz.
Yeah, mallocForeignPtr aligns at alignment of the datatype and not the page boundary.
from raaz.
I have a way of doing that by defining the Storable
instance for Pool, but peek and poke will be undefined in that case as malloc will only be using the alignment and sizeOf functions from that.
from raaz.
On Mon, Aug 12, 2013 at 10:59:41PM -0700, satvikc wrote:
I have a way of doing that by defining the
Storable
instance for
Pool, but peek and poke will be undefined in that case as malloc
will only be using the alignment and sizeOf functions from that.
I donot like this option see if there is some other way. For Ptrs
there is the functions allocBytesAligned
from raaz.
But that has type `Int -> Int -> (Ptr a -> IO b) -> IO b). We want to
allocate a pointer which is aligned and return it. There is no malloc
equivalent for that, even for Ptrs.
On Tue, Aug 13, 2013 at 11:49 AM, Piyush P Kurur
[email protected]:
On Mon, Aug 12, 2013 at 10:59:41PM -0700, satvikc wrote:
I have a way of doing that by defining the
Storable
instance for
Pool, but peek and poke will be undefined in that case as malloc
will only be using the alignment and sizeOf functions from that.I donot like this option see if there is some other way. For Ptrs
there is the functionsallocBytesAligned
—
Reply to this email directly or view it on GitHubhttps://github.com/piyush-kurur/raaz/issues/50#issuecomment-22545265
.
Satvik Chauhan
Fourth Year Under Graduate Student
Deptt. of Computer Science and Engineering
Indian Institute of Technology Kanpur
Kanpur-208016, INDIA
Email: [email protected] , [email protected]
from raaz.
I have written some code for memory locking. Can you have a look. Also I am not sure how to write testcases for those.
from raaz.
Related Issues (20)
- Uploading candidate release onto Debian experimental HOT 34
- 32-bit windows build fails on appveyor HOT 7
- Getting rid of unwanted files HOT 1
- Platform czars for raaz HOT 3
- Automatically run and check examples embedded in haddock
- Entropy and randomness quality tests.
- Backpack based modules HOT 1
- travis get random flags HOT 1
- Fix appveyor to build against 32-bit windows as well HOT 2
- Integrate standard test vectors.
- Integration of primitives from libverse HOT 1
- Raaz executable segfaults HOT 4
- Installation via Stack HOT 2
- Almost non-existent haddock documentation with the backpack based design HOT 2
- Use windows NUL file for /dev/null in the test for empty reads
- Apache 2.0 licensing HOT 9
- XChaCha20 variant HOT 2
- Use explicit_bzero and friends HOT 2
- upload `2.2` to hackage HOT 9
- Poly1305 tests based on inbuilt haskell `Integer` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raaz.