diff options
Diffstat (limited to 'src/util/crypto_mpi.c')
-rw-r--r-- | src/util/crypto_mpi.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/util/crypto_mpi.c b/src/util/crypto_mpi.c index 51a29ac7c..099921611 100644 --- a/src/util/crypto_mpi.c +++ b/src/util/crypto_mpi.c | |||
@@ -146,4 +146,32 @@ GNUNET_CRYPTO_mpi_scan_unsigned (gcry_mpi_t *result, | |||
146 | } | 146 | } |
147 | 147 | ||
148 | 148 | ||
149 | /** | ||
150 | * Convert little endian data buffer into MPI value. | ||
151 | * The buffer is interpreted as network | ||
152 | * byte order, unsigned integer. | ||
153 | * | ||
154 | * @param result where to store MPI value (allocated) | ||
155 | * @param data raw data (GCRYMPI_FMT_USG) | ||
156 | * @param size number of bytes in @a data | ||
157 | */ | ||
158 | void | ||
159 | GNUNET_CRYPTO_mpi_scan_unsigned_le (gcry_mpi_t *result, | ||
160 | const void *data, | ||
161 | size_t size) | ||
162 | { | ||
163 | int rc; | ||
164 | |||
165 | if (0 != (rc = gcry_mpi_scan (result, | ||
166 | GCRYMPI_FMT_USG, | ||
167 | data, size, &size))) | ||
168 | { | ||
169 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, | ||
170 | "gcry_mpi_scan", | ||
171 | rc); | ||
172 | GNUNET_assert (0); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | |||
149 | /* end of crypto_mpi.c */ | 177 | /* end of crypto_mpi.c */ |