crypto: fix bug in large buffer handling