Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hardwiring of struct size causes core dumps #3

Closed
client9 opened this issue Mar 23, 2014 · 3 comments
Closed

hardwiring of struct size causes core dumps #3

client9 opened this issue Mar 23, 2014 · 3 comments

Comments

@client9
Copy link

client9 commented Mar 23, 2014

Hey thanks for starting this!

On my box the hash functions cause core dumps. Here's why..

compilers from version to version will compile structures differently, and some types the size of a 'size_t' type might be 4 or 8 bytes.. On my box the

printf("%d\n", sizeof(struct crypto_generichash_blake2b_state));

is 361

I think you have it as 357 or something (hardcoded in python).. python gets very unhappy and core dumps. boo.

I'm not that familiar with ctypes (and sorry you switched from FFI), so I'm not sure if there is a nice way to find the size programmatically. if so use that.. otherwise, making it 361 won't hurt (will just waste a few bytes of space otherwise).

thanks again!

nickg

@client9
Copy link
Author

client9 commented Mar 23, 2014

Ahh, here ya go.

crypto_generichash_blake2b_state = 8*12 + 256 + ctypes.sizeof(ctypes.c_size_t) + 1

@stef
Copy link
Owner

stef commented Apr 10, 2014

thanks a lot! will check and update the code!

@stef
Copy link
Owner

stef commented Apr 10, 2014

should be fixed in 3daee1d
thx a lot!

@stef stef closed this as completed Apr 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants