Skip to content
Snippets Groups Projects
  1. Sep 15, 2016
    • Heikki Linnakangas's avatar
      Support OpenSSL 1.1.0. · 593d4e47
      Heikki Linnakangas authored
      Changes needed to build at all:
      
      - Check for SSL_new in configure, now that SSL_library_init is a macro.
      - Do not access struct members directly. This includes some new code in
        pgcrypto, to use the resource owner mechanism to ensure that we don't
        leak OpenSSL handles, now that we can't embed them in other structs
        anymore.
      - RAND_SSLeay() -> RAND_OpenSSL()
      
      Changes that were needed to silence deprecation warnings, but were not
      strictly necessary:
      
      - RAND_pseudo_bytes() -> RAND_bytes().
      - SSL_library_init() and OpenSSL_config() -> OPENSSL_init_ssl()
      - ASN1_STRING_data() -> ASN1_STRING_get0_data()
      - DH_generate_parameters() -> DH_generate_parameters()
      - Locking callbacks are not needed with OpenSSL 1.1.0 anymore. (Good
        riddance!)
      
      Also change references to SSLEAY_VERSION_NUMBER with OPENSSL_VERSION_NUMBER,
      for the sake of consistency. OPENSSL_VERSION_NUMBER has existed since time
      immemorial.
      
      Fix SSL test suite to work with OpenSSL 1.1.0. CA certificates must have
      the "CA:true" basic constraint extension now, or OpenSSL will refuse them.
      Regenerate the test certificates with that. The "openssl" binary, used to
      generate the certificates, is also now more picky, and throws an error
      if an X509 extension is specified in "req_extensions", but that section
      is empty.
      
      Backpatch to all supported branches, per popular demand. In back-branches,
      we still support OpenSSL 0.9.7 and above. OpenSSL 0.9.6 should still work
      too, but I didn't test it. In master, we only support 0.9.8 and above.
      
      Patch by Andreas Karlsson, with additional changes by me.
      
      Discussion: <20160627151604.GD1051@msg.df7cb.de>
      593d4e47
  2. May 06, 2014
    • Bruce Momjian's avatar
      pgindent run for 9.4 · 0a783200
      Bruce Momjian authored
      This includes removing tabs after periods in C comments, which was
      applied to back branches, so this change should not effect backpatching.
      0a783200
  3. Jan 17, 2014
    • Tom Lane's avatar
      Add gen_random_uuid() to contrib/pgcrypto. · e6170126
      Tom Lane authored
      This function provides a way of generating version 4 (pseudorandom) UUIDs
      based on pgcrypto's PRNG.  The main reason for doing this is that the
      OSSP UUID library depended on by contrib/uuid-ossp is becoming more and
      more of a porting headache, so we need an alternative for people who can't
      install that.  A nice side benefit though is that this implementation is
      noticeably faster than uuid-ossp's uuid_generate_v4() function.
      
      Oskari Saarenmaa, reviewed by Emre Hasegeli
      e6170126
  4. Jan 28, 2012
  5. Sep 01, 2011
  6. Sep 20, 2010
  7. Mar 25, 2008
    • Tom Lane's avatar
      Simplify and standardize conversions between TEXT datums and ordinary C · 220db7cc
      Tom Lane authored
      strings.  This patch introduces four support functions cstring_to_text,
      cstring_to_text_with_len, text_to_cstring, and text_to_cstring_buffer, and
      two macros CStringGetTextDatum and TextDatumGetCString.  A number of
      existing macros that provided variants on these themes were removed.
      
      Most of the places that need to make such conversions now require just one
      function or macro call, in place of the multiple notational layers that used
      to be needed.  There are no longer any direct calls of textout or textin,
      and we got most of the places that were using handmade conversions via
      memcpy (there may be a few still lurking, though).
      
      This commit doesn't make any serious effort to eliminate transient memory
      leaks caused by detoasting toasted text objects before they reach
      text_to_cstring.  We changed PG_GETARG_TEXT_P to PG_GETARG_TEXT_PP in a few
      places where it was easy, but much more could be done.
      
      Brendan Jurd and Tom Lane
      220db7cc
  8. Feb 28, 2007
    • Tom Lane's avatar
      Replace direct assignments to VARATT_SIZEP(x) with SET_VARSIZE(x, len). · 234a02b2
      Tom Lane authored
      Get rid of VARATT_SIZE and VARATT_DATA, which were simply redundant with
      VARSIZE and VARDATA, and as a consequence almost no code was using the
      longer names.  Rename the length fields of struct varlena and various
      derived structures to catch anyplace that was accessing them directly;
      and clean up various places so caught.  In itself this patch doesn't
      change any behavior at all, but it is necessary infrastructure if we hope
      to play any games with the representation of varlena headers.
      Greg Stark and Tom Lane
      234a02b2
  9. Nov 10, 2006
  10. Oct 04, 2006
  11. Sep 05, 2006
  12. Jul 13, 2006
    • Neil Conway's avatar
      "Annual" pgcrypto update from Marko Kreen: · 1abf76e8
      Neil Conway authored
      Few cleanups and couple of new things:
      
       - add SHA2 algorithm to older OpenSSL
       - add BIGNUM math to have public-key cryptography work on non-OpenSSL
         build.
       - gen_random_bytes() function
      
      The status of SHA2 algoritms and public-key encryption can now be
      changed to 'always available.'
      
      That makes pgcrypto functionally complete and unless there will be new
      editions of AES, SHA2 or OpenPGP standards, there is no major changes
      planned.
      1abf76e8
  13. May 31, 2006
  14. Oct 15, 2005
  15. Sep 24, 2005
  16. Mar 21, 2005
    • Neil Conway's avatar
      pgcrypto update: · b160d6b9
      Neil Conway authored
      * Use error codes instead of -1
      * px_strerror for new error codes
      * calling convention change for px_gen_salt - return error code
      * use px_strerror in pgcrypto.c
      
      Marko Kreen
      b160d6b9
    • Neil Conway's avatar
      * construct "struct {} list [] = {}" confuses pgindent - split those. · fa332a06
      Neil Conway authored
        It was a bad style to begin with, and now several loops can be clearer.
      * pgcrypto.c: Fix function comments
      * crypt-gensalt.c, crypt-blowfish.c: stop messing with errno
      * openssl.c: use px_free instead pfree
      * px.h: make redefining px_alloc/px_realloc/px_free easier
      
      Marko Kreen
      fa332a06
  17. May 07, 2004
    • Tom Lane's avatar
      Solve the 'Turkish problem' with undesirable locale behavior for case · 0bd61548
      Tom Lane authored
      conversion of basic ASCII letters.  Remove all uses of strcasecmp and
      strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp;
      remove most but not all direct uses of toupper and tolower in favor of
      pg_toupper and pg_tolower.  These functions use the same notions of
      case folding already developed for identifier case conversion.  I left
      the straight locale-based folding in place for situations where we are
      just manipulating user data and not trying to match it to built-in
      strings --- for example, the SQL upper() function is still locale
      dependent.  Perhaps this will prove not to be what's wanted, but at
      the moment we can initdb and pass regression tests in Turkish locale.
      0bd61548
  18. Nov 29, 2003
    • PostgreSQL Daemon's avatar
      · 55b11325
      PostgreSQL Daemon authored
      make sure the $Id tags are converted to $PostgreSQL as well ...
      55b11325
  19. Aug 04, 2003
  20. Jul 24, 2003
  21. Dec 31, 2001
  22. Nov 20, 2001
  23. Oct 25, 2001
  24. Sep 23, 2001
    • Bruce Momjian's avatar
      Big thanks to Solar Designer who pointed out a bug in bcrypt · ab560228
      Bruce Momjian authored
      salt generation code.  He also urged using better random source
      and making possible to choose using bcrypt and xdes rounds more
      easily.  So, here's patch:
      
      * For all salt generation, use Solar Designer's own code.  This
        is mostly due fact that his code is more fit for get_random_bytes()
        style interface.
      * New function: gen_salt(type, rounds).  This lets specify iteration
        count for algorithm.
      * random.c: px_get_random_bytes() function.
        Supported randomness soure: /dev/urandom, OpenSSL PRNG, libc random()
        Default: /dev/urandom.
      * Draft description of C API for pgcrypto functions.
      
      New files: API, crypt-gensalt.c, random.c
      
      Marko Kreen
      ab560228
  25. Aug 21, 2001
    • Bruce Momjian's avatar
      /contrib/pgcrypto: · 2518e273
      Bruce Momjian authored
      * remove support for encode() as it is in main tree now
      * remove krb5.c
      * new 'PX library' architecture
      * remove BSD license from my code to let the general
        PostgreSQL one to apply
      * md5, sha1: ANSIfy, use const where appropriate
      * various other formatting and clarity changes
      * hmac()
      * UN*X-like crypt() - system or internal crypt
      * Internal crypt: DES, Extended DES, MD5, Blowfish
        crypt-des.c, crypt-md5.c from FreeBSD
        crypt-blowfish.c from Solar Designer
      * gen_salt() for crypt() -  Blowfish, MD5, DES, Extended DES
      * encrypt(), decrypt(), encrypt_iv(), decrypt_iv()
      * Cipher support in mhash.c, openssl.c
      * internal: Blowfish, Rijndael-128 ciphers
      * blf.[ch], rijndael.[ch] from OpenBSD
      * there will be generated file rijndael-tbl.inc.
      
      Marko Kreen
      2518e273
  26. Mar 22, 2001
  27. Feb 10, 2001
    • Tom Lane's avatar
      Restructure the key include files per recent pghackers discussion: there · d08741ea
      Tom Lane authored
      are now separate files "postgres.h" and "postgres_fe.h", which are meant
      to be the primary include files for backend .c files and frontend .c files
      respectively.  By default, only include files meant for frontend use are
      installed into the installation include directory.  There is a new make
      target 'make install-all-headers' that adds the whole content of the
      src/include tree to the installed fileset, for use by people who want to
      develop server-side code without keeping the complete source tree on hand.
      Cleaned up a whole lot of crufty and inconsistent header inclusions.
      d08741ea
  28. Feb 06, 2001
  29. Jan 24, 2001
    • Bruce Momjian's avatar
      I would like to do a interface change in pgcrypto. (Good · cb5427ee
      Bruce Momjian authored
      timing, I know :))  At the moment the digest() function returns
      hexadecimal coded hash, but I want it to return pure binary.  I
      have also included functions encode() and decode() which support
      'base64' and 'hex' encodings, so if anyone needs digest() in hex
      he can do encode(digest(...), 'hex').
      
      Main reason for it is "to do one thing and do it well" :)
      
      Another reason is if someone needs really lot of digesting, in
      the end he wants to store the binary not the hexadecimal result.
      It is really silly to convert it to hex then back to binary
      again.  As I said if someone needs hex he can get it.
      
      Well, and the real reason that I am doing encrypt()/decrypt()
      functions and _they_ return binary.  For testing I like to see
      it in hex occasionally, but it is really wrong to let them
      return hex.  Only now it caught my eye that hex-coding in
      digest() is wrong.  When doing digest() I thought about 'common
      case' but hacking with psql is probably _not_ the common case :)
      
      Marko Kreen
      cb5427ee
  30. Jan 09, 2001
    • Bruce Momjian's avatar
      The KAME files md5.* and sha1.* have the following changelog · e586026d
      Bruce Momjian authored
      entry:
      
      ----------------------------
      revision 1.2
      date: 2000/12/04 01:20:38;  author: tgl;  state: Exp;  lines:
      +18 -18
      Eliminate some of the more blatant platform-dependencies ... it
      builds here now, anyway ...
      ----------------------------
      
      Which basically changes u_int*_t -> uint*_t, so now it does not
      compile neither under Debian 2.2 nor under NetBSD 1.5 which
      is platform independent<B8> all right.  Also it replaces $KAME$
      with $Id$ which is Bad Thing. PostgreSQL Id should be added as a
      separate line so the file history could be seen.
      
      So here is patch:
      
      * changes uint*_t -> uint*.  I guess that was the original
        intention
      * adds uint64 type to include/c.h because its needed
        [somebody should check if I did it right]
      * adds back KAME Id, because KAME is the master repository
      * removes stupid c++ comments in pgcrypto.c
      * removes <sys/types.h> from the code, its not needed
      
      --
      marko
      
      Marko Kreen
      e586026d
  31. Nov 20, 2000
    • Tom Lane's avatar
      Revise handling of oldstyle/newstyle functions per recent discussions · 5bb2300b
      Tom Lane authored
      in pghackers list.  Support for oldstyle internal functions is gone
      (no longer needed, since conversion is complete) and pg_language entry
      'internal' now implies newstyle call convention.  pg_language entry
      'newC' is gone; both old and newstyle dynamically loaded C functions
      are now called language 'C'.  A newstyle function must be identified
      by an associated info routine.  See src/backend/utils/fmgr/README.
      5bb2300b
  32. Oct 31, 2000
Loading