Added spare byte for later expansion to allow other cipher modes
This commit is contained in:
@@ -82,7 +82,8 @@ func (ep EP) GetOverhead() int {
|
||||
|
||||
const (
|
||||
CheckEnd = 4
|
||||
NonceEnd = CheckEnd + nonce.IVLen
|
||||
TypeEnd = CheckEnd + 1
|
||||
NonceEnd = TypeEnd + nonce.IVLen
|
||||
AddressEnd = NonceEnd + address.Len
|
||||
SigEnd = AddressEnd + sig.Len
|
||||
)
|
||||
@@ -122,7 +123,7 @@ func Encode(ep EP) (pkt []byte, e error) {
|
||||
return
|
||||
}
|
||||
// Copy nonce, address, check and signature over top of the header.
|
||||
copy(pkt[CheckEnd:NonceEnd], nonc)
|
||||
copy(pkt[TypeEnd:NonceEnd], nonc)
|
||||
copy(pkt[NonceEnd:AddressEnd], to)
|
||||
copy(pkt[AddressEnd:SigEnd], s)
|
||||
// last bot not least, the packet check header, which protects the
|
||||
@@ -188,7 +189,7 @@ func Decode(d []byte, from *pub.Key, to *prv.Key) (f *Packet, e error) {
|
||||
f = &Packet{}
|
||||
// copy the nonce
|
||||
nonc := make(nonce.IV, nonce.IVLen)
|
||||
copy(nonc, d[CheckEnd:NonceEnd])
|
||||
copy(nonc, d[TypeEnd:NonceEnd])
|
||||
var blk cipher.Block
|
||||
if blk, e = ciph.GetBlock(to, from); check(e) {
|
||||
return
|
||||
@@ -205,6 +206,5 @@ func Decode(d []byte, from *pub.Key, to *prv.Key) (f *Packet, e error) {
|
||||
f.Length = uint32(slice.DecodeUint32(length))
|
||||
f.Parity, data = data[0], data[1:]
|
||||
f.Data = data
|
||||
// log.I.Ln("decode length", len(data), "length prefix", f.Length)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ var (
|
||||
// GitRef is the gitref, as in refs/heads/branchname.
|
||||
GitRef = "refs/heads/main"
|
||||
// ParentGitCommit is the commit hash of the parent HEAD.
|
||||
ParentGitCommit = "5c1f1576c659aaa80aef70aad02d4a01e15b7030"
|
||||
ParentGitCommit = "f0baa3a4880e7f90b83a6766ef593193a44aa5b2"
|
||||
// BuildTime stores the time when the current binary was built.
|
||||
BuildTime = "2022-12-10T09:50:44+01:00"
|
||||
BuildTime = "2022-12-10T10:22:12+01:00"
|
||||
// SemVer lists the (latest) git tag on the build.
|
||||
SemVer = "v0.0.166"
|
||||
SemVer = "v0.0.167"
|
||||
// PathBase is the path base returned from runtime caller.
|
||||
PathBase = "/home/loki/src/github.com/Indra-Labs/indra/"
|
||||
// Major is the major number from the tag.
|
||||
@@ -25,7 +25,7 @@ var (
|
||||
// Minor is the minor number from the tag.
|
||||
Minor = 0
|
||||
// Patch is the patch version number from the tag.
|
||||
Patch = 166
|
||||
Patch = 167
|
||||
)
|
||||
|
||||
// Version returns a pretty printed version information string.
|
||||
|
||||
Reference in New Issue
Block a user