Skip to content

Commit

Permalink
whitespace changes
Browse files Browse the repository at this point in the history
  • Loading branch information
joonas-fi committed Oct 8, 2024
1 parent 168ace4 commit e9d0c6a
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 23 deletions.
3 changes: 2 additions & 1 deletion app/evdev/evdev.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import (

// https://github.com/gvalkov/golang-evdev implements what we do, but requires Cgo

/* Hunting the numeric code for EVIOCGRAB was an absolute pain (none of these specify it legibly):
/*
Hunting the numeric code for EVIOCGRAB was an absolute pain (none of these specify it legibly):
- https://github.com/gvalkov/golang-evdev/search?q=EVIOCGRAB&unscoped_q=EVIOCGRAB
- https://github.com/pfirpfel/node-exclusive-keyboard/blob/master/lib/eviocgrab.cpp
Expand Down
3 changes: 2 additions & 1 deletion app/evdev/numpad.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package evdev

// represents numpad key's meaning for both on and off cases for num lock
// https://en.wikipedia.org/wiki/Num_Lock
//
// https://en.wikipedia.org/wiki/Num_Lock
type numpadKeyPair struct {
withNumLock KeyOrButton
withoutNumLock KeyOrButton
Expand Down
13 changes: 7 additions & 6 deletions crypto/pkencryptedstream/stream.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Use public key crypto to encrypt a data stream in a way, that the encrypting party can
// not necessarily decrypt the same data (unless she possesses the private key as well).
//
// DEPRECATED: this provides confidentiality, but is malleable (ciphertext is not authenticated)
// use Age instead
// DEPRECATED: this provides confidentiality, but is malleable (ciphertext is not authenticated).
// use Age instead.
package pkencryptedstream

/* Public key (RSA) encrypted stream:
Expand Down Expand Up @@ -87,10 +87,11 @@ var (
)

// Format:
// <len of below envelope>
// <encrypted AES key envelope: RSA-OAEP-SHA256>
// <iv>
// <ciphertext stream>
//
// <len of below envelope>
// <encrypted AES key envelope: RSA-OAEP-SHA256>
// <iv>
// <ciphertext stream>
func Writer(destination io.Writer, pubKey *rsa.PublicKey) (io.WriteCloser, error) {
// generate new 256-bit AES key
aesKey := make([]byte, aes256KeyBytes)
Expand Down
3 changes: 2 additions & 1 deletion crypto/storedpassword/serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (

// format: $<strategyId>$<salt>$<derived>
// trying to be somewhat compatible with
// https://passlib.readthedocs.io/en/stable/modular_crypt_format.html#application-defined-hashes
// https://passlib.readthedocs.io/en/stable/modular_crypt_format.html#application-defined-hashes
//
// with the exception that we're storing the cost in the <strategyId> so that we don't have
// to implement different parsing formats per strategy
type StoredPassword string
Expand Down
2 changes: 1 addition & 1 deletion crypto/storedpassword/storeandverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Store(plaintext string, strategy DerivationStrategy) (StoredPassword, error

// 1st return: if != "" is the upgraded version of the stored password, if upgraded DerivationStrategy found
// 2nd return: nil if hash matches and no internal errors occurred.
// ErrIncorrectPassword if no internal errors but hash doesn't match.
// ErrIncorrectPassword if no internal errors but hash doesn't match.
//
// this function is safe from timing attacks
func Verify(stored StoredPassword, givenPlaintext string, resolver StrategyResolver) (StoredPassword, error) {
Expand Down
16 changes: 9 additions & 7 deletions os/user/userutil/privileges_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ type UnprivilegedUser interface {
// same as DropToUnprivilegedUser() but UnprivilegedUser is only an optional outcome, the only thing
// guaranteed is PrivilegedWork. this means that:
//
// - we definitely can elevate
// - but we might not be running as unprivileged user (we were not run under '$ sudo' so we cannot
// jump between unprivileged and privileged contexts)
// - we definitely can elevate
// - but we might not be running as unprivileged user (we were not run under '$ sudo' so we cannot
// jump between unprivileged and privileged contexts)
//
// WARNING: this alters global process state, so you shouldn't be doing anything concurrent.
// (at least where the different operations would be bothered by running in different security context)
Expand Down Expand Up @@ -170,13 +170,15 @@ func (r *runningUnderSudo) AsRoot(work func(ProofOfRunningAsRoot) error) error {
// this is useful for e.g. writing user's owned file on directory only root can write to.
//
// Running a process as root, before this function call (from /proc/self/status):
// Uid: 0 0 0 0
//
// (values are: "Real, effective, saved set, and filesystem UIDs")
// https://man7.org/linux/man-pages/man5/proc.5.html
// Uid: 0 0 0 0
//
// (values are: "Real, effective, saved set, and filesystem UIDs")
// https://man7.org/linux/man-pages/man5/proc.5.html
//
// After this function call:
// Uid: 0 1000 0 1000
//
// Uid: 0 1000 0 1000
//
// => makes changes to (drops privileges of):
// - Real : ☐
Expand Down
2 changes: 1 addition & 1 deletion sync/syncutil/mutexmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// When you TryLock():
// a) it won't open if it's already occupied. (because it's locked inside) decide to do something else
// b) it opens and you get in and the stall gets reserved/locked for you. When you get out
// you call the unlock callback you obtained from TryLock() to return the stall for use.
// you call the unlock callback you obtained from TryLock() to return the stall for use.
type MutexMap struct {
// value is chan that Lock() can use to listen for unlock event (close of channel)
locks map[string]chan bool
Expand Down
10 changes: 5 additions & 5 deletions sync/taskrunner/taskrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// Works similar to golang.org/x/sync/errgroup but provides richer logging (tasks are
// named) and errors
//
// - The tasks are expected to run forever, until context cancellation (e.g. task stopping
// before cancellation even with nil error is considered an error).
// - If any of the tasks fail, sibling tasks are canceled as well.
// - The tasks are expected to run forever, until context cancellation (e.g. task stopping
// before cancellation even with nil error is considered an error).
// - If any of the tasks fail, sibling tasks are canceled as well.
package taskrunner

import (
Expand Down Expand Up @@ -76,8 +76,8 @@ func (t *Runner) Done() <-chan error {
// - err if any of the tasks exited unexpectedly or exit was expected but errored
//
// NOTE: don't have multiple goroutines concurrently use Done() or Wait(). i.e. you can
// call Done() and even after that call Wait(), but don't do it concurrently (the
// channel only sends one value)
// call Done() and even after that call Wait(), but don't do it concurrently (the
// channel only sends one value)
func (t *Runner) Wait() error {
return <-t.Done()
}
Expand Down

0 comments on commit e9d0c6a

Please sign in to comment.