summaryrefslogtreecommitdiff
path: root/gnu/packages/python-crypto.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-09-07 11:04:44 +0200
committerLudovic Courtès <ludo@gnu.org>2021-09-07 14:19:08 +0200
commitd9dfbf886ddbb92dfdaa118bb9765e78aad5c53a (patch)
tree2732020de20a38c09b66a60b0cb36022799f7c2e /gnu/packages/python-crypto.scm
parentb949f34f31a045eb0fb242b81a223178fb6994d3 (diff)
parent49922efb11da0f0e9d4f5979d081de5ea8c99d25 (diff)
downloadguix-patches-d9dfbf886ddbb92dfdaa118bb9765e78aad5c53a.tar
guix-patches-d9dfbf886ddbb92dfdaa118bb9765e78aad5c53a.tar.gz
Merge branch 'master' into core-updates-frozen
Diffstat (limited to 'gnu/packages/python-crypto.scm')
-rw-r--r--gnu/packages/python-crypto.scm29
1 files changed, 27 insertions, 2 deletions
diff --git a/gnu/packages/python-crypto.scm b/gnu/packages/python-crypto.scm
index 00e704a15f..38accb2b87 100644
--- a/gnu/packages/python-crypto.scm
+++ b/gnu/packages/python-crypto.scm
@@ -25,6 +25,7 @@
;;; Copyright © 2020 Justus Winter <justus@sequoia-pgp.org>
;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -44,6 +45,7 @@
(define-module (gnu packages python-crypto)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix build-system python)
#:use-module (gnu packages)
@@ -927,6 +929,22 @@ protocol (Javascript Object Signing and Encryption).")
(define-public python2-josepy
(package-with-python2 python-josepy))
+(define pycryptodome-unbundle-tomcrypt-snippet
+ #~(begin
+ ;; Unbundle libtomcrypt.
+ (delete-file-recursively "src/libtom")
+ (substitute* "src/DES.c"
+ (("#include \"libtom/tomcrypt_des.c\"")
+ "#include <tomcrypt.h>"))
+ (substitute* "setup.py"
+ (("include_dirs=\\['src/', 'src/libtom/'\\]")
+ ;; FIXME: why does '-ltomcrypt' need to be added
+ ;; manually, even when 'tomcrypt' is added to 'libraries'?
+ ;; This behaviour is not documented at
+ ;; <https://docs.python.org/3/extending/building.html>.
+ "include_dirs=['src/'], libraries=['tomcrypt', 'tommath'],
+ extra_link_args=['-ltomcrypt', '-ltommath']"))))
+
(define-public python-pycryptodome
(package
(name "python-pycryptodome")
@@ -937,8 +955,13 @@ protocol (Javascript Object Signing and Encryption).")
(uri (pypi-uri "pycryptodome" version))
(sha256
(base32
- "1i4m74f88qj9ci8rpyzrbk2slmsdj5ipmwdkq6qk24byalm203li"))))
+ "1i4m74f88qj9ci8rpyzrbk2slmsdj5ipmwdkq6qk24byalm203li"))
+ (modules '((guix build utils)))
+ (snippet pycryptodome-unbundle-tomcrypt-snippet)))
(build-system python-build-system)
+ (inputs
+ `(("libtomcrypt" ,libtomcrypt)
+ ("libtommath" ,libtommath)))
(home-page "https://www.pycryptodome.org")
(synopsis "Low-level cryptographic Python library")
(description
@@ -991,7 +1014,9 @@ PyCryptodome variants, the other being python-pycryptodomex.")
(method url-fetch)
(uri (pypi-uri "pycryptodomex" version))
(sha256
- (base32 "0lbx4qk3xmwqiidhmkj8qa7bh2lf8bwzg0xjpsh2w5zqjrc7qnvv"))))
+ (base32 "0lbx4qk3xmwqiidhmkj8qa7bh2lf8bwzg0xjpsh2w5zqjrc7qnvv"))
+ (modules '((guix build utils)))
+ (snippet pycryptodome-unbundle-tomcrypt-snippet)))
(description
"PyCryptodome is a self-contained Python package of low-level
cryptographic primitives. It's not a wrapper to a separate C library like