summaryrefslogtreecommitdiff
path: root/lib/gnutls_mpi.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2005-09-27 16:35:27 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2005-09-27 16:35:27 +0000
commit7c4c21c0e84a539558e3e1689d8a7b8a2c4c0056 (patch)
tree1735ff449b8119fea13204511499768b6a88c979 /lib/gnutls_mpi.c
parent511650f3ed9aa7d7b933069e3b5c733d44166d7d (diff)
downloadgnutls-7c4c21c0e84a539558e3e1689d8a7b8a2c4c0056.tar.gz
Made the PKCS #12 API handle null passwords. Based on patch by
Anton Altaparmakov <aia21@cam.ac.uk>.
Diffstat (limited to 'lib/gnutls_mpi.c')
-rw-r--r--lib/gnutls_mpi.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gnutls_mpi.c b/lib/gnutls_mpi.c
index d2fd934748..58b9939e91 100644
--- a/lib/gnutls_mpi.c
+++ b/lib/gnutls_mpi.c
@@ -53,6 +53,20 @@ int _gnutls_mpi_scan(mpi_t * ret_mpi, const opaque * buffer,
if (ret)
return GNUTLS_E_MPI_SCAN_FAILED;
+ return 0;
+}
+
+/* returns zero on success. Fails if the number is zero.
+ */
+int _gnutls_mpi_scan_nz(mpi_t * ret_mpi, const opaque * buffer,
+ size_t * nbytes)
+{
+ int ret;
+
+ ret = gcry_mpi_scan(ret_mpi, GCRYMPI_FMT_USG, buffer, *nbytes, nbytes);
+ if (ret)
+ return GNUTLS_E_MPI_SCAN_FAILED;
+
/* MPIs with 0 bits are illegal
*/
if (_gnutls_mpi_get_nbits(*ret_mpi) == 0) {