Skip to content

twystd/tweetnacl-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tweetnacl-go: version 1.01.0

TweetNaCl - GO port

tweetnacl-go is a port of Dan Bernstein's TweetNaCl "crypto library in a 100 tweets" code to the Go language. It is implemented as a wrapper around the original code to preserve the design and timing characteristics of the original implementation.

Version Info

tweetnacl: 20140427

  • v1.00.0: Initial release for tweetnacl-go
  • v1.01.0: Updated with support Go modules and Microsoft Windows CryptoApi

Disclaimer

The Go wrapper has been kept as 'thin' as possible to avoid compromising the careful design and coding of the original TweetNaCl implementation. However, cryptography being what it is, the wrapper may have (entirely inadvertently) introduced non-obvious vulnerabilities (for instance How to zero a buffer). So ....

USE ENTIRELY AT YOUR OWN RISK !

Notes

  1. There is an existing port of TweetNaCl to Go (go-tweetnacl) which reimplements the C code in Go.
  2. The cgo FFI doesn't handle zero length byte arrays particularly elegantly (see discussion at Passing zero length Go byte array to a C function). The conversion to a (*C.uchar) pointer has been abstracted into a convenience function makePtr, which includes a commented out version that returns nil for a zero length array if you prefer not to use the esoteric 'unsafe' version.

TODO

  1. Fork go-tweetnacl and merge code

References

  1. TweetNaCl
  2. [TweetNaCl: A crypto library in 100 tweets] tweetnacl-pdf
  3. [Cryptography in NaCl] nacl-pdf
  4. TweetNaCl: How cr.yp.to’s developers got carried away by the carry bit
  5. NaCl: Cryptography for the Internet
  6. On NaCl: Undefined Behaviour
  7. Safe, Efficient, and Portable Rotate in C/C++
  8. How to zero a buffer
  9. Zeroing buffers is insufficient
  10. How to zero a buffer: Erratum
  11. go-tweetnacl
  12. On the Impending Crypto Monoculture
  13. Passing zero length Go byte array to a C function
  14. NaCl
  15. libsodium:randombytes_random
  16. Microsoft Windows:rand_s
  17. Stackoverflow:Equivalent of /dev/urandom on Windows?