forked from RsaCtfTool/RsaCtfTool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile_full
88 lines (77 loc) · 3.16 KB
/
Dockerfile_full
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
78
79
80
81
82
83
84
85
86
87
88
# HIGHLY RECOMENDED TO BUILD LOCALLY, paramers for the gmp-ecm tool will be optimised on local hardware
# Base upon sagemath so that we don't have to deal with that dependency
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive
# apt-fast
RUN apt update && apt install -y curl wget aria2
RUN wget https://raw.githubusercontent.com/ilikenwf/apt-fast/master/apt-fast -O /usr/local/sbin/apt-fast && \
wget https://raw.githubusercontent.com/ilikenwf/apt-fast/master/apt-fast.conf -O /etc/apt-fast.conf &&\
chmod +x /usr/local/sbin/apt-fast
RUN apt-fast install -y libgmp3-dev libmpc-dev python3-pip sagemath build-essential libgmp-dev libmpfr-dev \
gcc musl-dev libssl-dev libffi-dev git gcc g++ make cmake git autoconf \
libtool zlib1g-dev
WORKDIR /opt
# Build neca, copy its binary and delete the source
RUN git clone https://github.com/jix/neca.git && \
cd neca && \
git checkout 8b9867f9fb0dee7f5583b2c3382a35634e9f75cf && \
mkdir build && \
cd build && \
cmake .. && \
make && \
cp neca /usr/bin/neca && \
cd ../.. && \
rm -rf neca
# Build ytools, a yafu dependency (patches gcc version used)
RUN git clone https://github.com/bbuhrow/ytools.git && \
cd ytools && \
git checkout bf7f82d05ec9b74b3b1c0b99a734c321d7eb540c && \
sed -i 's/gcc-7.3.0/gcc/g' Makefile && \
make && \
cd ..
# Build ysieve, a yafu dependency
RUN git clone https://github.com/bbuhrow/ysieve.git && \
cd ysieve && \
git checkout 275fb23f05fd870f3b3afba00c8dbe63994b434f && \
make && \
cd ..
# Build gmp-ecm (and tune params, will take a while, 5-10 minutes), a yafu dependency, and delete its source
RUN git clone https://gitlab.inria.fr/zimmerma/ecm.git && \
cd ecm && \
git checkout 0ab79ad9c9e3d507bc2012f7f18f5fb0fa9ab9cd && \
autoreconf -i && \
./configure && \
make && \
make check && \
make ecm-params && \
make && \
make install && \
cd .. && \
rm -rf ecm
# Build msieve, a yafu dependency (patch architecture, and build with gmp-ecm support)
RUN git clone https://github.com/radii/msieve.git && \
cd msieve && \
git checkout c8727d91305bdbe0972d160ef0ce61dd02ce9193 && \
sed -i 's/-march=athlon-xp/-march=native/g' Makefile && \
make ECM=1 x86_64 && \
cd ..
# Build yafu (patches gmp lib used), and copy config
RUN git clone https://github.com/bbuhrow/yafu.git && \
cd yafu && \
git checkout ca48c65b66a465a5a47cf7da0301f4ef56227573 && \
sed -i 's/\/users\/buhrow\/src\/c\/gmp_install\/gmp-6.2.0\/lib\/libgmp.a/-lgmp/g' Makefile && \
make NFS=1 USE_SSE41=1 USE_AVX2=1 USE_BMI2=1 yafu && \
cp yafu /usr/bin/yafu && \
cp yafu.ini /usr/bin/yafu.ini && \
cd ..
# Patch yafu config (run on all threads, specify ecm path)
RUN sed -i "s/% threads=1/threads=$(nproc --all)/g" /usr/bin/yafu.ini && \
sed -i 's/ecm_path=\.\.\\gmp-ecm\\bin\\x64\\Release\\ecm.exe/ecm_path=\/usr\/bin\/ecm/g' /usr/bin/yafu.ini
WORKDIR /opt
RUN git clone https://github.com/Ganapati/RsaCtfTool.git
WORKDIR /opt/RsaCtfTool
RUN python3 -m pip install -r "requirements.txt"
RUN python3 -m pip install -r "optional-requirements.txt"
WORKDIR /data
ENTRYPOINT ["/opt/RsaCtfTool/RsaCtfTool.py"]
CMD ["-h"]