Introduction

On July 8th, 2024, zkSecurity was commissioned by Zorp for an audit of their hash function and elliptic curve signature implementation. The audit was conducted by two consultants over a period of two weeks. The audit focused on the correctness and security of the hash function and signature scheme.

The codebase implements the Tip5 hash function, which is explicitly designed for use in STARKs. As an algebraic hash function, it operates over elements of a finite field. The field the authors chose, known as the Goldilocks field , is 𝔽p=/p where p=264232+1.

The codebase also implements the Cheetah elliptic curve, which is also designed for use in STARKs. It operates over the same base field, and builds an elliptic curve over the extension field 𝔽p6.

Finally, the codebase implements a Schnorr signature scheme that uses these two primitives.

Scope

The scope of the audit consisted of a single Hoon files provided by the client:

  • audit.hoon — This contains the implementations of extension field arithmetic, the Tip5 hash function, Cheetah point arithmetic (in affine, projective, and Jacobian coordinate systems), and a Schnorr signature scheme.

Not in scope but provided as part of the audited code base was a second file:

  • zeke.hoon - This contains base field arithmetic and other helper functions used in audit.hoon, as well as a large amount of functionality unrelated to the audit.

Summary and general comments

Apart from performing a line-by-line audit of the code base, we produced a comprehensive test vector suite for Tip5 and Cheetah, including positive and negative test vectors for Cheetah.

We found, for the values we were able to compare, that the Tip5 hash implementation matched expected outputs. Two small correctness issues were found, one related to edge cases in curve addition, and the other to truncation of hash outputs.

In addition, since a similar but out-of-scope implementation is intended for deployment inside a zkVM, we include informational findings with important security considerations for deployment, including details of constant-timeness, curve arithmetic, choice of curve, and Schnorr challenge hash length.

We believe the Schnorr signature implementation to be secure against forgery, and signatures are non-malleable, i.e., modifying a signature makes it invalid. These properties are thanks to the checks performed on the signature values, namely that the signature scalar is reduced modulo the order of the Cheetah basepoint.