mirror of
https://github.com/Picocrypt/CLI.git
synced 2026-03-11 14:44:23 +00:00
check for rand.Read errors and panic
Unlikely to happen but make sure to panic if rand.Read fails otherwise values may be zeroed arrays
This commit is contained in:
parent
81f37498ce
commit
adc0f34eac
2 changed files with 13 additions and 5 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
|||
2.06
|
||||
2.07
|
||||
|
|
@ -355,10 +355,18 @@ func work() int {
|
|||
flags[4] = 1
|
||||
}
|
||||
_, errs[2] = fout.Write(rsEncode(rs5, flags))
|
||||
rand.Read(salt)
|
||||
rand.Read(hkdfSalt)
|
||||
rand.Read(serpentIV)
|
||||
rand.Read(nonce)
|
||||
if _, err := rand.Read(salt); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if _, err := rand.Read(hkdfSalt); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if _, err := rand.Read(serpentIV); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if _, err := rand.Read(nonce); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
_, errs[3] = fout.Write(rsEncode(rs16, salt))
|
||||
_, errs[4] = fout.Write(rsEncode(rs32, hkdfSalt))
|
||||
_, errs[5] = fout.Write(rsEncode(rs16, serpentIV))
|
||||
|
|
|
|||
Loading…
Reference in a new issue