crypto: fix style issues in bio

Stop changing arguments, use local variables for things that change.
crypto: fix changing buffers in bio

We should go to next buffer if *current* one is full, not the next one.
Otherwise we may hop through buffers and written data will become
interleaved, which will lead to failure.
crypto: move write_head in bio's Reset() method