[otbn/dif] Use void* instead of uint32_t* for memcpy() parameters

Before, we used uint32_t* for in and out arguments to OTBN's instruction
and data memory access functions; we did this to indicate an alignment
requirement on the Ibex side, and to indicate the required data
granularity, which are multiples of 32b words.

This commit switches to use `void*` instead, on the following grounds:
* There is no alignment requirement for this data, it gets passed on to
  a function which also takes a `void*` argument and deals with
  unaligned data properly.
  (It is, of course, more efficient to provide aligned data; that's up
  to the caller, however.)
* The granularity is checked within the function by checking
  `len_bytes`.
* Being able to pass byte arrays into the instruction and data memory write
  functions makes code significantly easier to read (compared to passing
  uint32_t items): OTBN data is often a wide number, e.g. a 1024b
  number, passed in as little-endian data. Writing such a large number
  in uin32_t integers in code makes the code hard to read, as one needs
  to read each integer byte-wise from back to front, move on to the next
  integer, and do the same again.

For example, to write the number 0x0706050403020100 in code:

```
uint32_t a[2] = { 0x03020100, 0x07060504 };
uint8_t b[8] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
```

On uint8_t* vs void*: void* is used by the underlying memcpy() functions
and slightly more convenient to use, so I chose that (it's also
consistent with expectations from normal memcpy()).

Signed-off-by: Philipp Wagner <phw@lowrisc.org>
2 files changed
tree: 35ccd91e2e747054ac032bdcebfca11a2accabe5
  1. .github/
  2. ci/
  3. doc/
  4. hw/
  5. site/
  6. sw/
  7. test/
  8. util/
  9. .clang-format
  10. .dockerignore
  11. .flake8
  12. .gitignore
  13. .style.yapf
  14. .svlint.toml
  15. .svls.toml
  16. _index.md
  17. apt-requirements.txt
  18. azure-pipelines.yml
  19. check_tool_requirements.core
  20. CLA
  21. COMMITTERS
  22. CONTRIBUTING.md
  23. LICENSE
  24. meson.build
  25. meson_init.sh
  26. meson_options.txt
  27. python-requirements.txt
  28. README.md
  29. tool_requirements.py
  30. toolchain.txt
README.md

OpenTitan

OpenTitan logo

About the project

OpenTitan is an open source silicon Root of Trust (RoT) project. OpenTitan will make the silicon RoT design and implementation more transparent, trustworthy, and secure for enterprises, platform providers, and chip manufacturers. OpenTitan is administered by lowRISC CIC as a collaborative project to produce high quality, open IP for instantiation as a full-featured product. See the OpenTitan site and OpenTitan docs for more information about the project.

About this repository

This repository contains hardware, software and utilities written as part of the OpenTitan project. It is structured as monolithic repository, or “monorepo”, where all components live in one repository. It exists to enable collaboration across partners participating in the OpenTitan project.

Documentation

The project contains comprehensive documentation of all IPs and tools. You can access it online at docs.opentitan.org.

How to contribute

Have a look at CONTRIBUTING for guidelines on how to contribute code to this repository.

Licensing

Unless otherwise noted, everything in this repository is covered by the Apache License, Version 2.0 (see LICENSE for full text).