Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specification document - LaTeX to Asciidoc conversion #89

Closed
ben-marshall opened this issue Apr 21, 2021 · 4 comments
Closed

Specification document - LaTeX to Asciidoc conversion #89

ben-marshall opened this issue Apr 21, 2021 · 4 comments
Assignees
Labels
specification Improvements or additions to the specification

Comments

@ben-marshall
Copy link
Member

ben-marshall commented Apr 21, 2021

The specification needs to be converted from LaTeX to asciidoc, specifically the asciidoctor tool. This issue tries to capture what needs to happen.

What needs converting?

All of the LaTeX files under doc/spec/tex. Starting with the scalar and files shared between specifications, but moving onto the vector spec.

How will it be converted:

We can use Pandoc to bulk convert the files automatically, but there are several important gottchas while will need manual or semi-automatic fixing:

  • We have an extensive bibliography, particularly for the Entropy Source which should be preserved. Asciidoc does not have such a powerful bibliography system as LaTeX, but there is a standard way to do it described here. There is also a WiP script (bin/bibtex-to-asciidoc.py) to automatically convert the bibtex citations to the asciidoc format.

  • Pandoc does not convert the latex \cite{X} macro into an asciidoc reference. The entire citation simply disappears from the output. This will either need to be fixed manually, or semi-scripted to be fixed.

  • We currently inline the Sail code describing the functionality of our instructions into the specification, by sourcing from the Sail files directly. Pandoc is smart enough to extract the right parts of the source code in its automatically converted output. However, this will need to be manually maintained whenever the Sail code is updated, unless an automated solution exists / can be found.

  • Pandoc mangles anything in the verbatim-esq cryptoise environment. This can be manually fixed. It's just for showing assembly syntax.

  • Edited to add: It looks like there's a great set of templates/examples here

Open Questions:

  • It's not clear how to represent the encodings? We can generate these tables if need be, as is currently done for the LaTeX, though it would be good if there was a standard way to do this.

  • We currently have one monolithic specification document, which works really well as a "single source" for people to look at. It's likely that this will be split into separate components:

    • The ZKb section, which is just a list of instructions from the Bitmanip extension which are useful for Scalar Cryptography, along with some rationale.
    • The dedicated scalar cryptography instructions, which exist only in this extension.
    • The entropy source.
    • The ZKt proposal, which is orthogonal to the rest of the spec, and adds constant time guarantees to listed instructions. It is already in asciidoc, and is maintained here. It will eventually be moved into this repository.
  • It's not entirely clear whether these should be distributed as a single document, or maintained as separate files but combined into one monolithic document, as is currently done with the LaTeX sources. In any case, all of them will need to be versioned.

    • For the purposes of making progress and minimising the amount of change as we go, it might be sensible to first create a monolithic document with asciidoc as the source, and then break it into components for the purpose of ratification.
  • It's not clear how our specification will be integrated into the main specification. We want to do our conversion to asciidoc so as to minimise the effort it takes to integrate into the final specification.

Progress

Shared files:

File Automated Conversion Manual Fixes Notes
appx-benchmarking.tex Doesn't need converting. Not maintained.
appx-materials.tex [ ] [ ]
changelog.tex Doesn't need converting. Not maintained.
contributors.tex [x] [x] Done
sec-audience.tex [x] [x] Done
sec-policies.tex [x] [x] Done
sec-sail.tex [x] [x] Done
sec-scalar-profiles.tex [x] [x] Done

Scalar Crypto:

File Automated Conversion Manual Fixes Notes
sec-scalar-intro.tex [x] [x]
sec-scalar-aes.tex [x] [x]
sec-scalar-sha2.tex [x] [x]
sec-scalar-sm3.tex [x] [x]
sec-scalar-sm4.tex [x] [x]
sec-scalar-timing.tex [x] [x]
appx-scalar-encodings.tex [ ] [ ] Need some guidance on standard way to do this.
appx-scalar-sail.tex [ ] [ ]

ZKb instruction group:

File Automated Conversion Manual Fixes Notes
sec-scalar-bitmanip.tex [x] [x] Done

Entropy Source:

File Automated Conversion Manual Fixes Notes
sec-entropy-source.tex [x] [x]
appx-entropy.tex [x] [x]

Vector:

These are not a priority right now, we are focusing on the scalar crypto work.

File Automated Conversion Manual Fixes Notes
sec-vector-aes.tex [ ] [ ]
sec-vector-clmul.tex [ ] [ ]
sec-vector-grev.tex [ ] [ ]
sec-vector-intro.tex [ ] [ ]
sec-vector-profiles.tex [ ] [ ]
sec-vector-rotate.tex [ ] [ ]
sec-vector-sha2.tex [ ] [ ]
sec-vector.tex [ ] [ ]
appx-vector-encodings.tex [ ] [ ]
@ben-marshall ben-marshall added the specification Improvements or additions to the specification label Apr 21, 2021
@elisa-riscv
Copy link

In answer to your open question about whether to have a monolithic document or to break it into sections, I recommend chapter-sized chunks. The chapter-sized chunks can be grouped into sections, and all can be included in a book header file. You can find an example at https://github.com/riscv/docs-templates. Right now some specifics are subject to change and there is a bug with respect to the use of wavedrom diagramming for which we might need to provide a temporary workaround.

@ben-marshall ben-marshall self-assigned this Apr 22, 2021
ben-marshall added a commit that referenced this issue Apr 28, 2021
- See #89

- Added basic skelecton of the asciidoc specification, and can build
  it with asciidoctor. Based on riscv/doc-templates.

 On branch dev/next-release
 Your branch is up-to-date with 'origin/dev/next-release'.

 Changes to be committed:
	new file:   .gitignore
	new file:   Makefile
	new file:   images/risc-v_logo.png
	new file:   riscv-crypto-scalar-aes.adoc
	new file:   riscv-crypto-scalar-appx-encodings.adoc
	new file:   riscv-crypto-scalar-appx-entropy-source.adoc
	new file:   riscv-crypto-scalar-appx-materials.adoc
	new file:   riscv-crypto-scalar-appx-sail.adoc
	new file:   riscv-crypto-scalar-bibliography.adoc
	new file:   riscv-crypto-scalar-entropy-source.adoc
	new file:   riscv-crypto-scalar-introduction.adoc
	new file:   riscv-crypto-scalar-preface.adoc
	new file:   riscv-crypto-scalar-profiles.adoc
	new file:   riscv-crypto-scalar-sail-specifications.adoc
	new file:   riscv-crypto-scalar-sha2.adoc
	new file:   riscv-crypto-scalar-sm3.adoc
	new file:   riscv-crypto-scalar-sm4.adoc
	new file:   riscv-crypto-scalar-zkb.adoc
	new file:   riscv-crypto-scalar-zkt.adoc
	new file:   riscv-crypto-spec-scalar.adoc

 Changes not staged for commit:
	modified:   ../../extern/riscv-gnu-toolchain (modified content)
	modified:   ../../extern/riscv-isa-sim (untracked content)
	modified:   ../../extern/sail-riscv (untracked content)
ben-marshall added a commit that referenced this issue Apr 28, 2021
 On branch dev/next-release
 Your branch is up-to-date with 'origin/dev/next-release'.

 Changes to be committed:
	modified:   riscv-crypto-scalar-introduction.adoc
	modified:   riscv-crypto-scalar-sail-specifications.adoc

 Changes not staged for commit:
	modified:   ../../extern/riscv-gnu-toolchain (modified content)
	modified:   ../../extern/riscv-isa-sim (untracked content)
	modified:   ../../extern/sail-riscv (untracked content)
ben-marshall added a commit that referenced this issue Apr 28, 2021
 On branch dev/next-release
 Your branch is up-to-date with 'origin/dev/next-release'.

 Changes to be committed:
	new file:   riscv-crypto-scalar-audience.adoc
	new file:   riscv-crypto-scalar-policies.adoc
	modified:   riscv-crypto-spec-scalar.adoc
ben-marshall added a commit that referenced this issue Apr 28, 2021
 On branch dev/next-release
 Your branch is up-to-date with 'origin/dev/next-release'.

 Changes to be committed:
	modified:   riscv-crypto-scalar-profiles.adoc

 Changes not staged for commit:
	modified:   ../../extern/riscv-gnu-toolchain (modified content)
	modified:   ../../extern/riscv-isa-sim (untracked content)
	modified:   ../../extern/sail-riscv (untracked content)
@ben-marshall
Copy link
Member Author

Hi @elisa-riscv

I've made a start translating some parts of the specification which are very stable just to try things out. Your template repository and guide have been extremely helpful!

The asciidoc source so far can be seen here and I've attached a working copy to this comment (riscv-crypto-spec-scalar.pdf). Without wanting to take up too much of your time, I hope I'm going in the right direction?

Cheers,
Ben

@elisa-riscv
Copy link

elisa-riscv commented Apr 28, 2021 via email

ben-marshall added a commit that referenced this issue May 12, 2021
 On branch dev/next-release
 Your branch is up-to-date with 'origin/dev/next-release'.

 Changes to be committed:
	modified:   riscv-crypto-scalar-zkb.adoc

 Changes not staged for commit:
	modified:   ../../extern/riscv-docs-templates (modified content)
	modified:   ../../extern/riscv-gnu-toolchain (modified content)
	modified:   ../../extern/riscv-isa-sim (untracked content)
	modified:   ../../extern/sail-riscv (untracked content)
ben-marshall added a commit that referenced this issue May 28, 2021
- Changed layout and organisation to match bitmanip based on how the
  wind is blowing.

 On branch dev/next-release
 Your branch is up-to-date with 'origin/dev/next-release'.

 Changes to be committed:
	new file:   insns/aes32dsi.adoc
	new file:   insns/aes32dsmi.adoc
	new file:   insns/aes32esi.adoc
	new file:   insns/aes32esmi.adoc
	new file:   insns/aes64ds.adoc
	new file:   insns/aes64dsm.adoc
	new file:   insns/aes64es.adoc
	new file:   insns/aes64esm.adoc
	new file:   insns/aes64im.adoc
	new file:   insns/aes64ks1i.adoc
	new file:   insns/aes64ks2.adoc
	new file:   insns/sha256sig0.adoc
	new file:   insns/sha256sig1.adoc
	new file:   insns/sha256sum0.adoc
	new file:   insns/sha256sum1.adoc
	new file:   insns/sha512sig0.adoc
	new file:   insns/sha512sig0h.adoc
	new file:   insns/sha512sig0l.adoc
	new file:   insns/sha512sig1.adoc
	new file:   insns/sha512sig1h.adoc
	new file:   insns/sha512sig1l.adoc
	new file:   insns/sha512sum0.adoc
	new file:   insns/sha512sum0r.adoc
	new file:   insns/sha512sum1.adoc
	new file:   insns/sha512sum1r.adoc
	new file:   insns/sm3p0.adoc
	new file:   insns/sm3p1.adoc
	new file:   insns/sm4ed.adoc
	new file:   insns/sm4ks.adoc
	deleted:    riscv-crypto-scalar-aes32.adoc
	deleted:    riscv-crypto-scalar-aes64.adoc
	modified:   riscv-crypto-scalar-profiles.adoc
	deleted:    riscv-crypto-scalar-sha256.adoc
	deleted:    riscv-crypto-scalar-sha512-rv32.adoc
	deleted:    riscv-crypto-scalar-sha512-rv64.adoc
	deleted:    riscv-crypto-scalar-sm3.adoc
	deleted:    riscv-crypto-scalar-sm4.adoc
	modified:   riscv-crypto-scalar-zkt.adoc
	modified:   riscv-crypto-spec-scalar.adoc
	modified:   ../../extern/sail-riscv

 Changes not staged for commit:
	modified:   ../../extern/riscv-docs-templates (modified content)
	modified:   ../../extern/riscv-gnu-toolchain (modified content)
	modified:   ../../extern/riscv-isa-sim (untracked content)
	modified:   ../../extern/sail-riscv (untracked content)
@ben-marshall
Copy link
Member Author

Closed with release v0.9.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
specification Improvements or additions to the specification
Projects
None yet
Development

No branches or pull requests

2 participants