This source file includes following definitions.
- mpi_get_size
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #ifndef G10_MPI_H
18 #define G10_MPI_H
19
20 #include <linux/types.h>
21 #include <linux/scatterlist.h>
22
23 #define BYTES_PER_MPI_LIMB (BITS_PER_LONG / 8)
24 #define BITS_PER_MPI_LIMB BITS_PER_LONG
25
26 typedef unsigned long int mpi_limb_t;
27 typedef signed long int mpi_limb_signed_t;
28
29 struct gcry_mpi {
30 int alloced;
31 int nlimbs;
32 int nbits;
33 int sign;
34 unsigned flags;
35
36
37 mpi_limb_t *d;
38 };
39
40 typedef struct gcry_mpi *MPI;
41
42 #define mpi_get_nlimbs(a) ((a)->nlimbs)
43
44
45 MPI mpi_alloc(unsigned nlimbs);
46 void mpi_free(MPI a);
47 int mpi_resize(MPI a, unsigned nlimbs);
48
49
50 MPI mpi_read_raw_data(const void *xbuffer, size_t nbytes);
51 MPI mpi_read_from_buffer(const void *buffer, unsigned *ret_nread);
52 MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int len);
53 void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign);
54 int mpi_read_buffer(MPI a, uint8_t *buf, unsigned buf_len, unsigned *nbytes,
55 int *sign);
56 int mpi_write_to_sgl(MPI a, struct scatterlist *sg, unsigned nbytes,
57 int *sign);
58
59
60 int mpi_powm(MPI res, MPI base, MPI exp, MPI mod);
61
62
63 int mpi_cmp_ui(MPI u, ulong v);
64 int mpi_cmp(MPI u, MPI v);
65
66
67 void mpi_normalize(MPI a);
68 unsigned mpi_get_nbits(MPI a);
69
70
71
72
73
74
75
76
77
78
79 static inline unsigned int mpi_get_size(MPI a)
80 {
81 return a->nlimbs * BYTES_PER_MPI_LIMB;
82 }
83 #endif