Skip to content

Commit 6833c4b

Browse files
committed
update dockerfile and installer
1 parent 06dee3f commit 6833c4b

File tree

3 files changed

+85
-49
lines changed

3 files changed

+85
-49
lines changed

README.md

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,34 @@ This repository hosts the source code for the tools presented in our paper, acce
1111

1212
## Table of Contents
1313

14-
- [Required Software](#required-software)
15-
- [Installation](#installation)
16-
- [Method 1](#method-1)
17-
- [Method 2](#method-2)
18-
- [Structure of Our Tool](#structure-of-our-tool)
19-
- [Usage](#usage)
20-
- [Example 1: TWINE](#example-1-twine)
21-
- [Example 2: WARP](#example-2-warp)
22-
- [Example 3: AES](#example-3-aes)
23-
- [Example 4: Ascon](#example-4-ascon)
24-
- [Analytical Estimations](#analytical-estimations)
25-
- [Example 1: 8 Rounds of TWINE (Basic)](#example-1-8-rounds-of-twine-basic)
26-
- [Example 2: 3 Rounds of AES (Medium)](#example-2-3-rounds-of-aes-medium)
27-
- [Example 3: 9 Rounds of TWINE (Medium)](#example-3-9-rounds-of-twine-medium)
28-
- [Example 4: 10 Rounds of TWINE (Complex)](#example-4-10-rounds-of-twine-complex)
29-
- [Experimental Verification](#experimental-verification)
30-
- [Example 1: AES](#example-1-aes)
31-
- [Example 2: TWINE](#example-2-twine)
32-
- [Example 3: Ascon](#example-3-ascon)
33-
- [Example 4: WARP](#example-4-warp)
34-
- [Encoding S-boxes and Other Building Block Functions](#encoding-s-boxes-and-other-building-block-functions)
35-
- [Verifying Proposition 2](#verifying-proposition-2)
36-
- [References](#references)
37-
- [Citation](#citation)
38-
- [License](#license)
14+
- [Revisiting Differential-Linear Attacks via a Boomerang Perspective](#revisiting-differential-linear-attacks-via-a-boomerang-perspective)
15+
- [Table of Contents](#table-of-contents)
16+
- [Required Software](#required-software)
17+
- [Installation](#installation)
18+
- [Method 1](#method-1)
19+
- [Method 2](#method-2)
20+
- [Installing Gurobi and `gurobipy`](#installing-gurobi-and-gurobipy)
21+
- [Structure of Our Tool](#structure-of-our-tool)
22+
- [Usage](#usage)
23+
- [Example 1: TWINE](#example-1-twine)
24+
- [Example 2: WARP](#example-2-warp)
25+
- [Example 3: AES](#example-3-aes)
26+
- [Example 4: Ascon](#example-4-ascon)
27+
- [Analythical Estimations](#analythical-estimations)
28+
- [Example 1: 8 Rounds of TWINE (Basic)](#example-1-8-rounds-of-twine-basic)
29+
- [Example 2: 3 Rounds of AES (Medium)](#example-2-3-rounds-of-aes-medium)
30+
- [Example 3: 9 Rounds of TWINE (Medium)](#example-3-9-rounds-of-twine-medium)
31+
- [Example 4: 10 Rounds of TWINE (Complex)](#example-4-10-rounds-of-twine-complex)
32+
- [Experimental Verification](#experimental-verification)
33+
- [Example 1: AES](#example-1-aes)
34+
- [Example 2: TWINE](#example-2-twine)
35+
- [Example 3: Ascon](#example-3-ascon)
36+
- [Example 4: WARP](#example-4-warp)
37+
- [Encoding S-boxes and Other Building Block Functions](#encoding-s-boxes-and-other-building-block-functions)
38+
- [Verifying Proposition 2](#verifying-proposition-2)
39+
- [References](#references)
40+
- [Citation](#citation)
41+
- [License ](#license-)
3942

4043
## Required Software
4144

@@ -82,30 +85,24 @@ To install MiniZinc and required Python packages in Ubuntu, one can use the foll
8285

8386
```bash
8487
#!/bin/bash
85-
8688
# Update and upgrade system packages
87-
sudo apt update -y
88-
sudo apt upgrade -y
89+
apt update -y
90+
apt upgrade -y
8991

9092
# Install system dependencies
91-
sudo apt install -y python3-full python3-pip python3-venv git wget curl
92-
93-
# Create a working directory
94-
mkdir -p "$HOME/minizinc_install"
95-
cd "$HOME/minizinc_install"
93+
apt install -y python3-full python3-pip python3-venv git wget curl
9694

9795
# Download and extract the latest MiniZinc release
9896
LATEST_MINIZINC_VERSION=$(curl -s https://api.github.com/repos/MiniZinc/MiniZincIDE/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
99-
wget "https://github.com/MiniZinc/MiniZincIDE/releases/download/$LATEST_MINIZINC_VERSION/MiniZincIDE-$LATEST_MINIZINC_VERSION-bundle-linux-x86_64.tgz"
100-
tar -xvzf MiniZincIDE-$LATEST_MINIZINC_VERSION-bundle-linux-x86_64.tgz
101-
mv MiniZincIDE-$LATEST_MINIZINC_VERSION-bundle-linux-x86_64 "$HOME/minizinc"
102-
rm MiniZincIDE-$LATEST_MINIZINC_VERSION-bundle-linux-x86_64.tgz
103-
104-
# Clean up the created folders
105-
rm -rf "$HOME/minizinc_install"
97+
wget "https://github.com/MiniZinc/MiniZincIDE/releases/download/${LATEST_MINIZINC_VERSION}/MiniZincIDE-${LATEST_MINIZINC_VERSION}-bundle-linux-x86_64.tgz"
98+
mkdir -p "$HOME/minizinc"
99+
tar -xvzf "MiniZincIDE-${LATEST_MINIZINC_VERSION}-bundle-linux-x86_64.tgz" -C "$HOME/minizinc" --strip-components=1
100+
rm "MiniZincIDE-${LATEST_MINIZINC_VERSION}-bundle-linux-x86_64.tgz"
106101

107-
# Add MiniZinc to system PATH
108-
sudo ln -sf "$HOME/minizinc/bin/minizinc" /usr/local/bin/minizinc
102+
# Create a wrapper script to call MiniZinc with proper LD_LIBRARY_PATH
103+
echo '#!/bin/bash' > /usr/local/bin/minizinc
104+
echo "exec env LD_LIBRARY_PATH=\$HOME/minizinc/lib:\$LD_LIBRARY_PATH \$HOME/minizinc/bin/minizinc \"\$@\"" >> /usr/local/bin/minizinc
105+
chmod +x /usr/local/bin/minizinc
109106

110107
# Create a Python virtual environment
111108
python3 -m venv "$HOME/dlvenv"
@@ -125,6 +122,7 @@ python3 -m pip install gurobipy
125122
```
126123

127124
For detailed instructions on installing Gurobi and obtaining an academic license, refer to the [GrabGurobi repository](https://github.com/hadipourh/grabgurobi).
125+
The above commands are included in the [install.sh](install.sh) script, which can be executed to set up the environment.
128126

129127
## Structure of Our Tool
130128
We have developed our tools using a modular approach to ensure flexibility and maintainability. The workflow is divided into three main modules:

docker/Dockerfile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,19 @@ RUN apt-get update && \
2020
apt-get clean && \
2121
rm -rf /var/lib/apt/lists/*
2222

23-
# Install MiniZinc
23+
# Install MiniZinc with proper library path handling
2424
WORKDIR /home
25-
RUN LATEST_MINIZINC_VERSION=$(curl -s https://api.github.com/repos/MiniZinc/MiniZincIDE/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') \
26-
&& wget "https://github.com/MiniZinc/MiniZincIDE/releases/download/$LATEST_MINIZINC_VERSION/MiniZincIDE-$LATEST_MINIZINC_VERSION-bundle-linux-x86_64.tgz" \
25+
RUN LATEST_MINIZINC_VERSION=$(curl -s https://api.github.com/repos/MiniZinc/MiniZincIDE/releases/latest \
26+
| grep -oP '"tag_name": "\K[^"]+') \
27+
&& wget "https://github.com/MiniZinc/MiniZincIDE/releases/download/${LATEST_MINIZINC_VERSION}/MiniZincIDE-${LATEST_MINIZINC_VERSION}-bundle-linux-x86_64.tgz" \
2728
&& mkdir MiniZinc \
28-
&& tar -xvzf "MiniZincIDE-$LATEST_MINIZINC_VERSION-bundle-linux-x86_64.tgz" -C MiniZinc --strip-components=1 \
29-
&& rm "MiniZincIDE-$LATEST_MINIZINC_VERSION-bundle-linux-x86_64.tgz"
30-
RUN ln -s /home/MiniZinc/bin/minizinc /usr/local/bin/minizinc
29+
&& tar -xzf "MiniZincIDE-${LATEST_MINIZINC_VERSION}-bundle-linux-x86_64.tgz" -C MiniZinc --strip-components=1 \
30+
&& rm "MiniZincIDE-${LATEST_MINIZINC_VERSION}-bundle-linux-x86_64.tgz"
31+
32+
# Create wrapper to set correct LD_LIBRARY_PATH at runtime
33+
RUN echo '#!/bin/bash\nLD_LIBRARY_PATH=/home/MiniZinc/lib:$LD_LIBRARY_PATH exec /home/MiniZinc/bin/minizinc "$@"' \
34+
> /usr/local/bin/minizinc \
35+
&& chmod +x /usr/local/bin/minizinc
3136

3237
# Clone DL repository
3338
RUN git clone https://github.com/hadipourh/DL
@@ -41,5 +46,9 @@ RUN python3 -m venv myenv
4146
# Install required Python packages
4247
RUN myenv/bin/python3 -m pip install --no-cache-dir pyyaml minizinc gurobipy numpy
4348

44-
# Clean up APT cache
49+
# Set the entrypoint to the virtual environment's Python interpreter
50+
ENTRYPOINT ["/bin/bash", "-c", "source /home/DL/myenv/bin/activate && exec /bin/bash"]
51+
# Set the working directory for the container
52+
WORKDIR /home/DL
53+
# Clean up cache
4554
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

installer.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
# Update and upgrade system packages
3+
apt update -y
4+
apt upgrade -y
5+
6+
# Install system dependencies
7+
apt install -y python3-full python3-pip python3-venv git wget curl
8+
9+
# Download and extract the latest MiniZinc release
10+
LATEST_MINIZINC_VERSION=$(curl -s https://api.github.com/repos/MiniZinc/MiniZincIDE/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
11+
wget "https://github.com/MiniZinc/MiniZincIDE/releases/download/${LATEST_MINIZINC_VERSION}/MiniZincIDE-${LATEST_MINIZINC_VERSION}-bundle-linux-x86_64.tgz"
12+
mkdir -p "$HOME/minizinc"
13+
tar -xvzf "MiniZincIDE-${LATEST_MINIZINC_VERSION}-bundle-linux-x86_64.tgz" -C "$HOME/minizinc" --strip-components=1
14+
rm "MiniZincIDE-${LATEST_MINIZINC_VERSION}-bundle-linux-x86_64.tgz"
15+
16+
# Create a wrapper script to call MiniZinc with proper LD_LIBRARY_PATH
17+
echo '#!/bin/bash' > /usr/local/bin/minizinc
18+
echo "exec env LD_LIBRARY_PATH=\$HOME/minizinc/lib:\$LD_LIBRARY_PATH \$HOME/minizinc/bin/minizinc \"\$@\"" >> /usr/local/bin/minizinc
19+
chmod +x /usr/local/bin/minizinc
20+
21+
# Create a Python virtual environment
22+
python3 -m venv "$HOME/dlvenv"
23+
source "$HOME/dlvenv/bin/activate"
24+
25+
# Install Python packages
26+
pip install --upgrade pip
27+
pip install minizinc
28+
pip install sagemath # Note: this is not the full SageMath system
29+
pip install gurobipy

0 commit comments

Comments
 (0)