Reduce malloc and remove malloc from crypto.c

@TomCrypto, what do you think about that ?