aboutsummaryrefslogtreecommitdiffstats
path: root/mpi/mpiutil.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-02-02 14:36:06 +0000
committerWerner Koch <[email protected]>1998-02-02 14:36:06 +0000
commitc8f12e218f81f9211920b6fe50a786b617a2aeae (patch)
treed042319be043090b02df4396c9880398b2b831ea /mpi/mpiutil.c
parentauf tobold (diff)
downloadgnupg-c8f12e218f81f9211920b6fe50a786b617a2aeae.tar.gz
gnupg-c8f12e218f81f9211920b6fe50a786b617a2aeae.zip
changed structure of trustdb
Diffstat (limited to '')
-rw-r--r--mpi/mpiutil.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c
index 068a9a399..7515eafd1 100644
--- a/mpi/mpiutil.c
+++ b/mpi/mpiutil.c
@@ -1,4 +1,4 @@
-/* mpiutil.c - Utility functions for MPI
+/* mpiutilac - Utility functions for MPI
* Copyright (c) 1997 by Werner Koch (dd9jn)
*
* This file is part of G10.
@@ -192,6 +192,34 @@ mpi_free( MPI a )
}
+void
+mpi_set_secure( MPI a )
+{
+ mpi_ptr_t ap, bp;
+
+ if( a->secure )
+ return;
+ a->secure = 1;
+ ap = a->d;
+ if( !a->nlimbs ) {
+ assert(!ap);
+ return;
+ }
+ #ifdef M_DEBUG
+ bp = mpi_debug_alloc_limb_space( a->nlimbs, 1, "set_secure" );
+ #else
+ bp = mpi_alloc_limb_space( a->nlimbs, 1 );
+ #endif
+ MPN_COPY( bp, ap, a->nlimbs );
+ a->d = bp;
+ #ifdef M_DEBUG
+ mpi_debug_free_limb_space(ap, "set_secure");
+ #else
+ mpi_free_limb_space(ap);
+ #endif
+}
+
+
/****************
* Note: This copy function shpould not interpret the MPI
* but copy it transparently.