blob: 39a062666b0e6219b28c453ff02b9e1982426ea0 [file] [log] [blame]
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +01001/**
2 * \file ecdsa.h
3 *
4 * \brief Elliptic curve DSA
5 *
6 * Copyright (C) 2006-2013, Brainspark B.V.
7 *
8 * This file is part of PolarSSL (http://www.polarssl.org)
9 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
10 *
11 * All rights reserved.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27#ifndef POLARSSL_ECDSA_H
28#define POLARSSL_ECDSA_H
29
30#include "polarssl/ecp.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/**
Manuel Pégourié-Gonnardb309ab22013-01-26 17:24:59 +010037 * \brief Compute ECDSA signature of a previously hashed message
38 *
39 * \param grp ECP group
40 * \param r First output integer
41 * \param s Second output integer
42 * \param d Private signing key
43 * \param buf Message hash
44 * \param blen Length of buf
45 * \param f_rng RNG function
46 * \param p_rng RNG parameter
47 *
48 * \return 0 if successful,
49 * or a POLARSSL_ERR_ECP_XXX or POLARSSL_MPI_XXX error code
50 */
51int ecdsa_sign( const ecp_group *grp, mpi *r, mpi *s,
52 const mpi *d, const unsigned char *buf, size_t blen,
53 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
54
55/**
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010056 * \brief Checkup routine
57 *
58 * \return 0 if successful, or 1 if the test failed
59 */
60int ecdsa_self_test( int verbose );
61
62#ifdef __cplusplus
63}
64#endif
65
66#endif