Bug 211626 - [exp-run] Removal of setkey(), encrypt(), des_setkey() and des_cipher()
Summary: [exp-run] Removal of setkey(), encrypt(), des_setkey() and des_cipher()
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ed Schouten
Depends on:
Reported: 2016-08-06 19:14 UTC by Ed Schouten
Modified: 2017-12-01 11:11 UTC (History)
2 users (show)

See Also:

Patch for removing a bunch of functions from the C library (3.48 KB, patch)
2016-08-06 19:14 UTC, Ed Schouten
no flags Details | Diff
Patch for claws-mail to prevent calling setkey()/encrypt(). (622 bytes, patch)
2016-10-03 18:50 UTC, Ed Schouten
no flags Details | Diff
Patch for xisp to prevent calling setkey()/encrypt(). (1.20 KB, patch)
2016-10-03 18:52 UTC, Ed Schouten
no flags Details | Diff
dragonflybsd-fix (1.30 KB, patch)
2016-10-16 19:24 UTC, Pawel Pekala
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Schouten freebsd_committer 2016-08-06 19:14:13 UTC
Created attachment 173362 [details]
Patch for removing a bunch of functions from the C library

Hi antoine@ (or anyone else ;-),

After the previous exp-run you did to test the changes to some of the function prototypes, I realised that it makes far more sense to remove some of those functions. It looks like they are undocumented and only have stubs in the C library.

Could you please do another exp-run with the following patch? It changes some of these functions from being exposed to just being present for compatibility.

Comment 2 Antoine Brodin freebsd_committer 2016-09-02 13:12:00 UTC
On i386, the failures are similar.
Comment 3 commit-hook freebsd_committer 2016-10-03 18:21:38 UTC
A commit references this bug:

Author: ed
Date: Mon Oct  3 18:20:58 UTC 2016
New revision: 306651
URL: https://svnweb.freebsd.org/changeset/base/306651

  Remove setkey(), encrypt(), des_setkey() and des_cipher().

  The setkey() and encrypt() functions are part of XSI, not the POSIX base
  definitions. There is no strict requirement for us to provide these,
  especially if we're only going to keep these around as undocumented
  stubs. The same holds for des_setkey() and des_cipher().

  Instead of providing functions that only generate warnings when linking,
  simply disallow linking against them. The impact of this is relatively
  low. It only causes two leaf ports to break. I'll see what I can do to
  help out to get those fixed.

  PR:		211626

Comment 4 Antoine Brodin freebsd_committer 2016-10-03 18:39:23 UTC
claws-mail is not a leaf port, 24 ports depend on it.
Comment 5 Ed Schouten freebsd_committer 2016-10-03 18:50:52 UTC
Created attachment 175393 [details]
Patch for claws-mail to prevent calling setkey()/encrypt().
Comment 6 Ed Schouten freebsd_committer 2016-10-03 18:52:36 UTC
Created attachment 175394 [details]
Patch for xisp to prevent calling setkey()/encrypt().
Comment 7 Antoine Brodin freebsd_committer 2016-10-03 18:53:46 UTC
cc: pawel@ (claws-mail maintainer)
Comment 8 Ed Schouten freebsd_committer 2016-10-03 18:55:04 UTC
Comment on attachment 175394 [details]
Patch for xisp to prevent calling setkey()/encrypt().

Turns out xisp has been fixed in the meantime to use OpenSSL anyway. We don't need to patch up this port anymore.
Comment 9 Ed Schouten freebsd_committer 2016-10-03 18:59:13 UTC
Hi Pawel,

(Thanks, antoine@, for putting him on the CC!)

In src r306651 I've removed the presence of the setkey() and encrypt() functions. It looks like claws-mail only uses these functions to encrypt/decrypt some legacy password database files. As these functions already act as no-ops on FreeBSD, we can get around by simply removing these calls altogether. That at least makes claws-mail behave as before.

Attached is a patch for claws-mail to remove the calls to these functions. Autoconf also has some ugly check in place to test for this function's presence, requiring it unconditionally. Should we just fool Autoconf by setting ac_cv_search_encrypt=yes? Thoughts?
Comment 10 Pawel Pekala freebsd_committer 2016-10-05 17:47:57 UTC
Hi Ed,

Looks like ac_cv_search_encrypt=yes hack is enough to fix build. Submitted patch touches codepath not used on FreeBSD, there is specific encryption function implementation for our platform that don't use setkey() and encrypt(). I'm build testing right now, should commit fix shortly. Thanks for the heads up!
Comment 11 commit-hook freebsd_committer 2016-10-05 20:13:44 UTC
A commit references this bug:

Author: pawel
Date: Wed Oct  5 20:13:40 UTC 2016
New revision: 423385
URL: https://svnweb.freebsd.org/changeset/ports/423385

  Fix build on 12.0-CURRENT after encrypt() function removal in r306651
  Configure script checks for encrypt() even though it's not used
  on FreeBSD platform, disable this check.

  PR:		211626
  Reported by:	Ed Schouten

Comment 12 John Marino freebsd_committer 2016-10-15 23:46:21 UTC
hey guys,

This change seems to have broken DragonFly with SSL_DEFAULT=libressl:

libtool: link: cc -pipe -DLIBICONV_PLUG -O2 -fno-strict-aliasing -Wno-unused-function -Wno-pointer-sign -Wall -I/usr/local/include/enchant -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -pthread -Wl,--export-dynamic -Wl,-rpath -Wl,/usr/local/lib -o claws-mail account.o action.o addrcache.o addr_compl.o addressadd.o addrgather.o addrharvest.o addritem.o advsearch.o alertpanel.o autofaces.o avatars.o codeconv.o compose.o crash.o customheader.o displayheader.o edittags.o enriched.o export.o file_checker.o filtering.o folder.o folder_item_prefs.o foldersel.o folderutils.o folderview.o grouplistdialog.o headerview.o html.o image_viewer.o imap.o imap_gtk.o import.o inc.o localfolder.o main.o mainwindow.o manual.o matcher.o matcher_parser_lex.o matcher_parser_parse.o mbox.o message_search.o messageview.o mh.o mh_gtk.o mimeview.o msgcache.o news.o news_gtk.o noticeview.o partial_download.o password.o password_gtk.o passwordstore.o pop.o prefs_account.o prefs_actions.o prefs_common.o prefs_compose_writing.o prefs_customheader.o prefs_display_header.o prefs_ext_prog.o prefs_filtering_action.o prefs_filtering.o prefs_folder_item.o prefs_fonts.o prefs_gtk.o prefs_image_viewer.o prefs_logging.o prefs_matcher.o prefs_message.o prefs_migration.o prefs_msg_colors.o prefs_other.o prefs_quote.o prefs_receive.o prefs_send.o prefs_spelling.o prefs_summaries.o prefs_summary_column.o prefs_summary_open.o prefs_folder_column.o prefs_template.o prefs_themes.o prefs_toolbar.o prefs_wrapping.o printing.o privacy.o procheader.o procmime.o procmsg.o quote_fmt.o quote_fmt_lex.o quote_fmt_parse.o recv.o remotefolder.o send_message.o setup.o sourcewindow.o ssl_manager.o statusbar.o stock_pixmap.o summary_search.o summaryview.o textview.o toolbar.o undo.o unmime.o uri_opener.o wizard.o addrbook.o addrclip.o addrcustomattr.o addressbook.o addressbook_foldersel.o addrindex.o addrquery.o addrselect.o addrduplicates.o browseldap.o editaddress.o editaddress_other_attributes_ldap.o editbook.o editgroup.o editjpilot.o editldap_basedn.o editldap.o editvcard.o exphtmldlg.o expldifdlg.o exporthtml.o exportldif.o importldif.o importmutt.o importpine.o jpilot.o ldapctrl.o ldaplocate.o ldapquery.o ldapserver.o ldapupdate.o ldaputil.o ldif.o mutt.o pine.o vcard.o -pthread -Wl,-rpath -Wl,/usr/local/lib -pthread -Wl,-rpath -Wl,/usr/local/lib -pthread  -L/usr/local/lib etpan/.libs/libclawsetpan.a gtk/.libs/libclawsgtk.a -lgthread-2.0 -lenchant -lgmodule-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lfontconfig -lfreetype -lgnutls -lcompface -lpthread -lSM -lICE -lstartup-notification-1 -lexecinfo -lm -letpan -lcurl -lexpat -lz /usr/local/lib/libsasl2.so -lssl -lcrypto -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib
etpan/.libs/libclawsetpan.a(passcrypt.o):passcrypt.c:function crypt_cfb_buf.constprop.0: error: undefined reference to 'setkey'
etpan/.libs/libclawsetpan.a(passcrypt.o):passcrypt.c:function crypt_cfb_buf.constprop.0: error: undefined reference to 'encrypt'
collect2: error: ld returned 1 exit status
gmake[5]: *** [Makefile:1287: claws-mail] Error 1

Can somebody with FreeBSD confirm that setting DEFAULT_VERSIONS+=ssl=libressl still works after this change?  Presumably that's the critical factor, not the OS being DragonFly.
Comment 13 Pawel Pekala freebsd_committer 2016-10-16 19:24:42 UTC
Created attachment 175833 [details]

John: how about this patch? It's based on fix I committed upstream:

Comment 14 John Marino freebsd_committer 2016-10-16 21:04:45 UTC
Hi Pawel,
I can confirm that claws-mail builds on DragonFly with that patch!
Comment 15 commit-hook freebsd_committer 2016-10-17 15:23:49 UTC
A commit references this bug:

Author: pawel
Date: Mon Oct 17 15:23:12 UTC 2016
New revision: 424124
URL: https://svnweb.freebsd.org/changeset/ports/424124

  Rework last build fix to work on DragonFlyBSD also

  PR:		211626
  Tested by:	marino