guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: hash: Initialize libgcrypt before use.


From: Ludovic Courtès
Subject: 02/03: hash: Initialize libgcrypt before use.
Date: Mon, 26 Jan 2015 20:58:24 +0000

civodul pushed a commit to branch master
in repository guix.

commit 19a454448b97d2e84164f8add9aaed42c645e338
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jan 26 21:42:23 2015 +0100

    hash: Initialize libgcrypt before use.
    
    Fixes <http://bugs.gnu.org/19677>.
    Reported by Mark H Weaver <address@hidden>.
    
    * guix/hash.scm: Use (guix gcrypt).
      (sha256, open-sha256-md, md-write, md-close): Use 'libgcrypt-func'
      instead of 'dynamic-func'.
---
 guix/hash.scm |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/guix/hash.scm b/guix/hash.scm
index 593c2e1..a61dc98 100644
--- a/guix/hash.scm
+++ b/guix/hash.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -17,7 +17,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (guix hash)
-  #:use-module (guix config)
+  #:use-module (guix gcrypt)
   #:use-module (rnrs bytevectors)
   #:use-module (rnrs io ports)
   #:use-module (system foreign)
@@ -46,8 +46,7 @@
 
 (define sha256
   (let ((hash (pointer->procedure void
-                                  (dynamic-func "gcry_md_hash_buffer"
-                                                (dynamic-link %libgcrypt))
+                                  (libgcrypt-func "gcry_md_hash_buffer")
                                   `(,int * * ,size_t))))
     (lambda (bv)
       "Return the SHA256 of BV as a bytevector."
@@ -58,8 +57,7 @@
 
 (define open-sha256-md
   (let ((open (pointer->procedure int
-                                  (dynamic-func "gcry_md_open"
-                                                (dynamic-link %libgcrypt))
+                                  (libgcrypt-func "gcry_md_open")
                                   `(* ,int ,unsigned-int))))
     (lambda ()
       (let* ((md  (bytevector->pointer (make-bytevector (sizeof '*))))
@@ -70,20 +68,17 @@
 
 (define md-write
   (pointer->procedure void
-                      (dynamic-func "gcry_md_write"
-                                    (dynamic-link %libgcrypt))
+                      (libgcrypt-func "gcry_md_write")
                       `(* * ,size_t)))
 
 (define md-read
   (pointer->procedure '*
-                      (dynamic-func "gcry_md_read"
-                                    (dynamic-link %libgcrypt))
+                      (libgcrypt-func "gcry_md_read")
                       `(* ,int)))
 
 (define md-close
   (pointer->procedure void
-                      (dynamic-func "gcry_md_close"
-                                    (dynamic-link %libgcrypt))
+                      (libgcrypt-func "gcry_md_close")
                       '(*)))
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]