[Cryptech Tech] Pascal indexing?

Paul Selkirk paul at psgd.org
Mon May 4 19:04:20 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/04/2015 08:49 AM, Joachim Strömbergson wrote:
> One thing I noted in the cryptech.h is that bits seems to be
> counted from 1 and onwards, not 0 and onwards as I'm used to in C.
> Since the cores define bits as in C it becomes slightly confusing.

Those are bit masks rather than bit positions, i.e. bit position 0 is
value 1, bit position 1 is value 2. If we had more than 2 control or
status bits defined, it would be more obvious that bit position 2 is
value 4, etc.

If you think it would be clearer to express bits positionally, or to
express them in terms of shifts (e.g. INIT=1<<0, NEXT=1<<1), I can
make that change.

An additional complication is that we define CTRL_INIT_BIT and
CTRL_INIT_CMD with the same semantics and the same value. That's pure
sloppiness, probably my fault.

You also define things like AES_CTRL_INIT_BIT equal to CTRL_INIT_BIT,
which I think is unnecessary; if we want all cores to use the same
values for INIT and NEXT, READY and VALID, then we should use the base
names, rather than cluttering the namespace with redundant names.

				paul
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJVR8K0AAoJELAqzRn9CEWTyigIAMzbVkeb2gLrJrYySIi4yXTE
d5HDm/iI5r+rNiIAN7FuNsNhrouE7/nebhSMr0ieMslRxyTUG9Uofxc+t9ksvT1W
zXVf50tc69KN3Og1z7YF6oNdTrGON570W2RLh8g4pyPJzW1ZOsry4lSjZeo78FW1
BNDysgomCtAUltZHzWZdB6hyT+rrsIFuhdaFWRljJmrfL/IDSwrhYb9DvKemF+Mv
Y60IMXXQNPgehqa05i3k2RxlgzPTAvw9sICInK5kV8Dhc705DnHUdGq+HxWwUMRz
Up0dFIpzXij3uKKR/aXOWR2yHOVvewCjxL0SVZE48cKg/9EGskIM+e/4cCbIY7Q=
=xC2Z
-----END PGP SIGNATURE-----


More information about the Tech mailing list