File indexing completed on 2025-01-18 10:02:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef NETTLE_ECC_H_INCLUDED
0035 #define NETTLE_ECC_H_INCLUDED
0036
0037 #include "nettle-types.h"
0038 #include "bignum.h"
0039
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043
0044
0045 #define ecc_point_init nettle_ecc_point_init
0046 #define ecc_point_clear nettle_ecc_point_clear
0047 #define ecc_point_set nettle_ecc_point_set
0048 #define ecc_point_get nettle_ecc_point_get
0049 #define ecc_point_mul nettle_ecc_point_mul
0050 #define ecc_point_mul_g nettle_ecc_point_mul_g
0051 #define ecc_scalar_init nettle_ecc_scalar_init
0052 #define ecc_scalar_clear nettle_ecc_scalar_clear
0053 #define ecc_scalar_set nettle_ecc_scalar_set
0054 #define ecc_scalar_get nettle_ecc_scalar_get
0055 #define ecc_scalar_random nettle_ecc_scalar_random
0056 #define ecc_point_mul nettle_ecc_point_mul
0057 #define ecc_bit_size nettle_ecc_bit_size
0058 #define ecc_size nettle_ecc_size
0059 #define ecc_size_a nettle_ecc_size_a
0060 #define ecc_size_j nettle_ecc_size_j
0061
0062 struct ecc_curve;
0063
0064
0065
0066
0067 struct ecc_point
0068 {
0069 const struct ecc_curve *ecc;
0070
0071 mp_limb_t *p;
0072 };
0073
0074
0075
0076 struct ecc_scalar
0077 {
0078 const struct ecc_curve *ecc;
0079
0080 mp_limb_t *p;
0081 };
0082
0083 void
0084 ecc_point_init (struct ecc_point *p, const struct ecc_curve *ecc);
0085 void
0086 ecc_point_clear (struct ecc_point *p);
0087
0088
0089 int
0090 ecc_point_set (struct ecc_point *p, const mpz_t x, const mpz_t y);
0091 void
0092 ecc_point_get (const struct ecc_point *p, mpz_t x, mpz_t y);
0093
0094 void
0095 ecc_scalar_init (struct ecc_scalar *s, const struct ecc_curve *ecc);
0096 void
0097 ecc_scalar_clear (struct ecc_scalar *s);
0098
0099
0100 int
0101 ecc_scalar_set (struct ecc_scalar *s, const mpz_t z);
0102 void
0103 ecc_scalar_get (const struct ecc_scalar *s, mpz_t z);
0104
0105
0106 void
0107 ecc_scalar_random (struct ecc_scalar *s,
0108 void *random_ctx, nettle_random_func *random);
0109
0110
0111 void
0112 ecc_point_mul (struct ecc_point *r, const struct ecc_scalar *n,
0113 const struct ecc_point *p);
0114
0115
0116 void
0117 ecc_point_mul_g (struct ecc_point *r, const struct ecc_scalar *n);
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137 unsigned
0138 ecc_bit_size (const struct ecc_curve *ecc);
0139
0140
0141 mp_size_t
0142 ecc_size (const struct ecc_curve *ecc);
0143
0144
0145 mp_size_t
0146 ecc_size_a (const struct ecc_curve *ecc);
0147
0148
0149 mp_size_t
0150 ecc_size_j (const struct ecc_curve *ecc);
0151
0152
0153
0154
0155 #ifdef __cplusplus
0156 }
0157 #endif
0158
0159 #endif