diff --git a/.github/workflows/publish-and-release.yaml b/.github/workflows/publish-and-release.yaml index 5017868..72aade8 100644 --- a/.github/workflows/publish-and-release.yaml +++ b/.github/workflows/publish-and-release.yaml @@ -30,24 +30,13 @@ jobs: id: maven-project draft-release: runs-on: ubuntu-20.04 - needs: [prepare] + needs: [ prepare ] env: VERSION: "${{ needs.prepare.outputs.VERSION }}" steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Retrieve license obligation resources - run: | - cd 3RD-PARTY-LICENSES - find . -maxdepth 1 -type d -not -path . | zip -r@ ${GITHUB_REPOSITORY#*/}-3rd-party-copyrights - find . -iname origin.src | \ - awk '{ \ - split($0,b,"/"); \ - system("xargs < " $0 " curl --create-dirs -Lo ./sources/" b[2] ".zip " $2)}' && \ - find -regex './sources$' | awk '{system("zip -jr ./${GITHUB_REPOSITORY#*/}-3rd-party-sources.zip " $0)}' - mkdir -p ../license-obligations && mv `find . -regex "^./${GITHUB_REPOSITORY#*/}-3rd-party-.*.zip$"` ../license-obligations/ - cd - - name: Generate change log run: | chmod +x .github/scripts/generate-changelog.sh @@ -62,10 +51,9 @@ jobs: tag: ${{ env.VERSION }} draft: true bodyFile: /tmp/cs.repository-changelog.${{ env.VERSION }} - artifacts: "license-obligations/*" publish: runs-on: ubuntu-20.04 - needs: [prepare,draft-release] + needs: [ prepare,draft-release ] env: VERSION: "${{ needs.prepare.outputs.VERSION }}" steps: diff --git a/3RD-PARTY-LICENSES/org.projectlombok_lombok/LICENSE b/3RD-PARTY-LICENSES/org.projectlombok_lombok/LICENSE deleted file mode 100644 index 7c6cbff..0000000 --- a/3RD-PARTY-LICENSES/org.projectlombok_lombok/LICENSE +++ /dev/null @@ -1,104 +0,0 @@ -Copyright (C) 2009-2021 The Project Lombok Authors. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -============================================================================== -Licenses for included components: - -org.ow2.asm:asm -org.ow2.asm:asm-analysis -org.ow2.asm:asm-commons -org.ow2.asm:asm-tree -org.ow2.asm:asm-util -ASM: a very small and fast Java bytecode manipulation framework - Copyright (c) 2000-2011 INRIA, France Telecom - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. - ------------------------------------------------------------------------------- -rzwitserloot/com.zwitserloot.cmdreader - - Copyright © 2010 Reinier Zwitserloot. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ------------------------------------------------------------------------------- - -projectlombok/lombok.patcher - - Copyright (C) 2009-2021 The Project Lombok Authors. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ------------------------------------------------------------------------------- \ No newline at end of file diff --git a/3RD-PARTY-LICENSES/sbom.xml b/3RD-PARTY-LICENSES/sbom.xml deleted file mode 100644 index 2123231..0000000 --- a/3RD-PARTY-LICENSES/sbom.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - Project Lombok - org.projectlombok - lombok - 1.18.20 - https://projectlombok.org - - - The MIT License - https://projectlombok.org/LICENSE - - - - - diff --git a/README.md b/README.md index 67242e6..ebebc92 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,6 @@ This project provides utilities for using Carbyne Stack *MP-SPDZ Integration Utilities* is open-sourced under the Apache License 2.0. See the [LICENSE](LICENSE) file for details. -### 3rd Party Licenses - -For information on how license obligations for 3rd party OSS dependencies are -fulfilled see the [README](https://github.com/carbynestack/carbynestack) file of -the Carbyne Stack repository. - ## Contributing Please see the Carbyne Stack diff --git a/pom.xml b/pom.xml index b5b7ad3..c026642 100644 --- a/pom.xml +++ b/pom.xml @@ -51,16 +51,9 @@ 2.0.0 - 1.18.20 4.13.2 - - org.projectlombok - lombok - ${lombok.version} - - junit diff --git a/src/main/java/io/carbynestack/mpspdz/integration/MpSpdzIntegrationUtils.java b/src/main/java/io/carbynestack/mpspdz/integration/MpSpdzIntegrationUtils.java index 11f39ae..0836fe7 100644 --- a/src/main/java/io/carbynestack/mpspdz/integration/MpSpdzIntegrationUtils.java +++ b/src/main/java/io/carbynestack/mpspdz/integration/MpSpdzIntegrationUtils.java @@ -6,32 +6,80 @@ */ package io.carbynestack.mpspdz.integration; +import static java.util.Objects.requireNonNull; + import java.math.BigInteger; import java.util.Arrays; -import lombok.NonNull; -import lombok.Value; /** Enables conversion from BigInteger to the MP-SPDZ internal representation and vice versa. */ -@Value(staticConstructor = "of") -public class MpSpdzIntegrationUtils { - - /** Modulus N as used by the MP-SPDZ implementation */ - @NonNull BigInteger prime; - - /** Auxiliary modulus R as used by the MP-SPDZ implementation */ - @NonNull BigInteger r; - - /** Multiplicative inverse for the auxiliary modulus R as used by the MP-SPDZ implementation */ - @NonNull BigInteger rInv; - +public final class MpSpdzIntegrationUtils { /** The size of a limb in the MP-SPDZ runtime. */ public static final int LIMB_WIDTH = 8; - /** The size of a word in the MP-SPDZ runtime. */ public static final int WORD_WIDTH = 2 * LIMB_WIDTH; - /** The size of a share (value, MAC) in the MP-SPDZ runtime. Equals two times the word width. */ public static final int SHARE_WIDTH = 2 * WORD_WIDTH; + /** Modulus N as used by the MP-SPDZ implementation */ + private final BigInteger prime; + /** Auxiliary modulus R as used by the MP-SPDZ implementation */ + private final BigInteger r; + /** Multiplicative inverse for the auxiliary modulus R as used by the MP-SPDZ implementation */ + private final BigInteger rInv; + + /** + * Constructs an instance of {@code MpSpdzIntegrationUtils} using prime, r and rInv. + * + * @param prime Modulus N as used by the MP-SPDZ implementation + * @param r Auxiliary modulus R as used by the MP-SPDZ implementation + * @param rInv Multiplicative inverse for the auxiliary modulus R as used by the MP-SPDZ + * implementation + */ + private MpSpdzIntegrationUtils(BigInteger prime, BigInteger r, BigInteger rInv) { + this.prime = requireNonNull(prime); + this.r = requireNonNull(r); + this.rInv = requireNonNull(rInv); + } + + /** + * Constructs an instance of {@code MpSpdzIntegrationUtils} using prime, r and rInv. + * + * @param prime Modulus N as used by the MP-SPDZ implementation + * @param r Auxiliary modulus R as used by the MP-SPDZ implementation + * @param rInv Multiplicative inverse for the auxiliary modulus R as used by the MP-SPDZ + * implementation + * @return an instance of {@code MpSpdzIntegrationUtils} + */ + public static MpSpdzIntegrationUtils of(BigInteger prime, BigInteger r, BigInteger rInv) { + return new MpSpdzIntegrationUtils(prime, r, rInv); + } + + /** + * Returns Modulus N as used by the MP-SPDZ implementation. + * + * @return {@code this.prime} + */ + public BigInteger getPrime() { + return prime; + } + + /** + * Returns Auxiliary modulus R as used by the MP-SPDZ implementation. + * + * @return {@code this.r} + */ + public BigInteger getR() { + return r; + } + + /** + * Returns Multiplicative inverse for the auxiliary modulus R as used by the MP-SPDZ + * implementation. + * + * @return {@code this.rInv} + */ + public BigInteger getRInv() { + return rInv; + } /** * Converts a number given as a BigInteger to the MP-SPDZ internal representation.