Skip to content

Commit

Permalink
Check whether secure-hash function is defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikazuhiro committed Apr 23, 2014
1 parent 8e0feca commit 87a5fec
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
11 changes: 11 additions & 0 deletions ChangeLog
@@ -1,3 +1,14 @@
2014-04-23 Kazuhiro Ito <kzhr@d1.dion.ne.jp>

* FLIM-ELS: Check whether secure-hash function is defined.
Cf. https://github.com/ikazuhiro/flim/commit/85bbe382c4812fd041207aa727acba8ece2e7a39#commitcomment-6082738

* hmac-md5.el: Likewise.

* hmac-sha1.el: Likewise.

* sha1.el (TOP, sha1-dl-module): Likewise.

2014-04-15 Kazuhiro Ito <kzhr@d1.dion.ne.jp>

* FLIM-ELS: Install sha1-el.el when dynamic-link is available and
Expand Down
3 changes: 2 additions & 1 deletion FLIM-ELS
Expand Up @@ -40,7 +40,8 @@
(setq hmac-modules (cons 'md5-el hmac-modules))))

(unless (and (fboundp 'sha1)
(or (subrp (symbol-function 'secure-hash))
(or (and (fboundp 'secure-hash)
(subrp (symbol-function 'secure-hash)))
(subrp (symbol-function 'sha1))))
(when (fboundp 'dynamic-link)
(setq hmac-modules (cons 'sha1-dl hmac-modules)))
Expand Down
3 changes: 2 additions & 1 deletion hmac-md5.el
Expand Up @@ -72,7 +72,8 @@
((fboundp 'md5-binary)
;; do nothing.
)
((subrp (symbol-function 'secure-hash))
((and (fboundp 'secure-hash)
(subrp (symbol-function 'secure-hash)))
(defun md5-binary (string)
"Return the MD5 of STRING in binary form."
(secure-hash 'md5 string nil nil t)))
Expand Down
3 changes: 2 additions & 1 deletion hmac-sha1.el
Expand Up @@ -72,7 +72,8 @@
((fboundp 'sha1-binary)
;; do nothing.
)
((subrp (symbol-function 'secure-hash))
((and (fboundp 'secure-hash)
(subrp (symbol-function 'secure-hash)))
(defun sha1-binary (string)
"Return the SHA1 of STRING in binary form."
(secure-hash 'sha1 string nil nil t)))
Expand Down
6 changes: 4 additions & 2 deletions sha1.el
Expand Up @@ -41,7 +41,8 @@
(defvar sha1-dl-module
(cond
((and (fboundp 'sha1)
(or (subrp (symbol-function 'secure-hash))
(or (and (fboundp 'secure-hash)
(subrp (symbol-function 'secure-hash)))
(subrp (symbol-function 'sha1))))
nil)
((fboundp 'dynamic-link)
Expand All @@ -55,7 +56,8 @@

(cond
((and (fboundp 'sha1)
(or (subrp (symbol-function 'secure-hash))
(or (and (fboundp 'secure-hash)
(subrp (symbol-function 'secure-hash)))
(subrp (symbol-function 'sha1))))
;; Do nothing.
)
Expand Down

0 comments on commit 87a5fec

Please sign in to comment.