Skip to content

specialize gnutls_load_file() for unix-like OS

specialize gnutls_load_file() for unix-like OS

This implementation is safer, more secure, more robust, and more efficient than the existing generic implementation using system stdio.

reference: #1002

@dueno has committed some related improvements to gnulib http://git.savannah.gnu.org/gitweb/?p=gnulib.git http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=e4a38aadac2e90c6dfb317d0845746c200cf6697 http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=a2080f6506701d8d9ca5111d628607a6a8013f61 http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=fb64a78174042189f4d012cbd748d565f021cd69

This patch for gnutls loads a file into a gnutls_datum_t, but most of this patch could alternatively be submitted to the gnulib implementation of read_file(). Were that to be done, gnutls would retain the cost of double-copying the file contents in gnutls_load_file() when gnutls_malloc != malloc

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • Code modified for feature
  • [-] Test suite updated with functionality tests
  • [-] Test suite updated with negative tests
  • [-] Documentation updated / NEWS entry present (for non-trivial changes)
  • [-] CI timeout is 2h or higher (see Settings/CICD/General pipelines/Timeout)

Reviewer's checklist:

  • Any issues marked for closing are addressed
  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTION.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code

Merge request reports