mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 17:56:16 +00:00
535 lines
31 KiB
HTML
535 lines
31 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.14"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Dash Core: src/secp256k1/src/modules/schnorr/main_impl.h File Reference</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(initResizable);
|
|
/* @license-end */</script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectlogo"><img alt="Logo" src="bitcoin_logo_doxygen.png"/></td>
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">Dash Core
|
|
 <span id="projectnumber">0.12.2.1</span>
|
|
</div>
|
|
<div id="projectbrief">P2P Digital Currency</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.14 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(function(){initNavTree('schnorr_2main__impl_8h.html','');});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#func-members">Functions</a> |
|
|
<a href="#var-members">Variables</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">main_impl.h File Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="textblock"><code>#include "<a class="el" href="secp256k1__schnorr_8h_source.html">include/secp256k1_schnorr.h</a>"</code><br />
|
|
<code>#include "<a class="el" href="schnorr__impl_8h_source.html">modules/schnorr/schnorr_impl.h</a>"</code><br />
|
|
</div>
|
|
<p><a href="schnorr_2main__impl_8h_source.html">Go to the source code of this file.</a></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:aceb4e15773d1a0ef0bd3b13e7339a199"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="schnorr_2main__impl_8h.html#aceb4e15773d1a0ef0bd3b13e7339a199">secp256k1_schnorr_msghash_sha256</a> (unsigned char *h32, const unsigned char *r32, const unsigned char *msg32)</td></tr>
|
|
<tr class="separator:aceb4e15773d1a0ef0bd3b13e7339a199"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a0d7ae4600f16da7c9464c80fefc72072"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="schnorr_2main__impl_8h.html#a0d7ae4600f16da7c9464c80fefc72072">secp256k1_schnorr_sign</a> (const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> *<a class="el" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, unsigned char *sig64, const unsigned char *msg32, const unsigned char *seckey, <a class="el" href="secp256k1_8h.html#a539882fd91bff672712fa19a4cfaeb98">secp256k1_nonce_function</a> noncefp, const void *noncedata)</td></tr>
|
|
<tr class="separator:a0d7ae4600f16da7c9464c80fefc72072"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a5d23afb11115cb53171b34da09ff3ad0"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="schnorr_2main__impl_8h.html#a5d23afb11115cb53171b34da09ff3ad0">secp256k1_schnorr_verify</a> (const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> *<a class="el" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, const unsigned char *sig64, const unsigned char *msg32, const <a class="el" href="structsecp256k1__pubkey.html">secp256k1_pubkey</a> *pubkey)</td></tr>
|
|
<tr class="separator:a5d23afb11115cb53171b34da09ff3ad0"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aa4480a44de97ffc056712ea9fd9631c5"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="schnorr_2main__impl_8h.html#aa4480a44de97ffc056712ea9fd9631c5">secp256k1_schnorr_recover</a> (const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> *<a class="el" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, <a class="el" href="structsecp256k1__pubkey.html">secp256k1_pubkey</a> *pubkey, const unsigned char *sig64, const unsigned char *msg32)</td></tr>
|
|
<tr class="separator:aa4480a44de97ffc056712ea9fd9631c5"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a67c4e4b188db3530c2e8808162f3a3c5"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="schnorr_2main__impl_8h.html#a67c4e4b188db3530c2e8808162f3a3c5">secp256k1_schnorr_generate_nonce_pair</a> (const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> *<a class="el" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, <a class="el" href="structsecp256k1__pubkey.html">secp256k1_pubkey</a> *pubnonce, unsigned char *privnonce32, const unsigned char *sec32, const unsigned char *msg32, <a class="el" href="secp256k1_8h.html#a539882fd91bff672712fa19a4cfaeb98">secp256k1_nonce_function</a> noncefp, const void *noncedata)</td></tr>
|
|
<tr class="separator:a67c4e4b188db3530c2e8808162f3a3c5"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a6787237abf20a26c8c2fb195102ce810"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="schnorr_2main__impl_8h.html#a6787237abf20a26c8c2fb195102ce810">secp256k1_schnorr_partial_sign</a> (const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> *<a class="el" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, unsigned char *sig64, const unsigned char *msg32, const unsigned char *sec32, const <a class="el" href="structsecp256k1__pubkey.html">secp256k1_pubkey</a> *pubnonce_others, const unsigned char *secnonce32)</td></tr>
|
|
<tr class="separator:a6787237abf20a26c8c2fb195102ce810"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a7dd43d7414424c68563e14d0bda8e867"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="schnorr_2main__impl_8h.html#a7dd43d7414424c68563e14d0bda8e867">secp256k1_schnorr_partial_combine</a> (const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> *<a class="el" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, unsigned char *sig64, const unsigned char *const *sig64sin, size_t n)</td></tr>
|
|
<tr class="separator:a7dd43d7414424c68563e14d0bda8e867"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
|
|
Variables</h2></td></tr>
|
|
<tr class="memitem:a0071b298840127ff32142118f0761276"><td class="memItemLeft" align="right" valign="top">static const unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="schnorr_2main__impl_8h.html#a0071b298840127ff32142118f0761276">secp256k1_schnorr_algo16</a> [17] = "Schnorr+SHA256 "</td></tr>
|
|
<tr class="separator:a0071b298840127ff32142118f0761276"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<h2 class="groupheader">Function Documentation</h2>
|
|
<a id="a67c4e4b188db3530c2e8808162f3a3c5"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a67c4e4b188db3530c2e8808162f3a3c5">◆ </a></span>secp256k1_schnorr_generate_nonce_pair()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int secp256k1_schnorr_generate_nonce_pair </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> * </td>
|
|
<td class="paramname"><em>ctx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="structsecp256k1__pubkey.html">secp256k1_pubkey</a> * </td>
|
|
<td class="paramname"><em>pubnonce</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned char * </td>
|
|
<td class="paramname"><em>privnonce32</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>msg32</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>sec32</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="secp256k1_8h.html#a539882fd91bff672712fa19a4cfaeb98">secp256k1_nonce_function</a> </td>
|
|
<td class="paramname"><em>noncefp</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const void * </td>
|
|
<td class="paramname"><em>noncedata</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Generate a nonce pair deterministically for use with secp256k1_schnorr_partial_sign. Returns: 1: valid nonce pair was generated. 0: otherwise (nonce generation function failed) Args: ctx: pointer to a context object, initialized for signing (cannot be NULL) Out: pubnonce: public side of the nonce (cannot be NULL) privnonce32: private side of the nonce (32 byte) (cannot be NULL) In: msg32: the 32-byte message hash assumed to be signed (cannot be NULL) sec32: the 32-byte private key (cannot be NULL) noncefp: pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used noncedata: pointer to arbitrary data used by the nonce generation function (can be NULL)</p>
|
|
<p>Do not use the output as a private/public key pair for signing/validation. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="schnorr_2main__impl_8h_source.html#l00091">91</a> of file <a class="el" href="schnorr_2main__impl_8h_source.html">main_impl.h</a>.</p>
|
|
|
|
<p class="reference">Referenced by <a class="el" href="schnorr_2tests__impl_8h_source.html#l00085">test_schnorr_threshold()</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aceb4e15773d1a0ef0bd3b13e7339a199"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aceb4e15773d1a0ef0bd3b13e7339a199">◆ </a></span>secp256k1_schnorr_msghash_sha256()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">static void secp256k1_schnorr_msghash_sha256 </td>
|
|
<td>(</td>
|
|
<td class="paramtype">unsigned char * </td>
|
|
<td class="paramname"><em>h32</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>r32</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>msg32</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p class="definition">Definition at line <a class="el" href="schnorr_2main__impl_8h_source.html#l00013">13</a> of file <a class="el" href="schnorr_2main__impl_8h_source.html">main_impl.h</a>.</p>
|
|
|
|
<p class="reference">Referenced by <a class="el" href="schnorr_2main__impl_8h_source.html#l00133">secp256k1_schnorr_partial_sign()</a>, <a class="el" href="schnorr_2main__impl_8h_source.html#l00073">secp256k1_schnorr_recover()</a>, <a class="el" href="schnorr_2main__impl_8h_source.html#l00023">secp256k1_schnorr_sign()</a>, and <a class="el" href="schnorr_2main__impl_8h_source.html#l00061">secp256k1_schnorr_verify()</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a7dd43d7414424c68563e14d0bda8e867"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a7dd43d7414424c68563e14d0bda8e867">◆ </a></span>secp256k1_schnorr_partial_combine()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int secp256k1_schnorr_partial_combine </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> * </td>
|
|
<td class="paramname"><em>ctx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned char * </td>
|
|
<td class="paramname"><em>sig64</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char *const * </td>
|
|
<td class="paramname"><em>sig64sin</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>n</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Combine multiple Schnorr partial signatures. Returns: 1: the passed signatures were successfully combined. 0: the resulting signature is not valid (chance of 1 in 2^256) -1: some inputs were invalid, or the signatures were not created using the same set of nonces Args: ctx: pointer to a context object Out: sig64: pointer to a 64-byte array to place the combined signature (cannot be NULL) In: sig64sin: pointer to an array of n pointers to 64-byte input signatures n: the number of signatures to combine (at least 1) </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="schnorr_2main__impl_8h_source.html#l00157">157</a> of file <a class="el" href="schnorr_2main__impl_8h_source.html">main_impl.h</a>.</p>
|
|
|
|
<p class="reference">Referenced by <a class="el" href="schnorr_2tests__impl_8h_source.html#l00085">test_schnorr_threshold()</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a6787237abf20a26c8c2fb195102ce810"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a6787237abf20a26c8c2fb195102ce810">◆ </a></span>secp256k1_schnorr_partial_sign()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int secp256k1_schnorr_partial_sign </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> * </td>
|
|
<td class="paramname"><em>ctx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned char * </td>
|
|
<td class="paramname"><em>sig64</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>msg32</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>sec32</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const <a class="el" href="structsecp256k1__pubkey.html">secp256k1_pubkey</a> * </td>
|
|
<td class="paramname"><em>pubnonce_others</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>secnonce32</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Produce a partial Schnorr signature, which can be combined using secp256k1_schnorr_partial_combine, to end up with a full signature that is verifiable using secp256k1_schnorr_verify. Returns: 1: signature created successfully. 0: no valid signature exists with this combination of keys, nonces and message (chance around 1 in 2^128) -1: invalid private key, nonce, or public nonces. Args: ctx: pointer to context object, initialized for signing (cannot be NULL) Out: sig64: pointer to 64-byte array to put partial signature in In: msg32: pointer to 32-byte message to sign sec32: pointer to 32-byte private key pubnonce_others: pointer to pubkey containing the sum of the other's nonces (see secp256k1_ec_pubkey_combine) secnonce32: pointer to 32-byte array containing our nonce</p>
|
|
<p>The intended procedure for creating a multiparty signature is:</p><ul>
|
|
<li>Each signer S[i] with private key x[i] and public key Q[i] runs secp256k1_schnorr_generate_nonce_pair to produce a pair (k[i],R[i]) of private/public nonces.</li>
|
|
<li>All signers communicate their public nonces to each other (revealing your private nonce can lead to discovery of your private key, so it should be considered secret).</li>
|
|
<li>All signers combine all the public nonces they received (excluding their own) using secp256k1_ec_pubkey_combine to obtain an Rall[i] = sum(R[0..i-1,i+1..n]).</li>
|
|
<li>All signers produce a partial signature using secp256k1_schnorr_partial_sign, passing in their own private key x[i], their own private nonce k[i], and the sum of the others' public nonces Rall[i].</li>
|
|
<li>All signers communicate their partial signatures to each other.</li>
|
|
<li>Someone combines all partial signatures using secp256k1_schnorr_partial_combine, to obtain a full signature.</li>
|
|
<li><p class="startli">The resulting signature is validatable using secp256k1_schnorr_verify, with public key equal to the result of secp256k1_ec_pubkey_combine of the signers' public keys (sum(Q[0..n])).</p>
|
|
<p class="startli">Note that secp256k1_schnorr_partial_combine and secp256k1_ec_pubkey_combine function take their arguments in any order, and it is possible to pre-combine several inputs already with one call, and add more inputs later by calling the function again (they are commutative and associative). </p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="schnorr_2main__impl_8h_source.html#l00133">133</a> of file <a class="el" href="schnorr_2main__impl_8h_source.html">main_impl.h</a>.</p>
|
|
|
|
<p class="reference">Referenced by <a class="el" href="schnorr_2tests__impl_8h_source.html#l00085">test_schnorr_threshold()</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aa4480a44de97ffc056712ea9fd9631c5"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aa4480a44de97ffc056712ea9fd9631c5">◆ </a></span>secp256k1_schnorr_recover()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int secp256k1_schnorr_recover </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> * </td>
|
|
<td class="paramname"><em>ctx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="structsecp256k1__pubkey.html">secp256k1_pubkey</a> * </td>
|
|
<td class="paramname"><em>pubkey</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>sig64</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>msg32</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Recover an EC public key from a Schnorr signature created using secp256k1_schnorr_sign. Returns: 1: public key successfully recovered (which guarantees a correct signature). 0: otherwise. Args: ctx: pointer to a context object, initialized for verification (cannot be NULL) Out: pubkey: pointer to a pubkey to set to the recovered public key (cannot be NULL). In: sig64: signature as 64 byte array (cannot be NULL) msg32: the 32-byte message hash assumed to be signed (cannot be NULL) </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="schnorr_2main__impl_8h_source.html#l00073">73</a> of file <a class="el" href="schnorr_2main__impl_8h_source.html">main_impl.h</a>.</p>
|
|
|
|
<p class="reference">Referenced by <a class="el" href="schnorr_2tests__impl_8h_source.html#l00012">test_schnorr_end_to_end()</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a0d7ae4600f16da7c9464c80fefc72072"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a0d7ae4600f16da7c9464c80fefc72072">◆ </a></span>secp256k1_schnorr_sign()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int secp256k1_schnorr_sign </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> * </td>
|
|
<td class="paramname"><em>ctx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned char * </td>
|
|
<td class="paramname"><em>sig64</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>msg32</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>seckey</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="secp256k1_8h.html#a539882fd91bff672712fa19a4cfaeb98">secp256k1_nonce_function</a> </td>
|
|
<td class="paramname"><em>noncefp</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const void * </td>
|
|
<td class="paramname"><em>ndata</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Create a signature using a custom EC-Schnorr-SHA256 construction. It produces non-malleable 64-byte signatures which support public key recovery batch validation, and multiparty signing. Returns: 1: signature created 0: the nonce generation function failed, or the private key was invalid. Args: ctx: pointer to a context object, initialized for signing (cannot be NULL) Out: sig64: pointer to a 64-byte array where the signature will be placed (cannot be NULL) In: msg32: the 32-byte message hash being signed (cannot be NULL) seckey: pointer to a 32-byte secret key (cannot be NULL) noncefp:pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used ndata: pointer to arbitrary data used by the nonce generation function (can be NULL) </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="schnorr_2main__impl_8h_source.html#l00023">23</a> of file <a class="el" href="schnorr_2main__impl_8h_source.html">main_impl.h</a>.</p>
|
|
|
|
<p class="reference">Referenced by <a class="el" href="bench__schnorr__verify_8c_source.html#l00029">benchmark_schnorr_init()</a>, and <a class="el" href="schnorr_2tests__impl_8h_source.html#l00012">test_schnorr_end_to_end()</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a5d23afb11115cb53171b34da09ff3ad0"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a5d23afb11115cb53171b34da09ff3ad0">◆ </a></span>secp256k1_schnorr_verify()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int secp256k1_schnorr_verify </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="secp256k1_8h.html#a282ec9e6dfec8c35955c3eb2f7476e5e">secp256k1_context</a> * </td>
|
|
<td class="paramname"><em>ctx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>sig64</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>msg32</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const <a class="el" href="structsecp256k1__pubkey.html">secp256k1_pubkey</a> * </td>
|
|
<td class="paramname"><em>pubkey</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Verify a signature created by secp256k1_schnorr_sign. Returns: 1: correct signature 0: incorrect signature Args: ctx: a secp256k1 context object, initialized for verification. In: sig64: the 64-byte signature being verified (cannot be NULL) msg32: the 32-byte message hash being verified (cannot be NULL) pubkey: the public key to verify with (cannot be NULL) </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="schnorr_2main__impl_8h_source.html#l00061">61</a> of file <a class="el" href="schnorr_2main__impl_8h_source.html">main_impl.h</a>.</p>
|
|
|
|
<p class="reference">Referenced by <a class="el" href="bench__schnorr__verify_8c_source.html#l00048">benchmark_schnorr_verify()</a>, <a class="el" href="schnorr_2tests__impl_8h_source.html#l00012">test_schnorr_end_to_end()</a>, and <a class="el" href="schnorr_2tests__impl_8h_source.html#l00085">test_schnorr_threshold()</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Variable Documentation</h2>
|
|
<a id="a0071b298840127ff32142118f0761276"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a0071b298840127ff32142118f0761276">◆ </a></span>secp256k1_schnorr_algo16</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const unsigned char secp256k1_schnorr_algo16[17] = "Schnorr+SHA256 "</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p class="definition">Definition at line <a class="el" href="schnorr_2main__impl_8h_source.html#l00021">21</a> of file <a class="el" href="schnorr_2main__impl_8h_source.html">main_impl.h</a>.</p>
|
|
|
|
<p class="reference">Referenced by <a class="el" href="schnorr_2main__impl_8h_source.html#l00091">secp256k1_schnorr_generate_nonce_pair()</a>, and <a class="el" href="schnorr_2main__impl_8h_source.html#l00023">secp256k1_schnorr_sign()</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_44f34d1e62fda08bdb4ca69ab2d205ae.html">secp256k1</a></li><li class="navelem"><a class="el" href="dir_8db2ef784512d48b2a7d00369dfaac28.html">src</a></li><li class="navelem"><a class="el" href="dir_403fe05abfd2d392aa3c0b8c300f7bf6.html">modules</a></li><li class="navelem"><a class="el" href="dir_352c5ce840d1898571e8326f33f31f12.html">schnorr</a></li><li class="navelem"><a class="el" href="schnorr_2main__impl_8h.html">main_impl.h</a></li>
|
|
<li class="footer">Generated on Thu Dec 14 2017 13:15:11 for Dash Core by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|