Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/nettle/gostdsa.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* gostdsa.h
0002 
0003    Copyright (C) 2015 Dmity Eremin-Solenikov
0004    Copyright (C) 2013 Niels Möller
0005 
0006    This file is part of GNU Nettle.
0007 
0008    GNU Nettle is free software: you can redistribute it and/or
0009    modify it under the terms of either:
0010 
0011      * the GNU Lesser General Public License as published by the Free
0012        Software Foundation; either version 3 of the License, or (at your
0013        option) any later version.
0014 
0015    or
0016 
0017      * the GNU General Public License as published by the Free
0018        Software Foundation; either version 2 of the License, or (at your
0019        option) any later version.
0020 
0021    or both in parallel, as here.
0022 
0023    GNU Nettle is distributed in the hope that it will be useful,
0024    but WITHOUT ANY WARRANTY; without even the implied warranty of
0025    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0026    General Public License for more details.
0027 
0028    You should have received copies of the GNU General Public License and
0029    the GNU Lesser General Public License along with this program.  If
0030    not, see http://www.gnu.org/licenses/.
0031 */
0032 
0033 #ifndef NETTLE_GOSTDSA_H_INCLUDED
0034 #define NETTLE_GOSTDSA_H_INCLUDED
0035 
0036 #include "ecc.h"
0037 #include "dsa.h"
0038 #include "ecdsa.h"
0039 
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043 
0044 /* Name mangling */
0045 #define gostdsa_sign nettle_gostdsa_sign
0046 #define gostdsa_verify nettle_gostdsa_verify
0047 #define gostdsa_vko nettle_gostdsa_vko
0048 #define ecc_gostdsa_sign nettle_ecc_gostdsa_sign
0049 #define ecc_gostdsa_sign_itch nettle_ecc_gostdsa_sign_itch
0050 #define ecc_gostdsa_verify nettle_ecc_gostdsa_verify
0051 #define ecc_gostdsa_verify_itch nettle_ecc_gostdsa_verify_itch
0052 
0053 /* Just use ECDSA function for key generation */
0054 #define gostdsa_generate_keypair ecdsa_generate_keypair
0055 
0056 /* High level GOST DSA functions.
0057  *
0058  * A public key is represented as a struct ecc_point, and a private
0059  * key as a struct ecc_scalar. */
0060 void
0061 gostdsa_sign (const struct ecc_scalar *key,
0062           void *random_ctx, nettle_random_func *random,
0063           size_t digest_length,
0064           const uint8_t *digest,
0065           struct dsa_signature *signature);
0066 
0067 int
0068 gostdsa_verify (const struct ecc_point *pub,
0069             size_t length, const uint8_t *digest,
0070             const struct dsa_signature *signature);
0071 
0072 void
0073 gostdsa_vko (const struct ecc_scalar *key,
0074          const struct ecc_point *pub,
0075          size_t ukm_length, const uint8_t *ukm,
0076          uint8_t *out);
0077 
0078 /* Low-level GOSTDSA functions. */
0079 mp_size_t
0080 ecc_gostdsa_sign_itch (const struct ecc_curve *ecc);
0081 
0082 void
0083 ecc_gostdsa_sign (const struct ecc_curve *ecc,
0084         const mp_limb_t *zp,
0085         /* Random nonce, must be invertible mod ecc group
0086            order. */
0087         const mp_limb_t *kp,
0088         size_t length, const uint8_t *digest,
0089         mp_limb_t *rp, mp_limb_t *sp,
0090         mp_limb_t *scratch);
0091 
0092 mp_size_t
0093 ecc_gostdsa_verify_itch (const struct ecc_curve *ecc);
0094 
0095 int
0096 ecc_gostdsa_verify (const struct ecc_curve *ecc,
0097           const mp_limb_t *pp, /* Public key */
0098           size_t length, const uint8_t *digest,
0099           const mp_limb_t *rp, const mp_limb_t *sp,
0100           mp_limb_t *scratch);
0101 
0102 
0103 #ifdef __cplusplus
0104 }
0105 #endif
0106 
0107 #endif /* NETTLE_GOSTDSA_H_INCLUDED */