1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00
putty-source/unix/CMakeLists.txt
Simon Tatham 395c228bee Adopt a new universal implementation of smemclr().
This new implementation uses the same optimisation-barrier technique
that I used in various places in testsc: have a no-op function, and a
volatile function pointer pointing at it, and then call through the
function pointer, so that nothing actually happens (apart from the
physical call and return) but the compiler has to assume that
_anything_ might have happened.

Doing this just after a memset enforces that the compiler can't have
thrown away the memset, because the called function might (for
example) check that all the memory really is zero and abort if not.

I've been turning this over in my mind ever since coming up with the
technique for testsc. I think it's far more robust than the previous
smemclr technique: so much so that I'm switching to using it
_everywhere_, and no longer using platform alternatives like Windows's
SecureZeroMemory().
2021-04-18 08:30:44 +01:00

225 lines
5.9 KiB
CMake

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_platform_sources_to_library(utils
utils/arm_arch_queries.c
utils/block_signal.c
utils/cloexec.c
utils/dputs.c
utils/filename.c
utils/fontspec.c
utils/getticks.c
utils/get_username.c
utils/keysym_to_unicode.c
utils/make_dir_and_check_ours.c
utils/make_dir_path.c
utils/nonblock.c
utils/open_for_write_would_lose_data.c
utils/pgp_fingerprints.c
utils/pollwrap.c
utils/signal.c
utils/x11_ignore_error.c
# Compiled icon pixmap files
xpmpucfg.c xpmputty.c xpmptcfg.c xpmpterm.c
# We want the ISO C implementation of ltime(), because we don't have
# a local better alternative
../utils/ltime.c)
add_platform_sources_to_library(eventloop
uxcliloop.c uxsel.c)
add_platform_sources_to_library(console
uxcons.c)
add_platform_sources_to_library(settings
uxstore.c)
add_platform_sources_to_library(network
uxnet.c uxfdsock.c uxagentsock.c uxpeer.c uxproxy.c ux_x11.c)
add_platform_sources_to_library(sshcommon
uxnoise.c)
add_platform_sources_to_library(sshclient
uxgss.c uxagentc.c uxshare.c)
add_platform_sources_to_library(sshserver
uxsftpserver.c procnet.c)
add_platform_sources_to_library(sftpclient
uxsftp.c)
add_platform_sources_to_library(otherbackends
uxser.c)
add_platform_sources_to_library(agent
uxagentc.c)
add_executable(fuzzterm
${CMAKE_SOURCE_DIR}/fuzzterm.c
${CMAKE_SOURCE_DIR}/be_none.c
${CMAKE_SOURCE_DIR}/logging.c
${CMAKE_SOURCE_DIR}/noprint.c
uxucs.c
uxnogtk.c)
add_dependencies(fuzzterm generated_licence_h)
target_link_libraries(fuzzterm
guiterminal eventloop charset settings utils)
add_executable(osxlaunch
osxlaunch.c)
add_executable(plink
uxplink.c
${CMAKE_SOURCE_DIR}/be_all_s.c
uxnogtk.c)
target_link_libraries(plink
eventloop noterminal console sshclient otherbackends settings network crypto
utils)
installed_program(plink)
add_executable(pscp
${CMAKE_SOURCE_DIR}/pscp.c
${CMAKE_SOURCE_DIR}/be_ssh.c
uxnogtk.c)
target_link_libraries(pscp
sftpclient eventloop console sshclient settings network crypto utils)
installed_program(pscp)
add_executable(psftp
${CMAKE_SOURCE_DIR}/psftp.c
${CMAKE_SOURCE_DIR}/be_ssh.c
uxnogtk.c)
target_link_libraries(psftp
sftpclient eventloop console sshclient settings network crypto utils)
installed_program(psftp)
add_executable(psocks
uxsocks.c
${CMAKE_SOURCE_DIR}/psocks.c
${CMAKE_SOURCE_DIR}/norand.c
${CMAKE_SOURCE_DIR}/nocproxy.c
${CMAKE_SOURCE_DIR}/portfwd.c
uxnogtk.c)
target_link_libraries(psocks
eventloop console network utils)
add_executable(psusan
uxpsusan.c
${CMAKE_SOURCE_DIR}/be_none.c
${CMAKE_SOURCE_DIR}/nogss.c
${CMAKE_SOURCE_DIR}/scpserver.c
uxnogtk.c
uxpty.c)
target_link_libraries(psusan
eventloop sshserver keygen settings network crypto utils)
installed_program(psusan)
add_library(puttygen-common OBJECT
${CMAKE_SOURCE_DIR}/notiming.c
uxgen.c
uxnogtk.c
uxnoise.c
uxstore.c
${CMAKE_SOURCE_DIR}/sshpubk.c
${CMAKE_SOURCE_DIR}/sshrand.c)
add_executable(puttygen
${CMAKE_SOURCE_DIR}/cmdgen.c)
target_link_libraries(puttygen
puttygen-common keygen console crypto utils)
installed_program(puttygen)
add_executable(cgtest
${CMAKE_SOURCE_DIR}/cgtest.c)
target_link_libraries(cgtest
puttygen-common keygen console crypto utils)
add_executable(testsc
${CMAKE_SOURCE_DIR}/testsc.c)
target_link_libraries(testsc crypto utils)
add_executable(testzlib
${CMAKE_SOURCE_DIR}/testzlib.c
${CMAKE_SOURCE_DIR}/sshzlib.c)
target_link_libraries(testzlib utils)
add_executable(uppity
uxserver.c
${CMAKE_SOURCE_DIR}/be_none.c
${CMAKE_SOURCE_DIR}/scpserver.c
uxnogtk.c
uxpty.c
${CMAKE_SOURCE_DIR}/nogss.c)
target_link_libraries(uppity
eventloop sshserver keygen settings network crypto utils)
if(GTK_FOUND)
add_platform_sources_to_library(utils
gtkcols.c)
add_platform_sources_to_library(guiterminal
gtkwin.c gtkfont.c gtkdlg.c gtkcfg.c gtkcomm.c uxcfg.c uxucs.c uxprint.c)
add_dependencies(guiterminal generated_licence_h) # gtkdlg.c uses licence.h
add_library(guimisc STATIC
gtkmisc.c)
add_executable(pageant
uxpgnt.c
${CMAKE_SOURCE_DIR}/be_misc.c
${CMAKE_SOURCE_DIR}/be_none.c
${CMAKE_SOURCE_DIR}/nogss.c
gtkask.c
ux_x11.c
uxnoise.c
${CMAKE_SOURCE_DIR}/x11fwd.c)
target_link_libraries(pageant
guimisc eventloop console agent settings network crypto utils
${GTK_LIBRARIES})
installed_program(pageant)
add_executable(pterm
uxpterm.c
gtkmain.c
${CMAKE_SOURCE_DIR}/be_none.c
${CMAKE_SOURCE_DIR}/nogss.c
uxpty.c)
target_link_libraries(pterm
guiterminal guimisc eventloop settings charset utils
${GTK_LIBRARIES} ${X11_LIBRARIES})
installed_program(pterm)
add_executable(ptermapp
uxpterm.c
gtkapp.c
${CMAKE_SOURCE_DIR}/nocmdline.c
${CMAKE_SOURCE_DIR}/be_none.c
${CMAKE_SOURCE_DIR}/nogss.c
uxpty.c)
target_link_libraries(ptermapp
guiterminal guimisc eventloop settings charset utils
${GTK_LIBRARIES} ${X11_LIBRARIES})
add_executable(putty
uxputty.c
gtkmain.c
${CMAKE_SOURCE_DIR}/be_all_s.c)
target_link_libraries(putty
guiterminal guimisc eventloop sshclient otherbackends settings
network crypto charset utils
${GTK_LIBRARIES} ${X11_LIBRARIES})
set_target_properties(putty
PROPERTIES LINK_INTERFACE_MULTIPLICITY 2)
installed_program(putty)
add_executable(puttyapp
uxputty.c
gtkapp.c
${CMAKE_SOURCE_DIR}/nocmdline.c
${CMAKE_SOURCE_DIR}/be_all_s.c)
target_link_libraries(puttyapp
guiterminal guimisc eventloop sshclient otherbackends settings
network crypto charset utils
${GTK_LIBRARIES} ${X11_LIBRARIES})
add_executable(puttytel
uxputty.c
gtkmain.c
${CMAKE_SOURCE_DIR}/be_nos_s.c
${CMAKE_SOURCE_DIR}/nogss.c
${CMAKE_SOURCE_DIR}/norand.c
${CMAKE_SOURCE_DIR}/nocproxy.c)
target_link_libraries(puttytel
guiterminal guimisc eventloop otherbackends settings network charset utils
${GTK_LIBRARIES} ${X11_LIBRARIES})
endif()