GithubHelp home page GithubHelp logo

Comments (14)

stef avatar stef commented on September 25, 2024

interesting! also on alpine linux. but not with 1.0.12. looking at libsodium what changed between those two versions.

from pysodium.

stef avatar stef commented on September 25, 2024

smallest reproducible testcase is this:

state = pysodium.crypto_generichash_init()

from pysodium.

stef avatar stef commented on September 25, 2024

maybe this change triggered it: jedisct1/libsodium@f72bcfa

from pysodium.

jedisct1 avatar jedisct1 commented on September 25, 2024

Very likely.

But you shouldn't assume anything about the content of the structure. This may change, especially if BLAKE2X is added.

Use crypto_generichash_statebytes() to get the correct amount of bytes required to store the state, and you will always be safe.

from pysodium.

stef avatar stef commented on September 25, 2024

confirmed. just built a libsodium with that change reverted and it doesn't segfault anymore.

from pysodium.

stef avatar stef commented on September 25, 2024

not sure it's the number of bytes that's the problem, but the alignment itself?
this https://github.com/stef/pysodium/blob/master/pysodium/__init__.py#L160 seems to be exactly matching this https://github.com/jedisct1/libsodium/blob/master/src/libsodium/include/sodium/crypto_generichash_blake2b.h#L23

from pysodium.

jedisct1 avatar jedisct1 commented on September 25, 2024

Use crypto_generichash_statebytes(), trust me :)

from pysodium.

stef avatar stef commented on September 25, 2024

would this be correct to pass to generichash_init?

state = sodium_malloc(crypto_generichash_statebytes());

and i would not have to mess with alignment?

from pysodium.

jedisct1 avatar jedisct1 commented on September 25, 2024

That would work! But maybe CryptoGenericHashState can just be an array whose size is ctypes.c_uint8 * sodium.crypto_generichash_statebytes() bytes?

from pysodium.

stef avatar stef commented on September 25, 2024

seems to work. pushed a fix.

from pysodium.

stef avatar stef commented on September 25, 2024

thx to all of you, for reporting and contributing a fix

from pysodium.

stef avatar stef commented on September 25, 2024

i bumped the version and also uploaded a new version to pypi, if you agree to the fix please close this issue.

from pysodium.

jedisct1 avatar jedisct1 commented on September 25, 2024

Awesome, thanks Stef!

from pysodium.

mans0954 avatar mans0954 commented on September 25, 2024

Thanks for the prompt response. Debian package updated:

https://packages.qa.debian.org/p/pysodium/news/20170811T211431Z.html

Christopher

from pysodium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.