Use the pthread cleanup handlers during cipher operations.