diff options
author | Werner Koch <wk@gnupg.org> | 1998-08-07 10:53:38 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1998-08-07 10:53:38 +0200 |
commit | 6d21f2838dcfee933f4c430fba68ba8ada3abd50 (patch) | |
tree | ecf44aec40a55d3fd46fc6a6d96bb3afa7901029 /g10/seskey.c | |
parent | add salted and iterated mode (diff) | |
download | gnupg2-6d21f2838dcfee933f4c430fba68ba8ada3abd50.tar.xz gnupg2-6d21f2838dcfee933f4c430fba68ba8ada3abd50.zip |
chnages done at the train
Diffstat (limited to 'g10/seskey.c')
-rw-r--r-- | g10/seskey.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/g10/seskey.c b/g10/seskey.c index 6e76d12db..29881d2e9 100644 --- a/g10/seskey.c +++ b/g10/seskey.c @@ -51,7 +51,7 @@ encode_session_key( DEK *dek, unsigned nbits ) int nframe = (nbits+7) / 8; byte *p; byte *frame; - int i,n,c; + int i,n; u16 csum; MPI a; @@ -86,12 +86,10 @@ encode_session_key( DEK *dek, unsigned nbits ) frame[n++] = 2; i = nframe - 6 - dek->keylen; assert( i > 0 ); - /* FIXME: replace the loop by a call to get_random_bits() */ - for( ; i ; i-- ) { - while( !(c = get_random_byte(1)) ) - ; - frame[n++] = c; - } + p = get_random_bits( i*8, 1, 1 ); + memcpy( frame+n, p, i ); + m_free(p); + n += i; frame[n++] = 0; frame[n++] = dek->algo; memcpy( frame+n, dek->key, dek->keylen ); n += dek->keylen; |