2019-05-15 13:40:19 +02:00
|
|
|
// Package crypto provides a high-level API for common OpenPGP functionality.
|
2018-09-11 11:09:28 +02:00
|
|
|
package crypto
|
2018-06-04 16:05:14 -07:00
|
|
|
|
2021-10-18 11:33:02 +02:00
|
|
|
import "sync"
|
|
|
|
|
|
2019-05-15 13:40:19 +02:00
|
|
|
// GopenPGP is used as a "namespace" for many of the functions in this package.
|
|
|
|
|
// It is a struct that keeps track of time skew between server and client.
|
2019-05-14 18:05:01 +02:00
|
|
|
type GopenPGP struct {
|
2018-06-04 17:50:26 -07:00
|
|
|
latestServerTime int64
|
2020-12-01 19:44:49 +01:00
|
|
|
generationOffset int64
|
2021-10-19 08:09:59 +02:00
|
|
|
lock *sync.RWMutex
|
2018-06-04 16:05:14 -07:00
|
|
|
}
|
2019-10-22 18:44:45 +02:00
|
|
|
|
2021-10-18 11:33:02 +02:00
|
|
|
var pgp = GopenPGP{
|
|
|
|
|
latestServerTime: 0,
|
|
|
|
|
generationOffset: 0,
|
2021-10-19 08:09:59 +02:00
|
|
|
lock: &sync.RWMutex{},
|
2021-10-18 11:33:02 +02:00
|
|
|
}
|
2020-04-08 11:11:16 +02:00
|
|
|
|
|
|
|
|
// clone returns a clone of the byte slice. Internal function used to make sure
|
|
|
|
|
// we don't retain a reference to external data.
|
|
|
|
|
func clone(input []byte) []byte {
|
|
|
|
|
data := make([]byte, len(input))
|
|
|
|
|
copy(data, input)
|
|
|
|
|
return data
|
|
|
|
|
}
|