summaryrefslogtreecommitdiff
path: root/guix/pk-crypto.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-12-30 22:29:12 +0100
committerLudovic Courtès <ludo@gnu.org>2013-12-30 22:29:12 +0100
commitdedb5d947ee2890524a5c6fb1343b3299e7731c3 (patch)
treeee9767de32d8c7e3f60be659ac5599c05626f348 /guix/pk-crypto.scm
parent36341854dfedc3d173d09e686ffc3e255c102b01 (diff)
downloadguix-patches-dedb5d947ee2890524a5c6fb1343b3299e7731c3.tar
guix-patches-dedb5d947ee2890524a5c6fb1343b3299e7731c3.tar.gz
pk-crypto: Fix 'canonical-sexp->sexp' for atoms.
* guix/pk-crypto.scm (canonical-sexp->sexp): Add hack to extract an atom's buffer. * tests/pk-crypto.scm ("sexp->canonical-sexp->sexp"): Add sample.
Diffstat (limited to 'guix/pk-crypto.scm')
-rw-r--r--guix/pk-crypto.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/guix/pk-crypto.scm b/guix/pk-crypto.scm
index cf18faea04..d5b3eeb350 100644
--- a/guix/pk-crypto.scm
+++ b/guix/pk-crypto.scm
@@ -319,7 +319,14 @@ use pattern matching."
result))
'()
sexp))
- (canonical-sexp->string sexp))) ; XXX: not very useful
+
+ ;; As of Libgcrypt 1.6.0, there's no function to extract the buffer of a
+ ;; non-list sexp (!), so we first enlist SEXP, then get at its buffer.
+ (let ((sexp (string->canonical-sexp
+ (string-append "(" (canonical-sexp->string sexp)
+ ")"))))
+ (or (canonical-sexp-nth-data sexp 0)
+ (canonical-sexp-nth sexp 0)))))
(define (sexp->canonical-sexp sexp)
"Return a canonical sexp equivalent to SEXP, a Scheme sexp as returned by