More security precautions (length checks, null checks, etc)

The plugin has always limited the input to 10MB per parameter, but this
change adds length checks of internal data structures and PKCS7 data,
as well as some more null pointer checks.
Change unspecified argument lists "()" into "(void)"
Remove/merge unused functions