JHUISI/charm — pull request #69 by mhlakhani (2013-11-10 02:10:53+00:00)
Title: Stylistic changes to dabe_aw11.py that fix segfaults when using embedded Python

This is in relation to the segfaults mentioned in issue #68. The use case involves dabe_aw11 being wrapped by dabenc_adapt_hybrid.

The change to decrypt() fixes crash 1, as the exception can be caught and handled normally, and the boolean value False is not passed to the hash function. Stylistically, it seems better, as trying to do a decryption without appropriate attributes is an exceptional case. In either case, dabenc_adapt_hybrid would throw an exception if decrypt() returned False.

The change to keygen() is more stylistic and fixes an issue in our application. Note that dabenc_adapt_hybrid returns the value returned by keygen, but since dabe_aw11 does not return in keygen, None is returned. So if an application uses keygen and wants to use the resulting key, it has to do a dictionary lookup. This simplifies that use case.