Add support for the "new-style" Py_buffer api found in Python >= 2.6

This is needed to be able to encrypt/decrypt memoryview() objects
introduced in Python 2.7. This is extra important with Python 3 where
the buffer() object has been removed.

This also fixes a potential memory leak in stream_template.py:ALGnew().