mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Add timingsafe_bcmp(), for constant-time memory comparison
timingsafe_bcmp() should be used instead of memcmp() or a naive for-loop, when comparing passwords or secret tokens, to avoid leaking information about the secret token by timing. This commit just introduces the function but does not change any existing code to use it yet. Co-authored-by: Jelte Fennema-Nio <github-tech@jeltef.nl> Discussion: https://www.postgresql.org/message-id/7b86da3b-9356-4e50-aa1b-56570825e234@iki.fi
This commit is contained in:
23
configure
vendored
23
configure
vendored
@ -15927,6 +15927,16 @@ fi
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_DECL_STRSEP $ac_have_decl
|
||||
_ACEOF
|
||||
ac_fn_c_check_decl "$LINENO" "timingsafe_bcmp" "ac_cv_have_decl_timingsafe_bcmp" "$ac_includes_default"
|
||||
if test "x$ac_cv_have_decl_timingsafe_bcmp" = xyes; then :
|
||||
ac_have_decl=1
|
||||
else
|
||||
ac_have_decl=0
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_DECL_TIMINGSAFE_BCMP $ac_have_decl
|
||||
_ACEOF
|
||||
|
||||
|
||||
# We can't use AC_CHECK_FUNCS to detect these functions, because it
|
||||
@ -16099,6 +16109,19 @@ esac
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "timingsafe_bcmp" "ac_cv_func_timingsafe_bcmp"
|
||||
if test "x$ac_cv_func_timingsafe_bcmp" = xyes; then :
|
||||
$as_echo "#define HAVE_TIMINGSAFE_BCMP 1" >>confdefs.h
|
||||
|
||||
else
|
||||
case " $LIBOBJS " in
|
||||
*" timingsafe_bcmp.$ac_objext "* ) ;;
|
||||
*) LIBOBJS="$LIBOBJS timingsafe_bcmp.$ac_objext"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "pthread_barrier_wait" "ac_cv_func_pthread_barrier_wait"
|
||||
|
Reference in New Issue
Block a user