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

proposal: x/crypto/blake2s: add New(size, key) #32417

Open
PlainsWraith opened this issue Jun 3, 2019 · 4 comments
Open

proposal: x/crypto/blake2s: add New(size, key) #32417

PlainsWraith opened this issue Jun 3, 2019 · 4 comments
Labels
Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Milestone

Comments

@PlainsWraith
Copy link

PlainsWraith commented Jun 3, 2019

What version of Go are you using (go version)?

$ go version 1.12.2

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env GOHOSTARCH="amd64" GOHOSTOS="linux"

What did you do?

I want to be able to export newDigest for blake2s. blake2s.New128 and blake2s.New256 are great, but I want to interface with one function that can take hash size as an input (like blake2b.New)

What did you expect to see?

I want something like blake2b.New, but for blake2s. One way to make that easy is just export blake2s.newDigest

What did you see instead?

function isn't available for export in the package

@gopherbot gopherbot added this to the Unreleased milestone Jun 3, 2019
@agnivade agnivade changed the title x/crypto export blake2s.newDigest() proposal: x/crypto: export blake2s.newDigest() Jun 4, 2019
@agnivade agnivade added the Proposal-Crypto Proposal related to crypto packages or other security issues label Jun 4, 2019
@agnivade
Copy link
Contributor

agnivade commented Jun 4, 2019

@FiloSottile

@FiloSottile FiloSottile changed the title proposal: x/crypto: export blake2s.newDigest() proposal: x/crypto/blake2s: add New(size, key) Jun 4, 2019
@PlainsWraith
Copy link
Author

PlainsWraith commented Jun 6, 2019

@FiloSottile, saw your tweet here

How does this issue request fall wrt to your perspectives on security v safety of golang standard crypto lib? Should we close this issue because it perhaps asks for something unsafe?

@FiloSottile
Copy link
Contributor

With the right minimums, it can be safe, but any new API adds confusion. I guess it matter whether you need a non-128-or-256 size for compatibility (in which case, with what?), or you'd just like an API that provides both. The former is a stronger case.

@anatol
Copy link

anatol commented Apr 25, 2021

I vote for this request as well.

but any new API adds confusion

In fact adding blake2s.New(size, key) reduces confusion. blake2b already has New(size, key) method and it would be great if blake2s stay consistent with blake2b.

whether you need a non-128-or-256 size for compatibility

There are cases when blake2s used with non-128-or-256 keys. For example in cryptsetup (if you have Ubuntu with full-disk-encryption enabled then you use this library). cryptsetup supports blake2s-128,blake2s-160,blake2s-224,blake2s-256.

And Linux kernel supports these key sizes as well. See https://github.com/torvalds/linux/blob/31caf8b2a847214be856f843e251fc2ed2cd1075/include/crypto/blake2s.h#L19

Getting the golang's crypto library in parity with widely used practice would be a great thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Projects
Status: Incoming
Development

No branches or pull requests

5 participants