Re: Building krb5 libs without openssl

Isaac Boukris <[email protected]> Sun, 5 Dec 2021 20:20:34 +0200
Newsgroups gmane.comp.encryption.kerberos.devel
Message-ID <CAC-fF8S0Am-iABsHy4s6GuOGAVEZjZwnR7eWHN_C3bbzvFZGFQ@mail.gmail.com>
On Sun, Dec 5, 2021 at 8:10 PM Isaac Boukris <[email protected]> wrote:
>
> On Sun, Dec 5, 2021 at 6:40 PM Greg Hudson <[email protected]> wrote:
> >
> > On 12/5/21 8:16 AM, Isaac Boukris wrote:
> > > The configure help isn't clear about '--with-tls-impl' alternatives,
> > > from the script it looks like 'no' is an option but even though it
> > > still compiles the files at 'lib/crypto/openssl' unless I comment it
> > > out from the Makefile.
> >
> > I recently changed how the crypto build system works so that all source
> > files are built, but some of them generate empty objects.  This improves
> > automatic dependency generation and allows the OpenSSL back end to
> > borrow from the builtin back end depending on the OpenSSL version.  See
> > commit 7e8c41afc54db2ca75de5a1e2e440b034be8887b .
>
> The actual error I see when I try to build with emscripten, maybe
> something gets wrong in the configure stage:
>
> making all in lib/crypto/openssl/des...
> make[4]: Entering directory '/home/admin/git/krb5/src/lib/crypto/openssl/des'
> /home/admin/git/emsdk/upstream/emscripten/emcc -DHAVE_CONFIG_H
> -I../../../../include -I../../../../include -I./../../krb
> -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE  -g -O0
> -Werror=unknown-warning-option -Wall -Wcast-align -Wshadow
> -Wmissing-prototypes -Wno-format-zero-length -Woverflow
> -Wstrict-overflow -Wmissing-format-attribute -Wmissing-prototypes
> -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch
> -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
> -Wunknown-pragmas -Wsign-compare -Wnewline-eof -Werror=uninitialized
> -Werror=pointer-arith -Werror=int-conversion
> -Werror=incompatible-pointer-types -Werror=implicit-int
> -Werror=declaration-after-statement
> -Werror-implicit-function-declaration   -c des_keys.c
> des_keys.c:28:10: fatal error: 'openssl/des.h' file not found
> #include <openssl/des.h>
>          ^~~~~~~~~~~~~~~
> 1 error generated.

The attached patch solves it for me, based on the commit you
referenced, if it makes sense.

_______________________________________________
krbdev mailing list             [email protected]
https://mailman.mit.edu/mailman/listinfo/krbdev
0001-Fix-K5_OPENSSL-macros-for-DES-and-CAMELLIA.patch (text/x-patch, 1.4 KB)
From 76618a9c40a3bfe7a48d7b1dc09c440f98f0ad14 Mon Sep 17 00:00:00 2001
From: Isaac Boukris <[email protected]>
Date: Sun, 5 Dec 2021 20:18:44 +0200
Subject: [PATCH] Fix K5_OPENSSL macros for DES and CAMELLIA

---
 src/lib/crypto/openssl/des/des_keys.c          | 2 +-
 src/lib/crypto/openssl/enc_provider/camellia.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lib/crypto/openssl/des/des_keys.c b/src/lib/crypto/openssl/des/des_keys.c
index 0a4a5178b..0d55c43e1 100644
--- a/src/lib/crypto/openssl/des/des_keys.c
+++ b/src/lib/crypto/openssl/des/des_keys.c
@@ -24,10 +24,10 @@
  * or implied warranty.
  */
 
+#ifdef K5_OPENSSL_DES_KEY_PARITY
 #include "crypto_int.h"
 #include <openssl/des.h>
 
-#ifdef K5_OPENSSL_DES_KEY_PARITY
 void
 k5_des_fixup_key_parity(unsigned char *keybits)
 {
diff --git a/src/lib/crypto/openssl/enc_provider/camellia.c b/src/lib/crypto/openssl/enc_provider/camellia.c
index 81f4772ca..e102a1bb8 100644
--- a/src/lib/crypto/openssl/enc_provider/camellia.c
+++ b/src/lib/crypto/openssl/enc_provider/camellia.c
@@ -24,6 +24,8 @@
  * or implied warranty.
  */
 
+#ifdef K5_OPENSSL_CAMELLIA
+
 #include "crypto_int.h"
 #include <openssl/evp.h>
 #include <openssl/camellia.h>
@@ -33,7 +35,6 @@
 #include <openssl/modes.h>
 #endif
 
-#ifdef K5_OPENSSL_CAMELLIA
 
 static krb5_error_code
 cbc_enc(krb5_key key, const krb5_data *ivec, krb5_crypto_iov *data,
-- 
2.31.1