Skip to content

Commit 31d4aaf

Browse files
committed
Update ecc_recover_key() docs.
This also adds a note about the potential limitation of the signature formats, depending on the tailoring. Signed-off-by: Steffen Jaeckel <[email protected]>
1 parent 57bfd0c commit 31d4aaf

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Diff for: doc/crypt.tex

+13-9
Original file line numberDiff line numberDiff line change
@@ -5953,18 +5953,18 @@ \subsection{Public Key Recovery}
59535953
ecc_key *key);
59545954
\end{verbatim}
59555955

5956-
This function will recover (a) public key from the ECDSA signature in the array pointed to by \textit{sig} of length \textit{siglen} octets, the message digest
5957-
pointed to by the array \textit{hash} of length \textit{hashlen}, and the recovery id \textit{recid}. It will store the recovered
5958-
key into \textit{key} and return CRYPT\_OK if recovery succeeds, or an error if recovery fails.
5956+
This function will recover (a) public key from the \textit{ECDSA} signature in the array pointed to by \code{sig} of length \code{siglen} octets, the message digest
5957+
pointed to by the array \code{hash} of length \code{hashlen}, and the recovery id \code{recid}. It will store the recovered
5958+
key into \code{key} and return \code{CRYPT\_OK} if recovery succeeds, or an error if recovery fails.
59595959
This is for compatibility with the (v,r,s) signatures used in Ethereum, where public keys are not explicitly shared,
5960-
only the parity of the public key. For curves like secp256k1, recid will take values of 0 or 1, corresponding to the
5961-
parity of the public key's y coordinate. For curves like secp112r2, with a cofactor of 4, values 0..7 are possible,
5960+
only the parity of the public key. For curves like \textit{secp256k1}, \code{recid} will take values of 0 or 1, corresponding to the
5961+
parity of the public key's y coordinate. For curves like \textit{secp112r2}, with a cofactor of 4, values 0..7 are possible,
59625962
with the low bit corresponding to the parity and the higher bits specifying the public key's x coordinate's multiple
59635963
of the curve's order.
5964-
If the signature format contains the recovery id (currently only \textit{LTC\_ECCSIG\_ETH27}), \textit{recid} can be -1
5964+
If the signature format contains the recovery id (currently only \code{LTC\_ECCSIG\_ETH27}), \code{recid} can be -1
59655965
which signals that the recovery id from the signature blob should be used. This means an application does not need to
59665966
extract the recovery id from such a signature in order to use this function.
5967-
The function \textit{ecc\_recover\_key} implements multiple signature formats, and the output is compliant for GF(p) curves.
5967+
The function \code{ecc\_recover\_key()} implements multiple signature formats, and the output is compliant for GF(p) curves.
59685968

59695969
\subsection{Signature Formats}
59705970
The following signature formats are suported:
@@ -5987,9 +5987,13 @@ \subsection{Signature Formats}
59875987
\label{fig:sigformat}
59885988
\end{figure}
59895989

5990-
The \textit{LTC\_ECCSIG\_ETH27} format is based on the Ethereum Yellow Paper, see \url{https://github.com/ethereum/yellowpaper}
5990+
The \code{LTC\_ECCSIG\_ETH27} format is based on the Ethereum Yellow Paper, see \url{https://github.com/ethereum/yellowpaper}
59915991
(Appendix F). However, convention allows the use of v=0,1 as equivalent to v=27,28 and both are accepted by
5992-
\textit{ecc\_recover\_key}.
5992+
\code{ecc\_recover\_key()}.
5993+
5994+
\textbf{NOTE:} If you're using a tailored version of libtomcrypt, it is possible to disable \code{LTC\_DER} which will disable
5995+
the option to use \code{LTC\_ECCSIG\_ANSIX962}. Also it is possible to disable \code{LTC\_SSH} which will disable
5996+
the option to use \code{LTC\_ECCSIG\_RFC5656}.
59935997

59945998
\mysection{Shared Secret (ECDH)}
59955999
To construct a Diffie-Hellman shared secret with a private and public ECC key, use the following function:

0 commit comments

Comments
 (0)