mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
tests: Avoid overflowing signed 32 bit time_t.
* tests/openpgp/quick-key-manipulation.scm: Use expiration times in the year 2038 instead of 2105 to avoid overflowing 32 bit time_t. time_t is used internally to parse the expiraton time from the iso timestamp. GnuPG-bug-id: 2988 Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
176e07ce10
commit
de3838372a
@ -125,8 +125,13 @@
|
|||||||
(default default never)
|
(default default never)
|
||||||
(rsa "sign auth encr" "seconds=600") ;; GPGME uses this
|
(rsa "sign auth encr" "seconds=600") ;; GPGME uses this
|
||||||
(rsa "auth,encr" "2") ;; "without a letter, days is assumed"
|
(rsa "auth,encr" "2") ;; "without a letter, days is assumed"
|
||||||
(rsa "sign" "2105-01-01") ;; "last year GnuPG can represent is 2105"
|
;; Sadly, the timestamp is truncated by the use of time_t on
|
||||||
(rsa "sign" "21050101T115500") ;; "last year GnuPG can represent is 2105"
|
;; systems where time_t is a signed 32 bit value.
|
||||||
|
(rsa "sign" "2038-01-01") ;; unix millennium
|
||||||
|
(rsa "sign" "20380101T115500") ;; unix millennium
|
||||||
|
;; Once fixed, we can use later timestamps:
|
||||||
|
;; (rsa "sign" "2105-01-01") ;; "last year GnuPG can represent is 2105"
|
||||||
|
;; (rsa "sign" "21050101T115500") ;; "last year GnuPG can represent is 2105"
|
||||||
(rsa sign "2d")
|
(rsa sign "2d")
|
||||||
(rsa1024 sign "2w")
|
(rsa1024 sign "2w")
|
||||||
(rsa2048 encr "2m")
|
(rsa2048 encr "2m")
|
||||||
@ -157,7 +162,8 @@
|
|||||||
(lambda (subkey)
|
(lambda (subkey)
|
||||||
(assert (= 1 (:alg subkey)))
|
(assert (= 1 (:alg subkey)))
|
||||||
(assert (string-contains? (:cap subkey) "s"))
|
(assert (string-contains? (:cap subkey) "s"))
|
||||||
(assert (time-matches? 4260207600 ;; 2105-01-01
|
(assert (time-matches? 2145916800 ;; 2038-01-01
|
||||||
|
;; 4260207600 ;; 2105-01-01
|
||||||
(string->number (:expire subkey))
|
(string->number (:expire subkey))
|
||||||
;; This is off by 12h, but I guess it just
|
;; This is off by 12h, but I guess it just
|
||||||
;; choses the middle of the day.
|
;; choses the middle of the day.
|
||||||
@ -165,7 +171,8 @@
|
|||||||
(lambda (subkey)
|
(lambda (subkey)
|
||||||
(assert (= 1 (:alg subkey)))
|
(assert (= 1 (:alg subkey)))
|
||||||
(assert (string-contains? (:cap subkey) "s"))
|
(assert (string-contains? (:cap subkey) "s"))
|
||||||
(assert (time-matches? 4260254100 ;; UTC 2105-01-01 11:55:00
|
(assert (time-matches? 2145959700 ;; UTC 2038-01-01 11:55:00
|
||||||
|
;; 4260254100 ;; UTC 2105-01-01 11:55:00
|
||||||
(string->number (:expire subkey))
|
(string->number (:expire subkey))
|
||||||
(minutes->seconds 5))))
|
(minutes->seconds 5))))
|
||||||
(lambda (subkey)
|
(lambda (subkey)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user