From 39a6fbde61fb6832eebb5950387b6a4a5366075e Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Fri, 1 Dec 2023 17:55:41 +0000 Subject: [PATCH] add second cw --- .drone.yml | 120 ++++++++++++++++-------------- secondcw/ag01598_6644818_1.1.spdl | 74 ++++++++++++++++++ secondcw/cw/cw.tex | 69 +++++++++++++++++ secondcw/lab9.spdl | 68 +++++++++++++++++ secondcw/main.bib | 8 ++ 5 files changed, 284 insertions(+), 55 deletions(-) create mode 100644 secondcw/ag01598_6644818_1.1.spdl create mode 100644 secondcw/cw/cw.tex create mode 100644 secondcw/lab9.spdl create mode 100644 secondcw/main.bib diff --git a/.drone.yml b/.drone.yml index 9156a6e..52ba02b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,65 +8,75 @@ steps: commands: - bash linting.sh -# - name: Build UPDS-1 -# commands: -# - cd cw -# - pdflatex cw.tex -# # Prepare bib -# - /usr/bin/vendor_perl/biber cw -# # Compile twice for the table of contents and for bib text -# - pdflatex cw.tex -# - pdflatex cw.tex -# - cd - + - name: Build Cw1 + commands: + - cd firstcw/cw + - pdflatex cw.tex + # Prepare bib + - /usr/bin/vendor_perl/biber cw + # Compile twice for the table of contents and for bib text + - pdflatex cw.tex + - pdflatex cw.tex + - cd - -# # - name: Build Report -# # commands: -# # - cd report -# # - cp ../upds-1/UPDS-content.tex UPDS-1-content.tex -# # - cp ../upds-2/UPDS-content.tex UPDS-2-content.tex -# # - pdflatex report.tex -# # # Prepare bib -# # - /usr/bin/vendor_perl/biber report -# # # Compile twice for the table of contents and for bib text -# # - pdflatex report.tex -# # - cd - -# # -# # - name: Generate text -# # commands: -# # - pnpm i -# # - pnpm ts-node main.ts report/report.tex + - name: Build Cw2 + commands: + - cd secondcw/cw + - pdflatex cw.tex + # Prepare bib + - /usr/bin/vendor_perl/biber cw + # Compile twice for the table of contents and for bib text + - pdflatex cw.tex + - pdflatex cw.tex + - cd - -# - name: gitea_release -# environment: -# TOKEN: -# from_secret: token -# commands: -# - tea login add --url https://git.andr3h3nriqu3s.com --token "$TOKEN" -# - tea r rm -y current || echo "Release not found" -# # - tea r c --title "Latest Report" --asset report/report.pdf --asset upds-1/UPDS12-1.pdf --asset upds-2/UPDS12-2.pdf --asset results.txt --asset poster/poster.pdf current -# - tea r c --title "1st cw work" --asset cw/cw.pdf first-cw-work + # - name: Build Report + # commands: + # - cd report + # - cp ../upds-1/UPDS-content.tex UPDS-1-content.tex + # - cp ../upds-2/UPDS-content.tex UPDS-2-content.tex + # - pdflatex report.tex + # # Prepare bib + # - /usr/bin/vendor_perl/biber report + # # Compile twice for the table of contents and for bib text + # - pdflatex report.tex + # - cd - + # + # - name: Generate text + # commands: + # - pnpm i + # - pnpm ts-node main.ts report/report.tex -# - name: Remove current on failure -# environment: -# TOKEN: -# from_secret: token -# commands: -# - tea login add --url https://git.andr3h3nriqu3s.com --token "$TOKEN" -# - tea r rm -y current || echo "Release not found" -# trigger: -# status: -# - failure -# when: -# status: -# - failure + - name: gitea_release + environment: + TOKEN: + from_secret: token + commands: + - tea login add --url https://git.andr3h3nriqu3s.com --token "$TOKEN" + - tea r rm -y current || echo "Release not found" + - tea r c --title "Latest" --asset firstcw/cw/cw.pdf --asset secondcw/cw/cw.pdf latest -#- name: latest -# environment: -# TOKEN: -# from_secret: token -# commands: -# - tea r rm -y "3rd-metting" || echo "Release not found" -# - tea r c --title "Last Metting Report" --asset report/report.pdf --asset upds-1/UPDS12-1.pdf --asset upds-2/UPDS12-2.pdf "3rd-metting" + - name: Remove current on failure + environment: + TOKEN: + from_secret: token + commands: + - tea login add --url https://git.andr3h3nriqu3s.com --token "$TOKEN" + - tea r rm -y current || echo "Release not found" + trigger: + status: + - failure + when: + status: + - failure + +# - name: latest +# environment: +# TOKEN: +# from_secret: token +# commands: +# - tea r rm -y "3rd-metting" || echo "Release not found" +# - tea r c --title "Last Metting Report" --asset report/report.pdf --asset upds-1/UPDS12-1.pdf --asset upds-2/UPDS12-2.pdf "3rd-metting" trigger: branch: diff --git a/secondcw/ag01598_6644818_1.1.spdl b/secondcw/ag01598_6644818_1.1.spdl new file mode 100644 index 0000000..002df90 --- /dev/null +++ b/secondcw/ag01598_6644818_1.1.spdl @@ -0,0 +1,74 @@ +/* + * Coursework 2 PI protocol +*/ + +usertype Timestamp; +usertype Sessionkey; + +hashfunction Mac; + +protocol protocolPI(Network, Application, Phone) { + + /* Role R - Phone + * + * has keys k(N,R) + * + */ + role Phone { + + var SesK: SessionKey; + var tl: Timestamp; + + recv_keysPhone(Network, Phone, Mac({SesK, tl}k(Network, Phone)), {SesK, tl}k(Network, Phone)); + + var mApp: Nonce; + + recv_1(Application,Phone, {mApp}k(SesK)); + + fresh mPhone: Nonce; + + send_2(Phone,Application, {mApp, mPhone}k(SesK)); + } + + /* Role S - Application + * + * has keys k(N,S) + * + */ + role Application { + + send_refreshKeys(Application,Network, Application, Phone); + + var SesK: SessionKey; + var tl: Timestamp; + + recv_keysApp(Network,Application, Mac({SesK, tl}k(Network, Application)), {SesK, tl}k(Network, Application)); + + fresh mApp: Nonce; + var mPhone: Nonce; + + send_1(Application,Phone, {mApp}k(SesK)); + + recv_2(Phone,Application, {mApp, mPhone}k(SesK)); + } + + /* Role N - Network + * + * has keys k(N,R) and k(N,S) + * + */ + role Network { + + recv_refreshKeys(Application,Network, Application, Phone); + + fresh SesK: SessionKey; + fresh tl: Timestamp; + + send_keysApp(Network,Application, Mac({SesK, tl}k(Network, Application)), {SesK, tl}k(Network, Application)); + + send_keysPhone(Network,Phone, Mac({SesK, tl}k(Network, Phone)), {SesK, tl}k(Network, Phone)); + } + + +} + diff --git a/secondcw/cw/cw.tex b/secondcw/cw/cw.tex new file mode 100644 index 0000000..f5b43f0 --- /dev/null +++ b/secondcw/cw/cw.tex @@ -0,0 +1,69 @@ +%%% Preamble +\documentclass[11pt, a4paper]{article} + +\usepackage[english]{babel} % English language/hyphenation +\usepackage{url} +\usepackage{tabularx} +\usepackage{pdfpages} +\usepackage{float} +\usepackage{amsmath, amssymb} +\usepackage{systeme} + +\usepackage{graphicx} +\graphicspath{ {../images for report/} } +\usepackage[margin=2cm]{geometry} + +\usepackage{hyperref} +\hypersetup{ + colorlinks, + citecolor=black, + filecolor=black, + linkcolor=black, + urlcolor=black +} + +\usepackage{cleveref} + +%%% Custom headers/footers (fancyhdr package) +\usepackage{fancyhdr} +\pagestyle{fancyplain} +\fancyhead{} % No page header +\fancyfoot[L]{} % Empty +\fancyfoot[C]{\thepage} % Pagenumbering +\fancyfoot[R]{} % Empty +\renewcommand{\headrulewidth}{0pt} % Remove header underlines +\renewcommand{\footrulewidth}{0pt} % Remove footer underlines +\setlength{\headheight}{13.6pt} + +% numeric +\usepackage[style=ieee,sorting=none,backend=biber]{biblatex} +\addbibresource{../main.bib} + +% Write the approved title of your dissertation +\title{Automated image classification with expandable models} + +% Write your full name, as in University records +\author{Andre Henriques, 6644818} + +\date{} + +%%% Begin document +\begin{document} + \section*{1} + \subsection*{1.1} + The file ag01598_6644818_1.1.spdl contains the base model of protocol$\PI$. + + I choose the names of the roles based on their functions since it would make the file more readable so R is Phone, S is Application, N is Network. + + As the diagram shows the first message is sent from the phone do the network to request the generation of a new session key. + + The keys where modeled using a custom usertype called ''SessionKey" and the time to live has modeled using a custom usertype called "Timestamp" + + The Network then aswers to the Phone and the Application the keys and the time to live and the hashed value of that using a hash function named ''Mac". + + The Phone and the Application verify the Mac and then the phone sends a nonce to the phone and the phone answers back with a new nonce and the original nonce. + + +\end{document} + + diff --git a/secondcw/lab9.spdl b/secondcw/lab9.spdl new file mode 100644 index 0000000..5eb83a3 --- /dev/null +++ b/secondcw/lab9.spdl @@ -0,0 +1,68 @@ +/*usertype Timestamp; + +protocol LaTe(C, S) +{ + role C { + fresh nc: Nonce; + + var ts: Timestamp; + + send_1(C,S, C, nc); + + recv_2(S,C, nc, ts, {nc, ts}k(S, C)); + + claim_C1(C,Nisynch); + claim_C2(C,Niagree); + claim_C3(C,Alive); + claim_C4(C,Weakagree); + claim_C5(C, Commit, S, nc, ts); + } + + role S { + var nc: Nonce; + + fresh ts: Timestamp; + + //send_!timestampSet(S,S, ts); + + recv_1(C,S, C, nc); + + claim_C5(S, Running, C, nc, ts); + + send_2(S,C, nc, ts, {nc, ts}k(S, C)); + + claim_S1(S,Nisynch); + claim_S2(S,Niagree); + claim_S3(S,Alive); + claim_S4(S,Weakagree); + } +}*/ + +usertype TimeStamp; +hashfunction H1; + + +protocol LATe(I,R) +{ + role I # Time Client - Initiator + { + fresh Na : Nonce; + var T : TimeStamp; + send_1(I,R,I,Na); + recv_2(R,I,Na,T,H1({Na,T}k(I,R)));#encrypt-then-hash + claim_I1(I,Nisynch); #encrypt-then-hash + claim_I2(I,Niagree); + claim_I3(I,Alive); + claim_I4(I,Weakagree); + claim_I5(I, Commit, R, Na, T); + } + + role R # Time Server - Responder + { + var Na : Nonce; + fresh T : TimeStamp; + recv_1(I,R,I,Na); + claim_C5(R, Running, I, Na, T); + send_2(R,I,Na,T,H1({Na,T}k(I,R)));#encrypt-then-hash + } +} diff --git a/secondcw/main.bib b/secondcw/main.bib new file mode 100644 index 0000000..7d200fd --- /dev/null +++ b/secondcw/main.bib @@ -0,0 +1,8 @@ +@misc{cadonfs, + author={The CADO-NFS Development Team}, + title={{CADO-NFS}, An Implementation of the Number Field Sieve + Algorithm}, + note={Release 2.3.0}, + year={2017}, + url={http://cado-nfs.inria.fr/} +}