https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219790

            Bug ID: 219790
           Summary: Unable to build bhyve with error in rfb.c
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: msh...@daemon-security.com

Trying to build CURRENT as of 6/4/2017 12:00

Noticed parallel builds failing, so I removed my "make -j8" and found I was
still getting the following errors while building:

/usr/src/usr.sbin/bhyve/rfb.c:835:25: error: expected expression
                DES_set_key((C_Block *)keystr, &ks);
                                      ^
/usr/src/usr.sbin/bhyve/rfb.c:835:16: error: use of undeclared identifier
'C_Block'
                DES_set_key((C_Block *)keystr, &ks);
                             ^
/usr/src/usr.sbin/bhyve/rfb.c:836:29: error: expected expression
                DES_ecb_encrypt((C_Block *)challenge,
                                          ^
/usr/src/usr.sbin/bhyve/rfb.c:836:20: error: use of undeclared identifier
'C_Block'
                DES_ecb_encrypt((C_Block *)challenge,
                                 ^
/usr/src/usr.sbin/bhyve/rfb.c:837:15: error: expected expression
                                (C_Block *)crypt_expected, &ks, DES_ENCRYPT);
                                          ^
/usr/src/usr.sbin/bhyve/rfb.c:837:6: error: use of undeclared identifier
'C_Block'
                                (C_Block *)crypt_expected, &ks, DES_ENCRYPT);
                                 ^
/usr/src/usr.sbin/bhyve/rfb.c:838:29: error: expected expression
                DES_ecb_encrypt((C_Block *)(challenge + PASSWD_LENGTH),
                                          ^
/usr/src/usr.sbin/bhyve/rfb.c:838:20: error: use of undeclared identifier
'C_Block'
                DES_ecb_encrypt((C_Block *)(challenge + PASSWD_LENGTH),
                                 ^
/usr/src/usr.sbin/bhyve/rfb.c:839:15: error: expected expression
                                (C_Block *)(crypt_expected + PASSWD_LENGTH),
                                          ^
/usr/src/usr.sbin/bhyve/rfb.c:839:6: error: use of undeclared identifier
'C_Block'
                                (C_Block *)(crypt_expected + PASSWD_LENGTH),
                                 ^
10 errors generated.
*** Error code 1

This is a HardenedBSD server with LibreSSL in base, however I noticed that in
rfb.c if NO_OPENSSL is defined, <openssl/des.h> is included, and there is no
C_Block struct in that header.

I noticed these functions expected a const_DES_cblock type. So making the
following changes made bhyve build for me:

diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c
index 3eb67314c02..c3c31729b96 100644
--- a/usr.sbin/bhyve/rfb.c
+++ b/usr.sbin/bhyve/rfb.c
@@ -832,11 +832,11 @@ rfb_handle(struct rfb_softc *rc, int cfd)
                memcpy(crypt_expected, challenge, AUTH_LENGTH);

                /* Encrypt the Challenge with DES */
-               DES_set_key((C_Block *)keystr, &ks);
-               DES_ecb_encrypt((C_Block *)challenge,
-                               (C_Block *)crypt_expected, &ks, DES_ENCRYPT);
-               DES_ecb_encrypt((C_Block *)(challenge + PASSWD_LENGTH),
-                               (C_Block *)(crypt_expected + PASSWD_LENGTH),
+               DES_set_key((const_DES_cblock *)keystr, &ks);
+               DES_ecb_encrypt((const_DES_cblock *)challenge,
+                               (const_DES_cblock *)crypt_expected, &ks,
DES_ENCRYPT);
+               DES_ecb_encrypt((const_DES_cblock *)(challenge +
PASSWD_LENGTH),
+                               (const_DES_cblock *)(crypt_expected +
PASSWD_LENGTH),
                                &ks, DES_ENCRYPT);

                if (memcmp(crypt_expected, buf, AUTH_LENGTH) != 0) {


It looks like these changes were added with this commit:


commit fa2245832bde97021dc63f35729cb10228d0204d                                 
Author:     araujo <ara...@freebsd.org>                                        
                                                                               
                                          AuthorDate: Fri Jun 2 02:35:16 2017
+0000                                                                           
Commit:     araujo <ara...@freebsd.org>                                        
                                                                               
                                          CommitDate: Fri Jun 2 02:35:16 2017
+0000                                                                           
                                                                               
                                                                               
                                              Add VNC Authentication support
based on RFC6143 section 7.2.2.                                                 
                                                                               
                                                                               
                                              Submitted by:   Fabian Freyer
<fabian.fre...@physik.tu-berlin.de>                                             
    Reworked by:    myself                                                     
                                                                               
                                              Reviewed by:    grehan, rgrimes
and jilles                                                                      
    MFC after:      1 week.
    Relnotes:       Yes.
    Sponsored by:   iXsystems, Inc.
    Differential Revision:  https://reviews.freebsd.org/D10818

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to