diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gcrypt.h.in | 3 | ||||
-rw-r--r-- | src/mpi.h | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index 57b841eb..9f6438ce 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -454,9 +454,10 @@ enum gcry_mpi_format enum gcry_mpi_flag { GCRYMPI_FLAG_SECURE = 1, /* Allocate the number in "secure" memory. */ - GCRYMPI_FLAG_OPAQUE = 2 /* The number is not a real one but just + GCRYMPI_FLAG_OPAQUE = 2, /* The number is not a real one but just a way to store some bytes. This is useful for encrypted big integers. */ + GCRYMPI_FLAG_IMMUTABLE = 4 /* Mark the MPI as immutable. */ }; @@ -69,7 +69,8 @@ struct gcry_mpi int sign; /* Indicates a negative number and is also used for opaque MPIs to store the length. */ unsigned int flags; /* Bit 0: Array to be allocated in secure memory space.*/ - /* Bit 2: the limb is a pointer to some m_alloced data.*/ + /* Bit 2: The limb is a pointer to some m_alloced data.*/ + /* Bit 4: Const MPI - the MPI may not be modified. */ mpi_limb_t *d; /* Array with the limbs */ }; @@ -104,8 +105,12 @@ struct gcry_mpi gcry_mpi_t _gcry_mpi_copy( gcry_mpi_t a ); #endif -#define mpi_is_opaque(a) ((a) && ((a)->flags&4)) -#define mpi_is_secure(a) ((a) && ((a)->flags&1)) +void _gcry_mpi_immutable_failed (void); +#define mpi_immutable_failed() _gcry_mpi_immutable_failed () + +#define mpi_is_immutable(a) ((a) && ((a)->flags&16)) +#define mpi_is_opaque(a) ((a) && ((a)->flags&4)) +#define mpi_is_secure(a) ((a) && ((a)->flags&1)) #define mpi_clear(a) _gcry_mpi_clear ((a)) #define mpi_alloc_like(a) _gcry_mpi_alloc_like((a)) #define mpi_snatch(a,b) _gcry_mpi_snatch ((a),(b)) |