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

Changes to crypto_box and README; added crypto_generichash, crypto_scalarmult, crypto_sign #3

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

neuegram
Copy link

No description provided.

@neuegram neuegram changed the title Added partial support for libsodium's crypto_generichash Changes to crypto_box and README; added crypto_generichash, crypto_scalarmult, crypto_sign Aug 24, 2014
…_curve25519, crypto_sign_ed25519_sk_to_seed, and crypto_sign_ed25519_sk_to_pk new in libsodium 7.0
@jasonmccampbell
Copy link
Owner

Graham, this is awesome, thank you very much. I'll try to get a good read through tomorrow or Thursday. Could you add some unit tests to cover the non-trivial functions?

(*C.uchar)(&pk[0]),
(*C.uchar)(&sk[0])))
func BoxEasy(cypherTextOut []byte, message []byte, nonce, pk, sk []byte) int {
checkSize(cypherTextOut, len(message), "cypher text output")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the size of the cypher text on the easy functions needs to be len(message)+box_MAC_BYTES, yes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct, my mistake. I'll try to work on some unit tests during my study hall.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I added a PR that adds some bounds checking to my existing unit tests because I realized that my tests wouldn't have caught a similar problem. Please feel free to reuse any parts of them or propose a better way of dealing with it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I haven't gotten around to any of that. School has me very busy and unfortunately I have very little time to keep up. I'll try to work it in this weekend.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, this is a side project for both of us. School is a higher priority. My day job keeps me from hacking as much as I'd like, too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why crypto_sign isn't working from the package sodium? I'm new to Go and not sure why its functions aren't exporting.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. I pulled your branch and updated to libsodium 0.7.1
(and updated your changes locally) and... it worked just fine. Perhaps the
symbols weren't in the 0.7.0 release? Which OS are you on? If you are on
Linux (and I think Mac OS) are you familiar with the 'nm' command? You can
check like this:

nm libsodium.a | grep sign_ed25519_pk_to_curve25519

If it shows up with a 'T' that means it's in the text pages and should link
ok. If you are on Windows you can use the 'dumpbin /exports' command to do
the same.

BTW, I had not seen the additions of the Edwards-to-curve 25519 conversion
routines. That's very cool. I had played with a .Net port that included
such commands, but decided I wanted to use Go instead so I gave up on them.

On Mon, Sep 15, 2014 at 1:48 PM, Graham Smith [email protected]
wrote:

In sodium/crypto_box.go:

  • return int(C.crypto_box_open(
  •    (*C.uchar)(&messageOut[0]),
    
  •    (*C.uchar)(&cypherText[0]), (C.ulonglong)(len(cypherText)),
    
  •    (*C.uchar)(&nonce[0]),
    
  •    (*C.uchar)(&pk[0]),
    
  •    (*C.uchar)(&sk[0])))
    
    +func BoxEasy(cypherTextOut []byte, message []byte, nonce, pk, sk []byte) int {
  • checkSize(cypherTextOut, len(message), "cypher text output")

Any idea why crypto_sign isn't working from the package sodium? I'm new to
Go and not sure why it's functions aren't exporting.


Reply to this email directly or view it on GitHub
https://github.com/jasonmccampbell/GoSodium/pull/3/files#r17561047.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.7.0 is installed and there aren't any changes to the exposed APIs in 0.7.1. I will try pulling my code again.

Ed25519 -> curve25519 conversion is really awesome and I'm planning on using it for several projecs, which is why I wanted to update to 0.7.0 as soon as possible.

@sean-
Copy link

sean- commented Jan 4, 2015

Bump. @jasonmccampbell , any chance this pull request will be merged?

@neuegram
Copy link
Author

neuegram commented Jan 4, 2015

I think he was waiting on me to add unit tests but I never got around to it :/

@sean-
Copy link

sean- commented Jan 4, 2015

@neuegram Ah, yup. Is this something you're planning on taking on? If not, I'll submit a pull request to your repo so it can be upstreamed together.

@neuegram
Copy link
Author

neuegram commented Jan 4, 2015

@sean- Unfortunately I don't have the time right now. I'd be glad to merge a pull though if you're willing to do that! ;-)

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

Successfully merging this pull request may close these issues.

3 participants