diff options
author | Nick Johnson <arachnid@notdot.net> | 2018-01-08 02:38:11 +0800 |
---|---|---|
committer | Guillaume Ballet <gballet@gmail.com> | 2019-04-08 19:19:37 +0800 |
commit | f7027dd68ce115908ed8e359862cb7b21ddac15f (patch) | |
tree | 46132f008e2410a4e05804e6a846648b852b6711 /vendor | |
parent | 3996bc1ad91665ad30036713fba11840a36dfff0 (diff) | |
download | go-tangerine-f7027dd68ce115908ed8e359862cb7b21ddac15f.tar go-tangerine-f7027dd68ce115908ed8e359862cb7b21ddac15f.tar.gz go-tangerine-f7027dd68ce115908ed8e359862cb7b21ddac15f.tar.bz2 go-tangerine-f7027dd68ce115908ed8e359862cb7b21ddac15f.tar.lz go-tangerine-f7027dd68ce115908ed8e359862cb7b21ddac15f.tar.xz go-tangerine-f7027dd68ce115908ed8e359862cb7b21ddac15f.tar.zst go-tangerine-f7027dd68ce115908ed8e359862cb7b21ddac15f.zip |
accounts, core, internal, node: Add support for smartcard wallets
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/ebfe/scard/LICENSE | 23 | ||||
-rw-r--r-- | vendor/github.com/ebfe/scard/README.md | 14 | ||||
-rw-r--r-- | vendor/github.com/ebfe/scard/scard.go | 283 | ||||
-rw-r--r-- | vendor/github.com/ebfe/scard/scard_darwin.go | 219 | ||||
-rw-r--r-- | vendor/github.com/ebfe/scard/scard_unix.go | 206 | ||||
-rw-r--r-- | vendor/github.com/ebfe/scard/scard_windows.go | 221 | ||||
-rw-r--r-- | vendor/github.com/ebfe/scard/zconst.go | 190 | ||||
-rw-r--r-- | vendor/github.com/tyler-smith/go-bip39/LICENSE | 21 | ||||
-rw-r--r-- | vendor/github.com/tyler-smith/go-bip39/README.md | 38 | ||||
-rw-r--r-- | vendor/github.com/tyler-smith/go-bip39/bip39.go | 249 | ||||
-rw-r--r-- | vendor/github.com/tyler-smith/go-bip39/coverage.txt | 15 | ||||
-rw-r--r-- | vendor/github.com/tyler-smith/go-bip39/wordlist.go | 2067 | ||||
-rw-r--r-- | vendor/vendor.json | 18 |
13 files changed, 3564 insertions, 0 deletions
diff --git a/vendor/github.com/ebfe/scard/LICENSE b/vendor/github.com/ebfe/scard/LICENSE new file mode 100644 index 000000000..0d220e7ae --- /dev/null +++ b/vendor/github.com/ebfe/scard/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2016, Michael Gehring <mg@ebfe.org> +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/ebfe/scard/README.md b/vendor/github.com/ebfe/scard/README.md new file mode 100644 index 000000000..cdafb2c7b --- /dev/null +++ b/vendor/github.com/ebfe/scard/README.md @@ -0,0 +1,14 @@ +scard +===== + +[](https://godoc.org/github.com/ebfe/scard) + +Go bindings to the PC/SC API. + +## Installation + + go get github.com/ebfe/scard + +## Bugs + + - Memory layouts/GC needs a thorough review. diff --git a/vendor/github.com/ebfe/scard/scard.go b/vendor/github.com/ebfe/scard/scard.go new file mode 100644 index 000000000..a5f0ae16b --- /dev/null +++ b/vendor/github.com/ebfe/scard/scard.go @@ -0,0 +1,283 @@ +// Package scard provides bindings to the PC/SC API. +package scard + +import ( + "time" + "unsafe" +) + +type CardStatus struct { + Reader string + State State + ActiveProtocol Protocol + Atr []byte +} + +type ReaderState struct { + Reader string + UserData interface{} + CurrentState StateFlag + EventState StateFlag + Atr []byte +} + +type Context struct { + ctx uintptr +} + +type Card struct { + handle uintptr + activeProtocol Protocol +} + +// wraps SCardEstablishContext +func EstablishContext() (*Context, error) { + ctx, r := scardEstablishContext(ScopeSystem, 0, 0) + if r != ErrSuccess { + return nil, r + } + + return &Context{ctx: ctx}, nil +} + +// wraps SCardIsValidContext +func (ctx *Context) IsValid() (bool, error) { + r := scardIsValidContext(ctx.ctx) + switch r { + case ErrSuccess: + return true, nil + case ErrInvalidHandle: + return false, nil + default: + return false, r + } +} + +// wraps SCardCancel +func (ctx *Context) Cancel() error { + r := scardCancel(ctx.ctx) + if r != ErrSuccess { + return r + } + return nil +} + +// wraps SCardReleaseContext +func (ctx *Context) Release() error { + r := scardReleaseContext(ctx.ctx) + if r != ErrSuccess { + return r + } + return nil +} + +// wraps SCardListReaders +func (ctx *Context) ListReaders() ([]string, error) { + needed, r := scardListReaders(ctx.ctx, nil, nil, 0) + if r != ErrSuccess { + return nil, r + } + + buf := make(strbuf, needed) + n, r := scardListReaders(ctx.ctx, nil, buf.ptr(), uint32(len(buf))) + if r != ErrSuccess { + return nil, r + } + return decodemstr(buf[:n]), nil +} + +// wraps SCardListReaderGroups +func (ctx *Context) ListReaderGroups() ([]string, error) { + needed, r := scardListReaderGroups(ctx.ctx, nil, 0) + if r != ErrSuccess { + return nil, r + } + + buf := make(strbuf, needed) + n, r := scardListReaderGroups(ctx.ctx, buf.ptr(), uint32(len(buf))) + if r != ErrSuccess { + return nil, r + } + return decodemstr(buf[:n]), nil +} + +// wraps SCardGetStatusChange +func (ctx *Context) GetStatusChange(readerStates []ReaderState, timeout time.Duration) error { + + dwTimeout := durationToTimeout(timeout) + states := make([]scardReaderState, len(readerStates)) + + for i := range readerStates { + var err error + states[i], err = readerStates[i].toSys() + if err != nil { + return err + } + } + + r := scardGetStatusChange(ctx.ctx, dwTimeout, states) + if r != ErrSuccess { + return r + } + + for i := range readerStates { + (&readerStates[i]).update(&states[i]) + } + + return nil +} + +// wraps SCardConnect +func (ctx *Context) Connect(reader string, mode ShareMode, proto Protocol) (*Card, error) { + creader, err := encodestr(reader) + if err != nil { + return nil, err + } + handle, activeProtocol, r := scardConnect(ctx.ctx, creader.ptr(), mode, proto) + if r != ErrSuccess { + return nil, r + } + return &Card{handle: handle, activeProtocol: activeProtocol}, nil +} + +// wraps SCardDisconnect +func (card *Card) Disconnect(d Disposition) error { + r := scardDisconnect(card.handle, d) + if r != ErrSuccess { + return r + } + return nil +} + +// wraps SCardReconnect +func (card *Card) Reconnect(mode ShareMode, proto Protocol, disp Disposition) error { + activeProtocol, r := scardReconnect(card.handle, mode, proto, disp) + if r != ErrSuccess { + return r + } + card.activeProtocol = activeProtocol + return nil +} + +// wraps SCardBeginTransaction +func (card *Card) BeginTransaction() error { + r := scardBeginTransaction(card.handle) + if r != ErrSuccess { + return r + } + return nil +} + +// wraps SCardEndTransaction +func (card *Card) EndTransaction(disp Disposition) error { + r := scardEndTransaction(card.handle, disp) + if r != ErrSuccess { + return r + } + return nil +} + +// wraps SCardStatus +func (card *Card) Status() (*CardStatus, error) { + reader, state, proto, atr, err := scardCardStatus(card.handle) + if err != ErrSuccess { + return nil, err + } + return &CardStatus{Reader: reader, State: state, ActiveProtocol: proto, Atr: atr}, nil +} + +// wraps SCardTransmit +func (card *Card) Transmit(cmd []byte) ([]byte, error) { + rsp := make([]byte, maxBufferSizeExtended) + rspLen, err := scardTransmit(card.handle, card.activeProtocol, cmd, rsp) + if err != ErrSuccess { + return nil, err + } + return rsp[:rspLen], nil +} + +// wraps SCardControl +func (card *Card) Control(ioctl uint32, in []byte) ([]byte, error) { + var out [0xffff]byte + outLen, err := scardControl(card.handle, ioctl, in, out[:]) + if err != ErrSuccess { + return nil, err + } + return out[:outLen], nil +} + +// wraps SCardGetAttrib +func (card *Card) GetAttrib(id Attrib) ([]byte, error) { + needed, err := scardGetAttrib(card.handle, id, nil) + if err != ErrSuccess { + return nil, err + } + + var attrib = make([]byte, needed) + n, err := scardGetAttrib(card.handle, id, attrib) + if err != ErrSuccess { + return nil, err + } + return attrib[:n], nil +} + +// wraps SCardSetAttrib +func (card *Card) SetAttrib(id Attrib, data []byte) error { + err := scardSetAttrib(card.handle, id, data) + if err != ErrSuccess { + return err + } + return nil +} + +func durationToTimeout(timeout time.Duration) uint32 { + switch { + case timeout < 0: + return infiniteTimeout + case timeout > time.Duration(infiniteTimeout)*time.Millisecond: + return infiniteTimeout - 1 + default: + return uint32(timeout / time.Millisecond) + } +} + +func (buf strbuf) ptr() unsafe.Pointer { + return unsafe.Pointer(&buf[0]) +} + +func (buf strbuf) split() []strbuf { + var chunks []strbuf + for len(buf) > 0 && buf[0] != 0 { + i := 0 + for i = range buf { + if buf[i] == 0 { + break + } + } + chunks = append(chunks, buf[:i+1]) + buf = buf[i+1:] + } + + return chunks +} + +func encodemstr(strings ...string) (strbuf, error) { + var buf strbuf + for _, s := range strings { + utf16, err := encodestr(s) + if err != nil { + return nil, err + } + buf = append(buf, utf16...) + } + buf = append(buf, 0) + return buf, nil +} + +func decodemstr(buf strbuf) []string { + var strings []string + for _, chunk := range buf.split() { + strings = append(strings, decodestr(chunk)) + } + return strings +} diff --git a/vendor/github.com/ebfe/scard/scard_darwin.go b/vendor/github.com/ebfe/scard/scard_darwin.go new file mode 100644 index 000000000..83a1597b3 --- /dev/null +++ b/vendor/github.com/ebfe/scard/scard_darwin.go @@ -0,0 +1,219 @@ +// +build darwin + +package scard + +// #cgo LDFLAGS: -framework PCSC +// #cgo CFLAGS: -I /usr/include +// #include <stdlib.h> +// #include <PCSC/winscard.h> +// #include <PCSC/wintypes.h> +import "C" + +import ( + "unsafe" +) + +func (e Error) Error() string { + return "scard: " + C.GoString(C.pcsc_stringify_error(C.int32_t(e))) +} + +// Version returns the libpcsclite version string +func Version() string { + return C.PCSCLITE_VERSION_NUMBER +} + +func scardEstablishContext(scope Scope, reserved1, reserved2 uintptr) (uintptr, Error) { + var ctx C.SCARDCONTEXT + r := C.SCardEstablishContext(C.uint32_t(scope), unsafe.Pointer(reserved1), unsafe.Pointer(reserved2), &ctx) + return uintptr(ctx), Error(r) +} + +func scardIsValidContext(ctx uintptr) Error { + r := C.SCardIsValidContext(C.SCARDCONTEXT(ctx)) + return Error(r) +} + +func scardCancel(ctx uintptr) Error { + r := C.SCardCancel(C.SCARDCONTEXT(ctx)) + return Error(r) +} + +func scardReleaseContext(ctx uintptr) Error { + r := C.SCardReleaseContext(C.SCARDCONTEXT(ctx)) + return Error(r) +} + +func scardListReaders(ctx uintptr, groups, buf unsafe.Pointer, bufLen uint32) (uint32, Error) { + dwBufLen := C.uint32_t(bufLen) + r := C.SCardListReaders(C.SCARDCONTEXT(ctx), (C.LPCSTR)(groups), (C.LPSTR)(buf), &dwBufLen) + return uint32(dwBufLen), Error(r) +} + +func scardListReaderGroups(ctx uintptr, buf unsafe.Pointer, bufLen uint32) (uint32, Error) { + dwBufLen := C.uint32_t(bufLen) + r := C.SCardListReaderGroups(C.SCARDCONTEXT(ctx), (C.LPSTR)(buf), &dwBufLen) + return uint32(dwBufLen), Error(r) +} + +func scardGetStatusChange(ctx uintptr, timeout uint32, states []scardReaderState) Error { + // In darwin, the LPSCARD_READERSTATE_A has 1 byte alignment and hence + // has no trailing padding. Go does add 3 bytes of padding (on both 32 + // and 64 bits), so we pack an array manually instead. + const size = int(unsafe.Sizeof(states[0])) - 3 + buf := make([]byte, size*len(states)) + for i, _ := range states { + copy(buf[i*size:(i+1)*size], (*(*[size]byte)(unsafe.Pointer(&states[i])))[:]) + } + r := C.SCardGetStatusChange(C.SCARDCONTEXT(ctx), C.uint32_t(timeout), (C.LPSCARD_READERSTATE_A)(unsafe.Pointer(&buf[0])), C.uint32_t(len(states))) + for i, _ := range states { + copy((*(*[size]byte)(unsafe.Pointer(&states[i])))[:], buf[i*size:(i+1)*size]) + } + return Error(r) +} + +func scardConnect(ctx uintptr, reader unsafe.Pointer, shareMode ShareMode, proto Protocol) (uintptr, Protocol, Error) { + var handle C.SCARDHANDLE + var activeProto C.uint32_t + + r := C.SCardConnect(C.SCARDCONTEXT(ctx), C.LPCSTR(reader), C.uint32_t(shareMode), C.uint32_t(proto), &handle, &activeProto) + + return uintptr(handle), Protocol(activeProto), Error(r) +} + +func scardDisconnect(card uintptr, d Disposition) Error { + r := C.SCardDisconnect(C.SCARDHANDLE(card), C.uint32_t(d)) + return Error(r) +} + +func scardReconnect(card uintptr, mode ShareMode, proto Protocol, disp Disposition) (Protocol, Error) { + var activeProtocol C.uint32_t + r := C.SCardReconnect(C.SCARDHANDLE(card), C.uint32_t(mode), C.uint32_t(proto), C.uint32_t(disp), &activeProtocol) + return Protocol(activeProtocol), Error(r) +} + +func scardBeginTransaction(card uintptr) Error { + r := C.SCardBeginTransaction(C.SCARDHANDLE(card)) + return Error(r) +} + +func scardEndTransaction(card uintptr, disp Disposition) Error { + r := C.SCardEndTransaction(C.SCARDHANDLE(card), C.uint32_t(disp)) + return Error(r) +} + +func scardCardStatus(card uintptr) (string, State, Protocol, []byte, Error) { + var readerBuf [C.MAX_READERNAME + 1]byte + var readerLen = C.uint32_t(len(readerBuf)) + var state, proto C.uint32_t + var atr [maxAtrSize]byte + var atrLen = C.uint32_t(len(atr)) + + r := C.SCardStatus(C.SCARDHANDLE(card), (C.LPSTR)(unsafe.Pointer(&readerBuf[0])), &readerLen, &state, &proto, (*C.uchar)(&atr[0]), &atrLen) + + return decodestr(readerBuf[:readerLen]), State(state), Protocol(proto), atr[:atrLen], Error(r) +} + +func scardTransmit(card uintptr, proto Protocol, cmd []byte, rsp []byte) (uint32, Error) { + var sendpci C.SCARD_IO_REQUEST + var recvpci C.SCARD_IO_REQUEST + var rspLen = C.uint32_t(len(rsp)) + + switch proto { + case ProtocolT0, ProtocolT1: + sendpci.dwProtocol = C.uint32_t(proto) + default: + panic("unknown protocol") + } + sendpci.cbPciLength = C.sizeof_SCARD_IO_REQUEST + + r := C.SCardTransmit(C.SCARDHANDLE(card), &sendpci, (*C.uchar)(&cmd[0]), C.uint32_t(len(cmd)), &recvpci, (*C.uchar)(&rsp[0]), &rspLen) + + return uint32(rspLen), Error(r) +} + +func scardControl(card uintptr, ioctl uint32, in, out []byte) (uint32, Error) { + var ptrIn unsafe.Pointer + var outLen = C.uint32_t(len(out)) + + if len(in) != 0 { + ptrIn = unsafe.Pointer(&in[0]) + } + + r := C.SCardControl(C.SCARDHANDLE(card), C.uint32_t(ioctl), ptrIn, C.uint32_t(len(in)), unsafe.Pointer(&out[0]), C.uint32_t(len(out)), &outLen) + return uint32(outLen), Error(r) +} + +func scardGetAttrib(card uintptr, id Attrib, buf []byte) (uint32, Error) { + var ptr *C.uint8_t + + if len(buf) != 0 { + ptr = (*C.uint8_t)(&buf[0]) + } + + bufLen := C.uint32_t(len(buf)) + r := C.SCardGetAttrib(C.SCARDHANDLE(card), C.uint32_t(id), ptr, &bufLen) + + return uint32(bufLen), Error(r) +} + +func scardSetAttrib(card uintptr, id Attrib, buf []byte) Error { + r := C.SCardSetAttrib(C.SCARDHANDLE(card), C.uint32_t(id), ((*C.uint8_t)(&buf[0])), C.uint32_t(len(buf))) + return Error(r) +} + +type strbuf []byte + +func encodestr(s string) (strbuf, error) { + buf := strbuf(s + "\x00") + return buf, nil +} + +func decodestr(buf strbuf) string { + if len(buf) == 0 { + return "" + } + + if buf[len(buf)-1] == 0 { + buf = buf[:len(buf)-1] + } + + return string(buf) +} + +type scardReaderState struct { + szReader uintptr + pvUserData uintptr + dwCurrentState uint32 + dwEventState uint32 + cbAtr uint32 + rgbAtr [33]byte +} + +var pinned = map[string]*strbuf{} + +func (rs *ReaderState) toSys() (scardReaderState, error) { + var sys scardReaderState + + creader, err := encodestr(rs.Reader) + if err != nil { + return scardReaderState{}, err + } + pinned[rs.Reader] = &creader + sys.szReader = uintptr(creader.ptr()) + sys.dwCurrentState = uint32(rs.CurrentState) + sys.cbAtr = uint32(len(rs.Atr)) + for i, v := range rs.Atr { + sys.rgbAtr[i] = byte(v) + } + return sys, nil +} + +func (rs *ReaderState) update(sys *scardReaderState) { + rs.EventState = StateFlag(sys.dwEventState) + if sys.cbAtr > 0 { + rs.Atr = make([]byte, int(sys.cbAtr)) + for i := 0; i < int(sys.cbAtr); i++ { + rs.Atr[i] = byte(sys.rgbAtr[i]) + } + } +} diff --git a/vendor/github.com/ebfe/scard/scard_unix.go b/vendor/github.com/ebfe/scard/scard_unix.go new file mode 100644 index 000000000..21910318f --- /dev/null +++ b/vendor/github.com/ebfe/scard/scard_unix.go @@ -0,0 +1,206 @@ +// +build !windows,!darwin + +package scard + +// #cgo pkg-config: libpcsclite +// #include <stdlib.h> +// #include <winscard.h> +import "C" + +import ( + "unsafe" +) + +func (e Error) Error() string { + return "scard: " + C.GoString(C.pcsc_stringify_error(C.LONG(e))) +} + +// Version returns the libpcsclite version string +func Version() string { + return C.PCSCLITE_VERSION_NUMBER +} + +func scardEstablishContext(scope Scope, reserved1, reserved2 uintptr) (uintptr, Error) { + var ctx C.SCARDCONTEXT + r := C.SCardEstablishContext(C.DWORD(scope), C.LPCVOID(reserved1), C.LPCVOID(reserved2), &ctx) + return uintptr(ctx), Error(r) +} + +func scardIsValidContext(ctx uintptr) Error { + r := C.SCardIsValidContext(C.SCARDCONTEXT(ctx)) + return Error(r) +} + +func scardCancel(ctx uintptr) Error { + r := C.SCardCancel(C.SCARDCONTEXT(ctx)) + return Error(r) +} + +func scardReleaseContext(ctx uintptr) Error { + r := C.SCardReleaseContext(C.SCARDCONTEXT(ctx)) + return Error(r) +} + +func scardListReaders(ctx uintptr, groups, buf unsafe.Pointer, bufLen uint32) (uint32, Error) { + dwBufLen := C.DWORD(bufLen) + r := C.SCardListReaders(C.SCARDCONTEXT(ctx), (C.LPCSTR)(groups), (C.LPSTR)(buf), &dwBufLen) + return uint32(dwBufLen), Error(r) +} + +func scardListReaderGroups(ctx uintptr, buf unsafe.Pointer, bufLen uint32) (uint32, Error) { + dwBufLen := C.DWORD(bufLen) + r := C.SCardListReaderGroups(C.SCARDCONTEXT(ctx), (C.LPSTR)(buf), &dwBufLen) + return uint32(dwBufLen), Error(r) +} + +func scardGetStatusChange(ctx uintptr, timeout uint32, states []scardReaderState) Error { + r := C.SCardGetStatusChange(C.SCARDCONTEXT(ctx), C.DWORD(timeout), (C.LPSCARD_READERSTATE)(unsafe.Pointer(&states[0])), C.DWORD(len(states))) + return Error(r) +} + +func scardConnect(ctx uintptr, reader unsafe.Pointer, shareMode ShareMode, proto Protocol) (uintptr, Protocol, Error) { + var handle C.SCARDHANDLE + var activeProto C.DWORD + + r := C.SCardConnect(C.SCARDCONTEXT(ctx), C.LPCSTR(reader), C.DWORD(shareMode), C.DWORD(proto), &handle, &activeProto) + + return uintptr(handle), Protocol(activeProto), Error(r) +} + +func scardDisconnect(card uintptr, d Disposition) Error { + r := C.SCardDisconnect(C.SCARDHANDLE(card), C.DWORD(d)) + return Error(r) +} + +func scardReconnect(card uintptr, mode ShareMode, proto Protocol, disp Disposition) (Protocol, Error) { + var activeProtocol C.DWORD + r := C.SCardReconnect(C.SCARDHANDLE(card), C.DWORD(mode), C.DWORD(proto), C.DWORD(disp), &activeProtocol) + return Protocol(activeProtocol), Error(r) +} + +func scardBeginTransaction(card uintptr) Error { + r := C.SCardBeginTransaction(C.SCARDHANDLE(card)) + return Error(r) +} + +func scardEndTransaction(card uintptr, disp Disposition) Error { + r := C.SCardEndTransaction(C.SCARDHANDLE(card), C.DWORD(disp)) + return Error(r) +} + +func scardCardStatus(card uintptr) (string, State, Protocol, []byte, Error) { + var readerBuf [C.MAX_READERNAME + 1]byte + var readerLen = C.DWORD(len(readerBuf)) + var state, proto C.DWORD + var atr [maxAtrSize]byte + var atrLen = C.DWORD(len(atr)) + + r := C.SCardStatus(C.SCARDHANDLE(card), (C.LPSTR)(unsafe.Pointer(&readerBuf[0])), &readerLen, &state, &proto, (*C.BYTE)(&atr[0]), &atrLen) + + return decodestr(readerBuf[:readerLen]), State(state), Protocol(proto), atr[:atrLen], Error(r) +} + +func scardTransmit(card uintptr, proto Protocol, cmd []byte, rsp []byte) (uint32, Error) { + var sendpci C.SCARD_IO_REQUEST + var recvpci C.SCARD_IO_REQUEST + var rspLen = C.DWORD(len(rsp)) + + switch proto { + case ProtocolT0, ProtocolT1: + sendpci.dwProtocol = C.ulong(proto) + default: + panic("unknown protocol") + } + sendpci.cbPciLength = C.sizeof_SCARD_IO_REQUEST + + r := C.SCardTransmit(C.SCARDHANDLE(card), &sendpci, (*C.BYTE)(&cmd[0]), C.DWORD(len(cmd)), &recvpci, (*C.BYTE)(&rsp[0]), &rspLen) + + return uint32(rspLen), Error(r) +} + +func scardControl(card uintptr, ioctl uint32, in, out []byte) (uint32, Error) { + var ptrIn C.LPCVOID + var outLen = C.DWORD(len(out)) + + if len(in) != 0 { + ptrIn = C.LPCVOID(unsafe.Pointer(&in[0])) + } + + r := C.SCardControl(C.SCARDHANDLE(card), C.DWORD(ioctl), ptrIn, C.DWORD(len(in)), (C.LPVOID)(unsafe.Pointer(&out[0])), C.DWORD(len(out)), &outLen) + return uint32(outLen), Error(r) +} + +func scardGetAttrib(card uintptr, id Attrib, buf []byte) (uint32, Error) { + var ptr C.LPBYTE + + if len(buf) != 0 { + ptr = C.LPBYTE(unsafe.Pointer(&buf[0])) + } + + bufLen := C.DWORD(len(buf)) + r := C.SCardGetAttrib(C.SCARDHANDLE(card), C.DWORD(id), ptr, &bufLen) + + return uint32(bufLen), Error(r) +} + +func scardSetAttrib(card uintptr, id Attrib, buf []byte) Error { + r := C.SCardSetAttrib(C.SCARDHANDLE(card), C.DWORD(id), (*C.BYTE)(unsafe.Pointer(&buf[0])), C.DWORD(len(buf))) + return Error(r) +} + +type strbuf []byte + +func encodestr(s string) (strbuf, error) { + buf := strbuf(s + "\x00") + return buf, nil +} + +func decodestr(buf strbuf) string { + if len(buf) == 0 { + return "" + } + + if buf[len(buf)-1] == 0 { + buf = buf[:len(buf)-1] + } + + return string(buf) +} + +type scardReaderState struct { + szReader uintptr + pvUserData uintptr + dwCurrentState uintptr + dwEventState uintptr + cbAtr uintptr + rgbAtr [33]byte +} + +var pinned = map[string]*strbuf{} + +func (rs *ReaderState) toSys() (scardReaderState, error) { + var sys scardReaderState + + creader, err := encodestr(rs.Reader) + if err != nil { + return scardReaderState{}, err + } + pinned[rs.Reader] = &creader + sys.szReader = uintptr(creader.ptr()) + sys.dwCurrentState = uintptr(rs.CurrentState) + sys.cbAtr = uintptr(len(rs.Atr)) + for i, v := range rs.Atr { + sys.rgbAtr[i] = byte(v) + } + return sys, nil +} + +func (rs *ReaderState) update(sys *scardReaderState) { + rs.EventState = StateFlag(sys.dwEventState) + if sys.cbAtr > 0 { + rs.Atr = make([]byte, int(sys.cbAtr)) + for i := 0; i < int(sys.cbAtr); i++ { + rs.Atr[i] = byte(sys.rgbAtr[i]) + } + } +} diff --git a/vendor/github.com/ebfe/scard/scard_windows.go b/vendor/github.com/ebfe/scard/scard_windows.go new file mode 100644 index 000000000..bc852da04 --- /dev/null +++ b/vendor/github.com/ebfe/scard/scard_windows.go @@ -0,0 +1,221 @@ +package scard + +import ( + "fmt" + "syscall" + "unsafe" +) + +var ( + modwinscard = syscall.NewLazyDLL("winscard.dll") + + procEstablishContext = modwinscard.NewProc("SCardEstablishContext") + procReleaseContext = modwinscard.NewProc("SCardReleaseContext") + procIsValidContext = modwinscard.NewProc("SCardIsValidContext") + procCancel = modwinscard.NewProc("SCardCancel") + procListReaders = modwinscard.NewProc("SCardListReadersW") + procListReaderGroups = modwinscard.NewProc("SCardListReaderGroupsW") + procGetStatusChange = modwinscard.NewProc("SCardGetStatusChangeW") + procConnect = modwinscard.NewProc("SCardConnectW") + procDisconnect = modwinscard.NewProc("SCardDisconnect") + procReconnect = modwinscard.NewProc("SCardReconnect") + procBeginTransaction = modwinscard.NewProc("SCardBeginTransaction") + procEndTransaction = modwinscard.NewProc("SCardEndTransaction") + procStatus = modwinscard.NewProc("SCardStatusW") + procTransmit = modwinscard.NewProc("SCardTransmit") + procControl = modwinscard.NewProc("SCardControl") + procGetAttrib = modwinscard.NewProc("SCardGetAttrib") + procSetAttrib = modwinscard.NewProc("SCardSetAttrib") + + dataT0Pci = modwinscard.NewProc("g_rgSCardT0Pci") + dataT1Pci = modwinscard.NewProc("g_rgSCardT1Pci") +) + +var scardIoReqT0 uintptr +var scardIoReqT1 uintptr + +func init() { + if err := dataT0Pci.Find(); err != nil { + panic(err) + } + scardIoReqT0 = dataT0Pci.Addr() + if err := dataT1Pci.Find(); err != nil { + panic(err) + } + scardIoReqT1 = dataT1Pci.Addr() +} + +func (e Error) Error() string { + err := syscall.Errno(e) + return fmt.Sprintf("scard: error(%x): %s", uintptr(e), err.Error()) +} + +func scardEstablishContext(scope Scope, reserved1, reserved2 uintptr) (uintptr, Error) { + var ctx uintptr + r, _, _ := procEstablishContext.Call(uintptr(scope), reserved1, reserved2, uintptr(unsafe.Pointer(&ctx))) + return ctx, Error(r) +} + +func scardIsValidContext(ctx uintptr) Error { + r, _, _ := procIsValidContext.Call(ctx) + return Error(r) +} + +func scardCancel(ctx uintptr) Error { + r, _, _ := procCancel.Call(ctx) + return Error(r) +} + +func scardReleaseContext(ctx uintptr) Error { + r, _, _ := procReleaseContext.Call(ctx) + return Error(r) +} + +func scardListReaders(ctx uintptr, groups, buf unsafe.Pointer, bufLen uint32) (uint32, Error) { + dwBufLen := uint32(bufLen) + r, _, _ := procListReaders.Call(ctx, uintptr(groups), uintptr(buf), uintptr(unsafe.Pointer(&dwBufLen))) + return dwBufLen, Error(r) +} + +func scardListReaderGroups(ctx uintptr, buf unsafe.Pointer, bufLen uint32) (uint32, Error) { + dwBufLen := uint32(bufLen) + r, _, _ := procListReaderGroups.Call(ctx, uintptr(buf), uintptr(unsafe.Pointer(&dwBufLen))) + return dwBufLen, Error(r) +} + +func scardGetStatusChange(ctx uintptr, timeout uint32, states []scardReaderState) Error { + r, _, _ := procGetStatusChange.Call(ctx, uintptr(timeout), uintptr(unsafe.Pointer(&states[0])), uintptr(len(states))) + return Error(r) +} + +func scardConnect(ctx uintptr, reader unsafe.Pointer, shareMode ShareMode, proto Protocol) (uintptr, Protocol, Error) { + var handle uintptr + var activeProto uint32 + + r, _, _ := procConnect.Call(ctx, uintptr(reader), uintptr(shareMode), uintptr(proto), uintptr(unsafe.Pointer(&handle)), uintptr(unsafe.Pointer(&activeProto))) + + return handle, Protocol(activeProto), Error(r) +} + +func scardDisconnect(card uintptr, d Disposition) Error { + r, _, _ := procDisconnect.Call(card, uintptr(d)) + return Error(r) +} + +func scardReconnect(card uintptr, mode ShareMode, proto Protocol, disp Disposition) (Protocol, Error) { + var activeProtocol uint32 + r, _, _ := procReconnect.Call(card, uintptr(mode), uintptr(proto), uintptr(disp), uintptr(unsafe.Pointer(&activeProtocol))) + return Protocol(activeProtocol), Error(r) +} + +func scardBeginTransaction(card uintptr) Error { + r, _, _ := procBeginTransaction.Call(card) + return Error(r) +} + +func scardEndTransaction(card uintptr, disp Disposition) Error { + r, _, _ := procEndTransaction.Call(card, uintptr(disp)) + return Error(r) +} + +func scardCardStatus(card uintptr) (string, State, Protocol, []byte, Error) { + var state, proto uint32 + var atr [maxAtrSize]byte + var atrLen = uint32(len(atr)) + + reader := make(strbuf, maxReadername+1) + readerLen := uint32(len(reader)) + + r, _, _ := procStatus.Call(card, uintptr(reader.ptr()), uintptr(unsafe.Pointer(&readerLen)), uintptr(unsafe.Pointer(&state)), uintptr(unsafe.Pointer(&proto)), uintptr(unsafe.Pointer(&atr[0])), uintptr(unsafe.Pointer(&atrLen))) + + return decodestr(reader[:readerLen]), State(state), Protocol(proto), atr[:atrLen], Error(r) +} + +func scardTransmit(card uintptr, proto Protocol, cmd []byte, rsp []byte) (uint32, Error) { + var sendpci uintptr + var rspLen = uint32(len(rsp)) + + switch proto { + case ProtocolT0: + sendpci = scardIoReqT0 + case ProtocolT1: + sendpci = scardIoReqT1 + default: + panic("unknown protocol") + } + + r, _, _ := procTransmit.Call(card, sendpci, uintptr(unsafe.Pointer(&cmd[0])), uintptr(len(cmd)), uintptr(0), uintptr(unsafe.Pointer(&rsp[0])), uintptr(unsafe.Pointer(&rspLen))) + + return rspLen, Error(r) +} + +func scardControl(card uintptr, ioctl uint32, in, out []byte) (uint32, Error) { + var ptrIn uintptr + var outLen = uint32(len(out)) + + if len(in) != 0 { + ptrIn = uintptr(unsafe.Pointer(&in[0])) + } + + r, _, _ := procControl.Call(card, uintptr(ioctl), ptrIn, uintptr(len(in)), uintptr(unsafe.Pointer(&out[0])), uintptr(len(out)), uintptr(unsafe.Pointer(&outLen))) + return outLen, Error(r) +} + +func scardGetAttrib(card uintptr, id Attrib, buf []byte) (uint32, Error) { + var ptr uintptr + + if len(buf) != 0 { + ptr = uintptr(unsafe.Pointer(&buf[0])) + } + + bufLen := uint32(len(buf)) + r, _, _ := procGetAttrib.Call(card, uintptr(id), ptr, uintptr(unsafe.Pointer(&bufLen))) + + return bufLen, Error(r) +} + +func scardSetAttrib(card uintptr, id Attrib, buf []byte) Error { + r, _, _ := procSetAttrib.Call(card, uintptr(id), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf))) + return Error(r) +} + +type scardReaderState struct { + szReader uintptr + pvUserData uintptr + dwCurrentState uint32 + dwEventState uint32 + cbAtr uint32 + rgbAtr [36]byte +} + +func (rs *ReaderState) toSys() (scardReaderState, error) { + var sys scardReaderState + creader, err := encodestr(rs.Reader) + if err != nil { + return scardReaderState{}, err + } + sys.szReader = uintptr(creader.ptr()) + sys.dwCurrentState = uint32(rs.CurrentState) + sys.cbAtr = uint32(len(rs.Atr)) + copy(sys.rgbAtr[:], rs.Atr) + return sys, nil +} + +func (rs *ReaderState) update(sys *scardReaderState) { + rs.EventState = StateFlag(sys.dwEventState) + if sys.cbAtr > 0 { + rs.Atr = make([]byte, int(sys.cbAtr)) + copy(rs.Atr, sys.rgbAtr[:]) + } +} + +type strbuf []uint16 + +func encodestr(s string) (strbuf, error) { + utf16, err := syscall.UTF16FromString(s) + return strbuf(utf16), err +} + +func decodestr(buf strbuf) string { + return syscall.UTF16ToString(buf) +} diff --git a/vendor/github.com/ebfe/scard/zconst.go b/vendor/github.com/ebfe/scard/zconst.go new file mode 100644 index 000000000..675db21dc --- /dev/null +++ b/vendor/github.com/ebfe/scard/zconst.go @@ -0,0 +1,190 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs -- -I /usr/include/PCSC/ const.go + +package scard + +type Attrib uint32 + +const ( + AttrVendorName Attrib = 0x10100 + AttrVendorIfdType Attrib = 0x10101 + AttrVendorIfdVersion Attrib = 0x10102 + AttrVendorIfdSerialNo Attrib = 0x10103 + AttrChannelId Attrib = 0x20110 + AttrAsyncProtocolTypes Attrib = 0x30120 + AttrDefaultClk Attrib = 0x30121 + AttrMaxClk Attrib = 0x30122 + AttrDefaultDataRate Attrib = 0x30123 + AttrMaxDataRate Attrib = 0x30124 + AttrMaxIfsd Attrib = 0x30125 + AttrSyncProtocolTypes Attrib = 0x30126 + AttrPowerMgmtSupport Attrib = 0x40131 + AttrUserToCardAuthDevice Attrib = 0x50140 + AttrUserAuthInputDevice Attrib = 0x50142 + AttrCharacteristics Attrib = 0x60150 + AttrCurrentProtocolType Attrib = 0x80201 + AttrCurrentClk Attrib = 0x80202 + AttrCurrentF Attrib = 0x80203 + AttrCurrentD Attrib = 0x80204 + AttrCurrentN Attrib = 0x80205 + AttrCurrentW Attrib = 0x80206 + AttrCurrentIfsc Attrib = 0x80207 + AttrCurrentIfsd Attrib = 0x80208 + AttrCurrentBwt Attrib = 0x80209 + AttrCurrentCwt Attrib = 0x8020a + AttrCurrentEbcEncoding Attrib = 0x8020b + AttrExtendedBwt Attrib = 0x8020c + AttrIccPresence Attrib = 0x90300 + AttrIccInterfaceStatus Attrib = 0x90301 + AttrCurrentIoState Attrib = 0x90302 + AttrAtrString Attrib = 0x90303 + AttrIccTypePerAtr Attrib = 0x90304 + AttrEscReset Attrib = 0x7a000 + AttrEscCancel Attrib = 0x7a003 + AttrEscAuthrequest Attrib = 0x7a005 + AttrMaxinput Attrib = 0x7a007 + AttrDeviceUnit Attrib = 0x7fff0001 + AttrDeviceInUse Attrib = 0x7fff0002 + AttrDeviceFriendlyName Attrib = 0x7fff0003 + AttrDeviceSystemName Attrib = 0x7fff0004 + AttrSupressT1IfsRequest Attrib = 0x7fff0007 +) + +type Error uint32 + +const ( + ErrSuccess Error = 0x0 + ErrInternalError Error = 0x80100001 + ErrCancelled Error = 0x80100002 + ErrInvalidHandle Error = 0x80100003 + ErrInvalidParameter Error = 0x80100004 + ErrInvalidTarget Error = 0x80100005 + ErrNoMemory Error = 0x80100006 + ErrWaitedTooLong Error = 0x80100007 + ErrInsufficientBuffer Error = 0x80100008 + ErrUnknownReader Error = 0x80100009 + ErrTimeout Error = 0x8010000a + ErrSharingViolation Error = 0x8010000b + ErrNoSmartcard Error = 0x8010000c + ErrUnknownCard Error = 0x8010000d + ErrCantDispose Error = 0x8010000e + ErrProtoMismatch Error = 0x8010000f + ErrNotReady Error = 0x80100010 + ErrInvalidValue Error = 0x80100011 + ErrSystemCancelled Error = 0x80100012 + ErrCommError Error = 0x80100013 + ErrUnknownError Error = 0x80100014 + ErrInvalidAtr Error = 0x80100015 + ErrNotTransacted Error = 0x80100016 + ErrReaderUnavailable Error = 0x80100017 + ErrShutdown Error = 0x80100018 + ErrPciTooSmall Error = 0x80100019 + ErrReaderUnsupported Error = 0x8010001a + ErrDuplicateReader Error = 0x8010001b + ErrCardUnsupported Error = 0x8010001c + ErrNoService Error = 0x8010001d + ErrServiceStopped Error = 0x8010001e + ErrUnexpected Error = 0x8010001f + ErrUnsupportedFeature Error = 0x8010001f + ErrIccInstallation Error = 0x80100020 + ErrIccCreateorder Error = 0x80100021 + ErrFileNotFound Error = 0x80100024 + ErrNoDir Error = 0x80100025 + ErrNoFile Error = 0x80100026 + ErrNoAccess Error = 0x80100027 + ErrWriteTooMany Error = 0x80100028 + ErrBadSeek Error = 0x80100029 + ErrInvalidChv Error = 0x8010002a + ErrUnknownResMng Error = 0x8010002b + ErrNoSuchCertificate Error = 0x8010002c + ErrCertificateUnavailable Error = 0x8010002d + ErrNoReadersAvailable Error = 0x8010002e + ErrCommDataLost Error = 0x8010002f + ErrNoKeyContainer Error = 0x80100030 + ErrServerTooBusy Error = 0x80100031 + ErrUnsupportedCard Error = 0x80100065 + ErrUnresponsiveCard Error = 0x80100066 + ErrUnpoweredCard Error = 0x80100067 + ErrResetCard Error = 0x80100068 + ErrRemovedCard Error = 0x80100069 + ErrSecurityViolation Error = 0x8010006a + ErrWrongChv Error = 0x8010006b + ErrChvBlocked Error = 0x8010006c + ErrEof Error = 0x8010006d + ErrCancelledByUser Error = 0x8010006e + ErrCardNotAuthenticated Error = 0x8010006f +) + +type Protocol uint32 + +const ( + ProtocolUndefined Protocol = 0x0 + ProtocolT0 Protocol = 0x1 + ProtocolT1 Protocol = 0x2 + ProtocolAny Protocol = ProtocolT0 | ProtocolT1 +) + +type ShareMode uint32 + +const ( + ShareExclusive ShareMode = 0x1 + ShareShared ShareMode = 0x2 + ShareDirect ShareMode = 0x3 +) + +type Disposition uint32 + +const ( + LeaveCard Disposition = 0x0 + ResetCard Disposition = 0x1 + UnpowerCard Disposition = 0x2 + EjectCard Disposition = 0x3 +) + +type Scope uint32 + +const ( + ScopeUser Scope = 0x0 + ScopeTerminal Scope = 0x1 + ScopeSystem Scope = 0x2 +) + +type State uint32 + +const ( + Unknown State = 0x1 + Absent State = 0x2 + Present State = 0x4 + Swallowed State = 0x8 + Powered State = 0x10 + Negotiable State = 0x20 + Specific State = 0x40 +) + +type StateFlag uint32 + +const ( + StateUnaware StateFlag = 0x0 + StateIgnore StateFlag = 0x1 + StateChanged StateFlag = 0x2 + StateUnknown StateFlag = 0x4 + StateUnavailable StateFlag = 0x8 + StateEmpty StateFlag = 0x10 + StatePresent StateFlag = 0x20 + StateAtrmatch StateFlag = 0x40 + StateExclusive StateFlag = 0x80 + StateInuse StateFlag = 0x100 + StateMute StateFlag = 0x200 + StateUnpowered StateFlag = 0x400 +) + +const ( + maxBufferSize = 0x108 + maxBufferSizeExtended = 0x1000c + maxReadername = 0x80 + maxAtrSize = 0x21 +) + +const ( + infiniteTimeout = 0xffffffff +) diff --git a/vendor/github.com/tyler-smith/go-bip39/LICENSE b/vendor/github.com/tyler-smith/go-bip39/LICENSE new file mode 100644 index 000000000..44de214f0 --- /dev/null +++ b/vendor/github.com/tyler-smith/go-bip39/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Tyler Smith + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/tyler-smith/go-bip39/README.md b/vendor/github.com/tyler-smith/go-bip39/README.md new file mode 100644 index 000000000..11e62af1c --- /dev/null +++ b/vendor/github.com/tyler-smith/go-bip39/README.md @@ -0,0 +1,38 @@ +# go-bip39 + +A golang implementation of the BIP0039 spec for mnemonic seeds + + +## Credits + +English wordlist and test vectors are from the standard Python BIP0039 implementation +from the Trezor guys: [https://github.com/trezor/python-mnemonic](https://github.com/trezor/python-mnemonic) + +## Example + +```go +package main + +import ( + "github.com/tyler-smith/go-bip39" + "github.com/tyler-smith/go-bip32" + "fmt" +) + +func main(){ + // Generate a mnemonic for memorization or user-friendly seeds + entropy, _ := bip39.NewEntropy(256) + mnemonic, _ := bip39.NewMnemonic(entropy) + + // Generate a Bip32 HD wallet for the mnemonic and a user supplied password + seed := bip39.NewSeed(mnemonic, "Secret Passphrase") + + masterKey, _ := bip32.NewMasterKey(seed) + publicKey := masterKey.PublicKey() + + // Display mnemonic and keys + fmt.Println("Mnemonic: ", mnemonic) + fmt.Println("Master private key: ", masterKey) + fmt.Println("Master public key: ", publicKey) +} +``` diff --git a/vendor/github.com/tyler-smith/go-bip39/bip39.go b/vendor/github.com/tyler-smith/go-bip39/bip39.go new file mode 100644 index 000000000..4d281ba46 --- /dev/null +++ b/vendor/github.com/tyler-smith/go-bip39/bip39.go @@ -0,0 +1,249 @@ +package bip39 + +import ( + "crypto/rand" + "crypto/sha256" + "crypto/sha512" + "encoding/binary" + "errors" + "fmt" + "math/big" + "strings" + + "golang.org/x/crypto/pbkdf2" +) + +// Some bitwise operands for working with big.Ints +var ( + Last11BitsMask = big.NewInt(2047) + RightShift11BitsDivider = big.NewInt(2048) + BigOne = big.NewInt(1) + BigTwo = big.NewInt(2) +) + +// NewEntropy will create random entropy bytes +// so long as the requested size bitSize is an appropriate size. +func NewEntropy(bitSize int) ([]byte, error) { + err := validateEntropyBitSize(bitSize) + if err != nil { + return nil, err + } + + entropy := make([]byte, bitSize/8) + _, err = rand.Read(entropy) + return entropy, err +} + +// NewMnemonic will return a string consisting of the mnemonic words for +// the given entropy. +// If the provide entropy is invalid, an error will be returned. +func NewMnemonic(entropy []byte) (string, error) { + // Compute some lengths for convenience + entropyBitLength := len(entropy) * 8 + checksumBitLength := entropyBitLength / 32 + sentenceLength := (entropyBitLength + checksumBitLength) / 11 + + err := validateEntropyBitSize(entropyBitLength) + if err != nil { + return "", err + } + + // Add checksum to entropy + entropy = addChecksum(entropy) + + // Break entropy up into sentenceLength chunks of 11 bits + // For each word AND mask the rightmost 11 bits and find the word at that index + // Then bitshift entropy 11 bits right and repeat + // Add to the last empty slot so we can work with LSBs instead of MSB + + // Entropy as an int so we can bitmask without worrying about bytes slices + entropyInt := new(big.Int).SetBytes(entropy) + + // Slice to hold words in + words := make([]string, sentenceLength) + + // Throw away big int for AND masking + word := big.NewInt(0) + + for i := sentenceLength - 1; i >= 0; i-- { + // Get 11 right most bits and bitshift 11 to the right for next time + word.And(entropyInt, Last11BitsMask) + entropyInt.Div(entropyInt, RightShift11BitsDivider) + + // Get the bytes representing the 11 bits as a 2 byte slice + wordBytes := padByteSlice(word.Bytes(), 2) + + // Convert bytes to an index and add that word to the list + words[i] = WordList[binary.BigEndian.Uint16(wordBytes)] + } + + return strings.Join(words, " "), nil +} + +// MnemonicToByteArray takes a mnemonic string and turns it into a byte array +// suitable for creating another mnemonic. +// An error is returned if the mnemonic is invalid. +// FIXME +// This does not work for all values in +// the test vectors. Namely +// Vectors 0, 4, and 8. +// This is not really important because BIP39 doesnt really define a conversion +// from string to bytes. +func MnemonicToByteArray(mnemonic string) ([]byte, error) { + if IsMnemonicValid(mnemonic) == false { + return nil, fmt.Errorf("Invalid mnemonic") + } + mnemonicSlice := strings.Split(mnemonic, " ") + + bitSize := len(mnemonicSlice) * 11 + err := validateEntropyWithChecksumBitSize(bitSize) + if err != nil { + return nil, err + } + checksumSize := bitSize % 32 + + b := big.NewInt(0) + modulo := big.NewInt(2048) + for _, v := range mnemonicSlice { + index, found := ReverseWordMap[v] + if found == false { + return nil, fmt.Errorf("Word `%v` not found in reverse map", v) + } + add := big.NewInt(int64(index)) + b = b.Mul(b, modulo) + b = b.Add(b, add) + } + hex := b.Bytes() + checksumModulo := big.NewInt(0).Exp(big.NewInt(2), big.NewInt(int64(checksumSize)), nil) + entropy, _ := big.NewInt(0).DivMod(b, checksumModulo, big.NewInt(0)) + + entropyHex := entropy.Bytes() + + byteSize := bitSize/8 + 1 + if len(hex) != byteSize { + tmp := make([]byte, byteSize) + diff := byteSize - len(hex) + for i := 0; i < len(hex); i++ { + tmp[i+diff] = hex[i] + } + hex = tmp + } + + validationHex := addChecksum(entropyHex) + if len(validationHex) != byteSize { + tmp2 := make([]byte, byteSize) + diff2 := byteSize - len(validationHex) + for i := 0; i < len(validationHex); i++ { + tmp2[i+diff2] = validationHex[i] + } + validationHex = tmp2 + } + + if len(hex) != len(validationHex) { + panic("[]byte len mismatch - it shouldn't happen") + } + for i := range validationHex { + if hex[i] != validationHex[i] { + return nil, fmt.Errorf("Invalid byte at position %v", i) + } + } + return hex, nil +} + +// NewSeedWithErrorChecking creates a hashed seed output given the mnemonic string and a password. +// An error is returned if the mnemonic is not convertible to a byte array. +func NewSeedWithErrorChecking(mnemonic string, password string) ([]byte, error) { + _, err := MnemonicToByteArray(mnemonic) + if err != nil { + return nil, err + } + return NewSeed(mnemonic, password), nil +} + +// NewSeed creates a hashed seed output given a provided string and password. +// No checking is performed to validate that the string provided is a valid mnemonic. +func NewSeed(mnemonic string, password string) []byte { + return pbkdf2.Key([]byte(mnemonic), []byte("mnemonic"+password), 2048, 64, sha512.New) +} + +// Appends to data the first (len(data) / 32)bits of the result of sha256(data) +// Currently only supports data up to 32 bytes +func addChecksum(data []byte) []byte { + // Get first byte of sha256 + hasher := sha256.New() + hasher.Write(data) + hash := hasher.Sum(nil) + firstChecksumByte := hash[0] + + // len() is in bytes so we divide by 4 + checksumBitLength := uint(len(data) / 4) + + // For each bit of check sum we want we shift the data one the left + // and then set the (new) right most bit equal to checksum bit at that index + // staring from the left + dataBigInt := new(big.Int).SetBytes(data) + for i := uint(0); i < checksumBitLength; i++ { + // Bitshift 1 left + dataBigInt.Mul(dataBigInt, BigTwo) + + // Set rightmost bit if leftmost checksum bit is set + if uint8(firstChecksumByte&(1<<(7-i))) > 0 { + dataBigInt.Or(dataBigInt, BigOne) + } + } + + return dataBigInt.Bytes() +} + +func padByteSlice(slice []byte, length int) []byte { + newSlice := make([]byte, length-len(slice)) + return append(newSlice, slice...) +} + +func validateEntropyBitSize(bitSize int) error { + if (bitSize%32) != 0 || bitSize < 128 || bitSize > 256 { + return errors.New("Entropy length must be [128, 256] and a multiple of 32") + } + return nil +} + +func validateEntropyWithChecksumBitSize(bitSize int) error { + if (bitSize != 128+4) && (bitSize != 160+5) && (bitSize != 192+6) && (bitSize != 224+7) && (bitSize != 256+8) { + return fmt.Errorf("Wrong entropy + checksum size - expected %v, got %v", int((bitSize-bitSize%32)+(bitSize-bitSize%32)/32), bitSize) + } + return nil +} + +// IsMnemonicValid attempts to verify that the provided mnemonic is valid. +// Validity is determined by both the number of words being appropriate, +// and that all the words in the mnemonic are present in the word list. +func IsMnemonicValid(mnemonic string) bool { + // Create a list of all the words in the mnemonic sentence + words := strings.Fields(mnemonic) + + //Get num of words + numOfWords := len(words) + + // The number of words should be 12, 15, 18, 21 or 24 + if numOfWords%3 != 0 || numOfWords < 12 || numOfWords > 24 { + return false + } + + // Check if all words belong in the wordlist + for i := 0; i < numOfWords; i++ { + if !contains(WordList, words[i]) { + return false + } + } + + return true +} + +func contains(s []string, e string) bool { + for _, a := range s { + if a == e { + return true + } + } + return false +} diff --git a/vendor/github.com/tyler-smith/go-bip39/coverage.txt b/vendor/github.com/tyler-smith/go-bip39/coverage.txt new file mode 100644 index 000000000..7b1ce02f1 --- /dev/null +++ b/vendor/github.com/tyler-smith/go-bip39/coverage.txt @@ -0,0 +1,15 @@ + +github.com/CrowBits/go-bip39/bip39.go addChecksum 100.00% (11/11) +github.com/CrowBits/go-bip39/bip39.go IsMnemonicValid 100.00% (8/8) +github.com/CrowBits/go-bip39/bip39.go NewEntropy 100.00% (6/6) +github.com/CrowBits/go-bip39/bip39.go contains 100.00% (4/4) +github.com/CrowBits/go-bip39/bip39.go NewSeedWithErrorChecking 100.00% (4/4) +github.com/CrowBits/go-bip39/bip39.go validateEntropyBitSize 100.00% (3/3) +github.com/CrowBits/go-bip39/bip39.go validateEntropyWithChecksumBitSize 100.00% (3/3) +github.com/CrowBits/go-bip39/bip39.go padByteSlice 100.00% (2/2) +github.com/CrowBits/go-bip39/wordlist.go init 100.00% (2/2) +github.com/CrowBits/go-bip39/bip39.go NewSeed 100.00% (1/1) +github.com/CrowBits/go-bip39/bip39.go NewMnemonic 93.75% (15/16) +github.com/CrowBits/go-bip39/bip39.go MnemonicToByteArray 90.24% (37/41) +github.com/CrowBits/go-bip39 ---------------------------------- 95.05% (96/101) + diff --git a/vendor/github.com/tyler-smith/go-bip39/wordlist.go b/vendor/github.com/tyler-smith/go-bip39/wordlist.go new file mode 100644 index 000000000..aaed291c3 --- /dev/null +++ b/vendor/github.com/tyler-smith/go-bip39/wordlist.go @@ -0,0 +1,2067 @@ +package bip39 + +import ( + "strings" +) + +// The wordlist to use +var WordList = EnglishWordList + +var ReverseWordMap map[string]int = map[string]int{} + +func init() { + for i, v := range WordList { + ReverseWordMap[v] = i + } +} + +// Language-specific wordlists +var EnglishWordList = strings.Split(englishWordList, "\n") +var englishWordList = `abandon +ability +able +about +above +absent +absorb +abstract +absurd +abuse +access +accident +account +accuse +achieve +acid +acoustic +acquire +across +act +action +actor +actress +actual +adapt +add +addict +address +adjust +admit +adult +advance +advice +aerobic +affair +afford +afraid +again +age +agent +agree +ahead +aim +air +airport +aisle +alarm +album +alcohol +alert +alien +all +alley +allow +almost +alone +alpha +already +also +alter +always +amateur +amazing +among +amount +amused +analyst +anchor +ancient +anger +angle +angry +animal +ankle +announce +annual +another +answer +antenna +antique +anxiety +any +apart +apology +appear +apple +approve +april +arch +arctic +area +arena +argue +arm +armed +armor +army +around +arrange +arrest +arrive +arrow +art +artefact +artist +artwork +ask +aspect +assault +asset +assist +assume +asthma +athlete +atom +attack +attend +attitude +attract +auction +audit +august +aunt +author +auto +autumn +average +avocado +avoid +awake +aware +away +awesome +awful +awkward +axis +baby +bachelor +bacon +badge +bag +balance +balcony +ball +bamboo +banana +banner +bar +barely +bargain +barrel +base +basic +basket +battle +beach +bean +beauty +because +become +beef +before +begin +behave +behind +believe +below +belt +bench +benefit +best +betray +better +between +beyond +bicycle +bid +bike +bind +biology +bird +birth +bitter +black +blade +blame +blanket +blast +bleak +bless +blind +blood +blossom +blouse +blue +blur +blush +board +boat +body +boil +bomb +bone +bonus +book +boost +border +boring +borrow +boss +bottom +bounce +box +boy +bracket +brain +brand +brass +brave +bread +breeze +brick +bridge +brief +bright +bring +brisk +broccoli +broken +bronze +broom +brother +brown +brush +bubble +buddy +budget +buffalo +build +bulb +bulk +bullet +bundle +bunker +burden +burger +burst +bus +business +busy +butter +buyer +buzz +cabbage +cabin +cable +cactus +cage +cake +call +calm +camera +camp +can +canal +cancel +candy +cannon +canoe +canvas +canyon +capable +capital +captain +car +carbon +card +cargo +carpet +carry +cart +case +cash +casino +castle +casual +cat +catalog +catch +category +cattle +caught +cause +caution +cave +ceiling +celery +cement +census +century +cereal +certain +chair +chalk +champion +change +chaos +chapter +charge +chase +chat +cheap +check +cheese +chef +cherry +chest +chicken +chief +child +chimney +choice +choose +chronic +chuckle +chunk +churn +cigar +cinnamon +circle +citizen +city +civil +claim +clap +clarify +claw +clay +clean +clerk +clever +click +client +cliff +climb +clinic +clip +clock +clog +close +cloth +cloud +clown +club +clump +cluster +clutch +coach +coast +coconut +code +coffee +coil +coin +collect +color +column +combine +come +comfort +comic +common +company +concert +conduct +confirm +congress +connect +consider +control +convince +cook +cool +copper +copy +coral +core +corn +correct +cost +cotton +couch +country +couple +course +cousin +cover +coyote +crack +cradle +craft +cram +crane +crash +crater +crawl +crazy +cream +credit +creek +crew +cricket +crime +crisp +critic +crop +cross +crouch +crowd +crucial +cruel +cruise +crumble +crunch +crush +cry +crystal +cube +culture +cup +cupboard +curious +current +curtain +curve +cushion +custom +cute +cycle +dad +damage +damp +dance +danger +daring +dash +daughter +dawn +day +deal +debate +debris +decade +december +decide +decline +decorate +decrease +deer +defense +define +defy +degree +delay +deliver +demand +demise +denial +dentist +deny +depart +depend +deposit +depth +deputy +derive +describe +desert +design +desk +despair +destroy +detail +detect +develop +device +devote +diagram +dial +diamond +diary +dice +diesel +diet +differ +digital +dignity +dilemma +dinner +dinosaur +direct +dirt +disagree +discover +disease +dish +dismiss +disorder +display +distance +divert +divide +divorce +dizzy +doctor +document +dog +doll +dolphin +domain +donate +donkey +donor +door +dose +double +dove +draft +dragon +drama +drastic +draw +dream +dress +drift +drill +drink +drip +drive +drop +drum +dry +duck +dumb +dune +during +dust +dutch +duty +dwarf +dynamic +eager +eagle +early +earn +earth +easily +east +easy +echo +ecology +economy +edge +edit +educate +effort +egg +eight +either +elbow +elder +electric +elegant +element +elephant +elevator +elite +else +embark +embody +embrace +emerge +emotion +employ +empower +empty +enable +enact +end +endless +endorse +enemy +energy +enforce +engage +engine +enhance +enjoy +enlist +enough +enrich +enroll +ensure +enter +entire +entry +envelope +episode +equal +equip +era +erase +erode +erosion +error +erupt +escape +essay +essence +estate +eternal +ethics +evidence +evil +evoke +evolve +exact +example +excess +exchange +excite +exclude +excuse +execute +exercise +exhaust +exhibit +exile +exist +exit +exotic +expand +expect +expire +explain +expose +express +extend +extra +eye +eyebrow +fabric +face +faculty +fade +faint +faith +fall +false +fame +family +famous +fan +fancy +fantasy +farm +fashion +fat +fatal +father +fatigue +fault +favorite +feature +february +federal +fee +feed +feel +female +fence +festival +fetch +fever +few +fiber +fiction +field +figure +file +film +filter +final +find +fine +finger +finish +fire +firm +first +fiscal +fish +fit +fitness +fix +flag +flame +flash +flat +flavor +flee +flight +flip +float +flock +floor +flower +fluid +flush +fly +foam +focus +fog +foil +fold +follow +food +foot +force +forest +forget +fork +fortune +forum +forward +fossil +foster +found +fox +fragile +frame +frequent +fresh +friend +fringe +frog +front +frost +frown +frozen +fruit +fuel +fun +funny +furnace +fury +future +gadget +gain +galaxy +gallery +game +gap +garage +garbage +garden +garlic +garment +gas +gasp +gate +gather +gauge +gaze +general +genius +genre +gentle +genuine +gesture +ghost +giant +gift +giggle +ginger +giraffe +girl +give +glad +glance +glare +glass +glide +glimpse +globe +gloom +glory +glove +glow +glue +goat +goddess +gold +good +goose +gorilla +gospel +gossip +govern +gown +grab +grace +grain +grant +grape +grass +gravity +great +green +grid +grief +grit +grocery +group +grow +grunt +guard +guess +guide +guilt +guitar +gun +gym +habit +hair +half +hammer +hamster +hand +happy +harbor +hard +harsh +harvest +hat +have +hawk +hazard +head +health +heart +heavy +hedgehog +height +hello +helmet +help +hen +hero +hidden +high +hill +hint +hip +hire +history +hobby +hockey +hold +hole +holiday +hollow +home +honey +hood +hope +horn +horror +horse +hospital +host +hotel +hour +hover +hub +huge +human +humble +humor +hundred +hungry +hunt +hurdle +hurry +hurt +husband +hybrid +ice +icon +idea +identify +idle +ignore +ill +illegal +illness +image +imitate +immense +immune +impact +impose +improve +impulse +inch +include +income +increase +index +indicate +indoor +industry +infant +inflict +inform +inhale +inherit +initial +inject +injury +inmate +inner +innocent +input +inquiry +insane +insect +inside +inspire +install +intact +interest +into +invest +invite +involve +iron +island +isolate +issue +item +ivory +jacket +jaguar +jar +jazz +jealous +jeans +jelly +jewel +job +join +joke +journey +joy +judge +juice +jump +jungle +junior +junk +just +kangaroo +keen +keep +ketchup +key +kick +kid +kidney +kind +kingdom +kiss +kit +kitchen +kite +kitten +kiwi +knee +knife +knock +know +lab +label +labor +ladder +lady +lake +lamp +language +laptop +large +later +latin +laugh +laundry +lava +law +lawn +lawsuit +layer +lazy +leader +leaf +learn +leave +lecture +left +leg +legal +legend +leisure +lemon +lend +length +lens +leopard +lesson +letter +level +liar +liberty +library +license +life +lift +light +like +limb +limit +link +lion +liquid +list +little +live +lizard +load +loan +lobster +local +lock +logic +lonely +long +loop +lottery +loud +lounge +love +loyal +lucky +luggage +lumber +lunar +lunch +luxury +lyrics +machine +mad +magic +magnet +maid +mail +main +major +make +mammal +man +manage +mandate +mango +mansion +manual +maple +marble +march +margin +marine +market +marriage +mask +mass +master +match +material +math +matrix +matter +maximum +maze +meadow +mean +measure +meat +mechanic +medal +media +melody +melt +member +memory +mention +menu +mercy +merge +merit +merry +mesh +message +metal +method +middle +midnight +milk +million +mimic +mind +minimum +minor +minute +miracle +mirror +misery +miss +mistake +mix +mixed +mixture +mobile +model +modify +mom +moment +monitor +monkey +monster +month +moon +moral +more +morning +mosquito +mother +motion +motor +mountain +mouse +move +movie +much +muffin +mule +multiply +muscle +museum +mushroom +music +must +mutual +myself +mystery +myth +naive +name +napkin +narrow +nasty +nation +nature +near +neck +need +negative +neglect +neither +nephew +nerve +nest +net +network +neutral +never +news +next +nice +night +noble +noise +nominee +noodle +normal +north +nose +notable +note +nothing +notice +novel +now +nuclear +number +nurse +nut +oak +obey +object +oblige +obscure +observe +obtain +obvious +occur +ocean +october +odor +off +offer +office +often +oil +okay +old +olive +olympic +omit +once +one +onion +online +only +open +opera +opinion +oppose +option +orange +orbit +orchard +order +ordinary +organ +orient +original +orphan +ostrich +other +outdoor +outer +output +outside +oval +oven +over +own +owner +oxygen +oyster +ozone +pact +paddle +page +pair +palace +palm +panda +panel +panic +panther +paper +parade +parent +park +parrot +party +pass +patch +path +patient +patrol +pattern +pause +pave +payment +peace +peanut +pear +peasant +pelican +pen +penalty +pencil +people +pepper +perfect +permit +person +pet +phone +photo +phrase +physical +piano +picnic +picture +piece +pig +pigeon +pill +pilot +pink +pioneer +pipe +pistol +pitch +pizza +place +planet +plastic +plate +play +please +pledge +pluck +plug +plunge +poem +poet +point +polar +pole +police +pond +pony +pool +popular +portion +position +possible +post +potato +pottery +poverty +powder +power +practice +praise +predict +prefer +prepare +present +pretty +prevent +price +pride +primary +print +priority +prison +private +prize +problem +process +produce +profit +program +project +promote +proof +property +prosper +protect +proud +provide +public +pudding +pull +pulp +pulse +pumpkin +punch +pupil +puppy +purchase +purity +purpose +purse +push +put +puzzle +pyramid +quality +quantum +quarter +question +quick +quit +quiz +quote +rabbit +raccoon +race +rack +radar +radio +rail +rain +raise +rally +ramp +ranch +random +range +rapid +rare +rate +rather +raven +raw +razor +ready +real +reason +rebel +rebuild +recall +receive +recipe +record +recycle +reduce +reflect +reform +refuse +region +regret +regular +reject +relax +release +relief +rely +remain +remember +remind +remove +render +renew +rent +reopen +repair +repeat +replace +report +require +rescue +resemble +resist +resource +response +result +retire +retreat +return +reunion +reveal +review +reward +rhythm +rib +ribbon +rice +rich +ride +ridge +rifle +right +rigid +ring +riot +ripple +risk +ritual +rival +river +road +roast +robot +robust +rocket +romance +roof +rookie +room +rose +rotate +rough +round +route +royal +rubber +rude +rug +rule +run +runway +rural +sad +saddle +sadness +safe +sail +salad +salmon +salon +salt +salute +same +sample +sand +satisfy +satoshi +sauce +sausage +save +say +scale +scan +scare +scatter +scene +scheme +school +science +scissors +scorpion +scout +scrap +screen +script +scrub +sea +search +season +seat +second +secret +section +security +seed +seek +segment +select +sell +seminar +senior +sense +sentence +series +service +session +settle +setup +seven +shadow +shaft +shallow +share +shed +shell +sheriff +shield +shift +shine +ship +shiver +shock +shoe +shoot +shop +short +shoulder +shove +shrimp +shrug +shuffle +shy +sibling +sick +side +siege +sight +sign +silent +silk +silly +silver +similar +simple +since +sing +siren +sister +situate +six +size +skate +sketch +ski +skill +skin +skirt +skull +slab +slam +sleep +slender +slice +slide +slight +slim +slogan +slot +slow +slush +small +smart +smile +smoke +smooth +snack +snake +snap +sniff +snow +soap +soccer +social +sock +soda +soft +solar +soldier +solid +solution +solve +someone +song +soon +sorry +sort +soul +sound +soup +source +south +space +spare +spatial +spawn +speak +special +speed +spell +spend +sphere +spice +spider +spike +spin +spirit +split +spoil +sponsor +spoon +sport +spot +spray +spread +spring +spy +square +squeeze +squirrel +stable +stadium +staff +stage +stairs +stamp +stand +start +state +stay +steak +steel +stem +step +stereo +stick +still +sting +stock +stomach +stone +stool +story +stove +strategy +street +strike +strong +struggle +student +stuff +stumble +style +subject +submit +subway +success +such +sudden +suffer +sugar +suggest +suit +summer +sun +sunny +sunset +super +supply +supreme +sure +surface +surge +surprise +surround +survey +suspect +sustain +swallow +swamp +swap +swarm +swear +sweet +swift +swim +swing +switch +sword +symbol +symptom +syrup +system +table +tackle +tag +tail +talent +talk +tank +tape +target +task +taste +tattoo +taxi +teach +team +tell +ten +tenant +tennis +tent +term +test +text +thank +that +theme +then +theory +there +they +thing +this +thought +three +thrive +throw +thumb +thunder +ticket +tide +tiger +tilt +timber +time +tiny +tip +tired +tissue +title +toast +tobacco +today +toddler +toe +together +toilet +token +tomato +tomorrow +tone +tongue +tonight +tool +tooth +top +topic +topple +torch +tornado +tortoise +toss +total +tourist +toward +tower +town +toy +track +trade +traffic +tragic +train +transfer +trap +trash +travel +tray +treat +tree +trend +trial +tribe +trick +trigger +trim +trip +trophy +trouble +truck +true +truly +trumpet +trust +truth +try +tube +tuition +tumble +tuna +tunnel +turkey +turn +turtle +twelve +twenty +twice +twin +twist +two +type +typical +ugly +umbrella +unable +unaware +uncle +uncover +under +undo +unfair +unfold +unhappy +uniform +unique +unit +universe +unknown +unlock +until +unusual +unveil +update +upgrade +uphold +upon +upper +upset +urban +urge +usage +use +used +useful +useless +usual +utility +vacant +vacuum +vague +valid +valley +valve +van +vanish +vapor +various +vast +vault +vehicle +velvet +vendor +venture +venue +verb +verify +version +very +vessel +veteran +viable +vibrant +vicious +victory +video +view +village +vintage +violin +virtual +virus +visa +visit +visual +vital +vivid +vocal +voice +void +volcano +volume +vote +voyage +wage +wagon +wait +walk +wall +walnut +want +warfare +warm +warrior +wash +wasp +waste +water +wave +way +wealth +weapon +wear +weasel +weather +web +wedding +weekend +weird +welcome +west +wet +whale +what +wheat +wheel +when +where +whip +whisper +wide +width +wife +wild +will +win +window +wine +wing +wink +winner +winter +wire +wisdom +wise +wish +witness +wolf +woman +wonder +wood +wool +word +work +world +worry +worth +wrap +wreck +wrestle +wrist +write +wrong +yard +year +yellow +you +young +youth +zebra +zero +zone +zoo` diff --git a/vendor/vendor.json b/vendor/vendor.json index c08278c3b..f222d95dc 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -104,6 +104,12 @@ "revisionTime": "2018-06-25T18:44:42Z" }, { + "checksumSHA1": "B1sVd5XOmjuSFYivGhBd+vPlc1w=", + "path": "github.com/ebfe/scard", + "revision": "0147d7ead790ac8a5ecc91ee6de68beb7b17c4e9", + "revisionTime": "2017-12-31T19:32:11Z" + }, + { "checksumSHA1": "zYnPsNAVm1/ViwCkN++dX2JQhBo=", "path": "github.com/edsrzf/mmap-go", "revision": "935e0e8a636ca4ba70b713f3e38a19e1b77739e8", @@ -616,6 +622,18 @@ "revisionTime": "2018-06-15T20:27:29Z" }, { + "checksumSHA1": "vW7IiPtoA4hQQ/ScHlbmRktY89U=", + "path": "github.com/tyler-smith/go-bip39", + "revision": "8e7a99b3e716f36d3b080a9a70f9eb45abe4edcc", + "revisionTime": "2016-06-29T16:38:56Z" + }, + { + "checksumSHA1": "GLCPuvePAkWT+opcWq3mNdhOfGM=", + "path": "github.com/wsddn/go-ecdh", + "revision": "48726bab92085232373de4ec5c51ce7b441c63a0", + "revisionTime": "2016-12-11T03:23:59Z" + }, + { "checksumSHA1": "TT1rac6kpQp2vz24m5yDGUNQ/QQ=", "path": "golang.org/x/crypto/cast5", "revision": "ff983b9c42bc9fbf91556e191cc8efb585c16908", |