1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

Make previous auth-source change not break on Windows without gnutls

* lisp/auth-source.el (auth-source--obfuscate)
(auth-source--deobfuscate): Check that gnutls is really available.
This commit is contained in:
Lars Ingebrigtsen 2019-09-20 22:18:10 +02:00
parent 46b49d9ece
commit 76c14b7191

View File

@ -1168,7 +1168,8 @@ FILE is the file from which we obtained this token."
(setq auth-source--session-nonce
(apply #'string (cl-loop repeat 10
collect (random 128)))))
(if (fboundp 'gnutls-symmetric-encrypt)
(if (and (fboundp 'gnutls-symmetric-encrypt)
(gnutls-available-p))
(let ((cdata (car (last (gnutls-ciphers)))))
(mapconcat
#'base64-encode-string
@ -1188,7 +1189,8 @@ FILE is the file from which we obtained this token."
(concat s (make-string (- length (mod (length s) length)) ?\0)))
(defun auth-source--deobfuscate (data)
(if (fboundp 'gnutls-symmetric-encrypt)
(if (and (fboundp 'gnutls-symmetric-encrypt)
(gnutls-available-p))
(let ((cdata (car (last (gnutls-ciphers))))
(bits (split-string data "-")))
(substring