summary refs log tree commit diff
diff options
context:
space:
mode:
authorRaghav Gururajan via Guix-patches via <guix-patches@gnu.org>2021-12-09 08:45:47 -0500
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2022-01-14 09:54:56 +0100
commitbe2c199661039422b9c9832b54b3569bef8dbe2f (patch)
tree03a7ba6327a3d4c78160db16157037e1aa23041a
parentfd58aa0784273a8148ffd6d3c072156c3161d7f5 (diff)
downloadguix-be2c199661039422b9c9832b54b3569bef8dbe2f.tar.gz
gnu: Add blacksmith.
* gnu/packages/cybersecurity.scm (blacksmith): New variable.

Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
-rw-r--r--gnu/packages/cybersecurity.scm67
1 files changed, 67 insertions, 0 deletions
diff --git a/gnu/packages/cybersecurity.scm b/gnu/packages/cybersecurity.scm
index c61342c0ba..0801c00c4f 100644
--- a/gnu/packages/cybersecurity.scm
+++ b/gnu/packages/cybersecurity.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;; Copyright © 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2021 c4droid <c4droid@foxmail.com>
+;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,10 +21,14 @@
 
 (define-module (gnu packages cybersecurity)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages cpp)
   #:use-module (gnu packages engineering)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages python-crypto)
@@ -32,6 +37,68 @@
   #:use-module (gnu packages bioinformatics)      ;python-intervaltree
   #:use-module (gnu packages emulators))
 
+(define-public blacksmith
+  (package
+    (name "blacksmith")
+    (version "0.0.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/comsec-group/blacksmith")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0kyp71wndf527dgza5iks5m5vj543mvxp5w7cjd8x0pilmd1xrls"))
+              (modules '((guix build utils)))
+              (snippet `(begin
+                          (delete-file-recursively "external")
+                          (substitute* "CMakeLists.txt"
+                            (("add_subdirectory\\(external\\)") "")
+                            (("[ \t]*FetchContent_MakeAvailable\\(asmjit\\)")
+                             (string-append
+                              "find_package(asmjit)\n"
+                              "find_package(nlohmann_json)")))))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f                      ;no test-suite
+       #:imported-modules
+       ((guix build copy-build-system)
+        ,@%cmake-build-system-modules)
+       #:modules
+       (((guix build copy-build-system) #:prefix copy:)
+        (guix build cmake-build-system)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-build
+           (lambda _
+             (substitute* "CMakeLists.txt"
+               ;; Use default C++ standard instead.
+               (("cxx_std_17") "")
+               ;; This project tries to link argagg library, which doesn't
+               ;; exist, as argagg project is a single header file.
+               (("argagg") ""))))
+         (replace 'install
+           (lambda args
+             (apply (assoc-ref copy:%standard-phases 'install)
+                    #:install-plan
+                    '(("." "bin" #:include ("blacksmith"))
+                      ("." "lib" #:include-regexp ("\\.a$")))
+                    args))))))
+    (native-inputs
+     (list pkg-config))
+    (inputs
+     (list argagg asmjit json-modern-cxx))
+    (home-page "https://comsec.ethz.ch/research/dram/blacksmith")
+    (synopsis "Rowhammer fuzzer with non-uniform and frequency-based patterns")
+    (description
+     "Blacksmith is an implementation of Rowhammer fuzzer that crafts novel
+non-uniform Rowhammer access patterns based on the concepts of frequency,
+phase, and amplitude.  It is able to bypass recent @acronym{TRR, Target Row
+Refresh}in-DRAM mitigations effectively and as such can trigger bit flips.")
+    (license license:expat)))
+
 (define-public ropgadget
   (package
     (name "ropgadget")