diff options
author | Erwin Nindl <nine@wirdorange.org> | 2007-12-11 17:47:29 +0000 |
---|---|---|
committer | Erwin Nindl <nine@wirdorange.org> | 2007-12-11 17:47:29 +0000 |
commit | f7307935fb087f8c327c8d8f09f8837925e70c34 (patch) | |
tree | a6fb23076c80ee1590d9937bf6dbbd169fab7f13 /mpi.cpp | |
parent | kd iv generation fix again (diff) |
set iv to fixed length of 16byte in kd
Diffstat (limited to 'mpi.cpp')
-rw-r--r-- | mpi.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -127,14 +127,17 @@ void Mpi::clearHighBit(u_int32_t n) gcry_mpi_clear_highbit( val_, n ); } -Buffer Mpi::getBuf() const +Buffer Mpi::getBuf(u_int32_t min_len) const { u_int32_t len = 0, written = 0; len = gcry_mpi_get_nbits( val_ ); Buffer res(static_cast<u_int32_t>(len/8)+1); - gcry_mpi_print( GCRYMPI_FMT_STD, res, len, &written, val_ ); + if(res.getLength() < min_len) + res.resizeBack(min_len); + + gcry_mpi_print( GCRYMPI_FMT_STD, res, res.getLength(), &written, val_ ); return res; } |