svn commit: r358404 - head/contrib/sendmail/src

Hiroki Sato hrs at FreeBSD.org
Thu Feb 27 19:40:33 UTC 2020


Author: hrs
Date: Thu Feb 27 19:40:29 2020
New Revision: 358404
URL: https://svnweb.freebsd.org/changeset/base/358404

Log:
  Fix broken STARTTLS when SharedMemoryKey is enabled.
  
  OpenSSL 1.1 API patch for sendmail had a bug which
  prevented sm_RSA_generate_key() function from working.
  This function is used to generate a temporary RSA key
  for a shared memory region used for TLS processing.
  Note that 12.0 and 12.1-RELEASE include this bug.
  
  This affects only if SM_CONF_SHM compile-time
  option (enabled by default) and SharedMemoryKey
  run-time option (not enabled by default) in a .cf file are
  specified.  The latter corresponds to confSHARED_MEMORY_KEY in
  a .mc file.
  
  PR:		242861
  MFC after:	3 days
  Differential Revision:	https://reviews.freebsd.org/D23734

Modified:
  head/contrib/sendmail/src/tls.c

Modified: head/contrib/sendmail/src/tls.c
==============================================================================
--- head/contrib/sendmail/src/tls.c	Thu Feb 27 19:40:20 2020	(r358403)
+++ head/contrib/sendmail/src/tls.c	Thu Feb 27 19:40:29 2020	(r358404)
@@ -745,18 +745,15 @@ sm_RSA_generate_key(num, e)
 {
 	RSA *rsa = NULL;
         BIGNUM *bn_rsa_r4;
-	int rc;
 
 	bn_rsa_r4 = BN_new();
-        rc = BN_set_word(bn_rsa_r4, RSA_F4);
-	if ((bn_rsa_r4 != NULL) && BN_set_word(bn_rsa_r4, RSA_F4) && (rsa = RSA_new()) != NULL)
+	if ((bn_rsa_r4 != NULL) && BN_set_word(bn_rsa_r4, e) && (rsa = RSA_new()) != NULL)
 	{
-		if (!RSA_generate_key_ex(rsa, RSA_KEYLENGTH, bn_rsa_r4, NULL))
+		if (!RSA_generate_key_ex(rsa, num, bn_rsa_r4, NULL))
 		{
 			RSA_free(rsa);
 			rsa = NULL;
 		}
-		return NULL;
 	}
 	BN_free(bn_rsa_r4);
 	return rsa;


More information about the svn-src-head mailing list