summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/palisade-development/package.py
blob: 366128f6f901edd3f2d2641c0887fee8c892ef92 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class PalisadeDevelopment(CMakePackage):
    """
    PALISADE is a general lattice cryptography library that currently
    includes efficient implementations of the following lattice cryptography
    capabilities:

    Fully Homomorphic Encryption (FHE):
    - Brakerski/Fan-Vercauteren (BFV) scheme for integer arithmetic
    - Brakerski-Gentry-Vaikuntanathan (BGV) scheme for integer arithmetic
    - Cheon-Kim-Kim-Song (CKKS) scheme for real-number arithmetic
    - Ducas-Micciancio (FHEW) and Chillotti-Gama-Georgieva-Izabachene
      (TFHE) schemes for Boolean circuit evaluation

    Multi-Party Extensions of FHE (to support multi-key FHE):
    - Threshold FHE for BGV, BFV, and CKKS schemes
    - Proxy Re-Encryption for BGV, BFV, and CKKS schemes
    """

    homepage = "https://gitlab.com/palisade/palisade-development"
    git = "https://gitlab.com/palisade/palisade-development.git"
    maintainers("wohlbier")

    license("BSD-2-Clause")

    version("feature-fixed-point-encoding", branch="feature-fixed-point-encoding", submodules=True)
    version(
        "fppe-logreg-v1.0",
        tag="fppe-logreg-v1.0",
        commit="5ccb14ffffd65e70db048e143ec2350b97a20d40",
        submodules=True,
    )
    version("master", branch="master", preferred=True, submodules=True)

    variant("shared", default=True, description="Build shared library.")
    variant("static", default=True, description="Build static library.")
    variant("with_be2", default=True, description="Build with backend 2.")
    variant("with_be4", default=True, description="Build with backend 4.")
    variant("with_intel_hexl", default=False, description="Use Intel HEXL.")
    variant("with_ntl", default=False, description="Build NTL.")

    depends_on("autoconf")
    depends_on("hwloc", when="%clang")
    depends_on("ntl", when="+with_ntl")
    depends_on("ntl+shared", when="+with_ntl +shared")

    def cmake_args(self):
        args = [
            self.define_from_variant("BUILD_SHARED", "shared"),
            self.define_from_variant("BUILD_STATIC", "static"),
            self.define_from_variant("WITH_BE2", "with_be2"),
            self.define_from_variant("WITH_BE4", "with_be4"),
            self.define_from_variant("WITH_INTEL_HEXL", "with_intel_hexl"),
            self.define_from_variant("WITH_NTL", "with_ntl"),
        ]
        if self.spec.satisfies("%clang"):
            OpenMP_C_FLAGS = "-fopenmp=libomp"
            OpenMP_C_LIB_NAMES = "libomp"
            args += [
                self.define("OpenMP_C", "clang"),
                self.define("OpenMP_C_FLAGS", OpenMP_C_FLAGS),
                self.define("OpenMP_C_LIB_NAMES", OpenMP_C_LIB_NAMES),
                self.define("OpenMP_CXX", "clang++"),
                self.define("OpenMP_CXX_FLAGS", OpenMP_C_FLAGS),
                self.define("OpenMP_CXX_LIB_NAMES", OpenMP_C_LIB_NAMES),
                self.define("OpenMP_libomp_LIBRARY", "libomp"),
                self.define("OpenMP_libgomp_LIBRARY", "libgomp"),
                self.define("OpenMP_libiomp5_LIBRARY", "libiomp5"),
            ]
        return args