• Neil Conway's avatar
    Patch from Marko Kreen: · ce9b75db
    Neil Conway authored
    pgcrypto crypt()/md5 and hmac() leak memory when compiled against
    OpenSSL as openssl.c digest ->reset will do two DigestInit calls
    against a context.  This happened to work with OpenSSL 0.9.6
    but not with 0.9.7+.
    
    Reason for the messy code was that I tried to avoid creating
    wrapper structure to transport algorithm info and tried to use
    OpenSSL context for it.  The fix is to create wrapper structure.
    
    It also uses newer digest API to avoid memory allocations
    on reset with newer OpenSSLs.
    
    Thanks to Daniel Blaisdell for reporting it.
    ce9b75db
openssl.c 19.3 KB