Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ACLOCAL_AMFLAGS = -I m4
ARFLAGS = cr
AM_LIBTOOLFLAGS = "--preserve-dup-deps"

include_HEADERS = hiba.h extensions.h errors.h checks.h certificates.h revocations.h
include_HEADERS = hiba.h extensions.h errors.h checks.h certificates.h revocations.h openssh/includes.h

lib_LTLIBRARIES = libhiba.la
libhiba_la_SOURCES = extensions.c errors.c checks.c certificates.c revocations.c
Expand Down
2 changes: 2 additions & 0 deletions certificates.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <string.h>
#include <sys/types.h>

#include "config.h"

#include "extensions.h"
#include "certificates.h"
#include "errors.h"
Expand Down
3 changes: 2 additions & 1 deletion checks.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
#include <time.h>
#include <unistd.h>

#include "checks.h"
#include "config.h"

#include "checks.h"
#include "errors.h"
#include "extensions.h"
#include "log.h"
Expand Down
24 changes: 16 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ m4_define([MAJOR], 1)
m4_define([MINOR], 4)

AC_PREREQ([2.69])
AC_INIT([HIBA], [MAJOR.MINOR], [hibassh@google.com])
AC_INIT([HIBA], [MAJOR.MINOR], [hibassh@google.com], [], [https://github.com/google/hiba])
AC_CONFIG_SRCDIR([hiba.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
AC_LANG([C])
AC_PROG_CC([cc gcc clang])

AH_TOP([#ifndef HIBA_CONFIG_H_
#define HIBA_CONFIG_H_

#include "openssh/includes.h"])
AH_BOTTOM([#endif /* HIBA_CONFIG_H_ */])

LT_INIT

AM_INIT_AUTOMAKE([foreign no-dependencies])
Expand Down Expand Up @@ -122,13 +128,6 @@ AC_LINK_IFELSE(
)
LDFLAGS="$save_LDFLAGS"

# Check for definition of max hostname length
AC_CHECK_DECL(
[HOST_NAME_MAX], [], [AC_DEFINE([HOST_NAME_MAX], [64], [
Maximum supported hostname size if not already defined by OS.
])], [#include <limits.h>],
)

# Update flags.
CFLAGS="$CFLAGS $extra_CFLAGS"
CPPFLAGS="$CPPFLAGS $extra_CPPFLAGS"
Expand Down Expand Up @@ -296,6 +295,15 @@ AC_SEARCH_LIBS([sshbuf_new], [ssh], [], [
AC_SUBST([extra_LIBS], [$LIBS])
LIBS="$save_LIBS"

# Check for definition of max hostname length
# If undefined, it could still be provided by OpenSSH headers.
AC_CHECK_DECL([HOST_NAME_MAX], [], AH_VERBATIM([HOST_NAME_MAX],
[/* Maximum supported hostname size if not already defined. */
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 64
#endif]), [#include <limits.h>],
)

# Checks for header files.
AC_CHECK_HEADERS([inttypes.h limits.h stdint.h stdlib.h string.h sys/types.h unistd.h])

Expand Down
1 change: 0 additions & 1 deletion errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* https://developers.google.com/open-source/licenses/bsd
*/
#include "errors.h"
#include "ssherr.h"

const char *hiba_err(int err) {
if (err == HIBA_OK)
Expand Down
2 changes: 2 additions & 0 deletions hiba-chk.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#define HIBA_INTERNAL

#include "config.h"

#include "log.h"
#include "hiba.h"
#include "misc.h"
Expand Down
2 changes: 2 additions & 0 deletions hiba-gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <sys/types.h>
#include <unistd.h>

#include "config.h"

#include "log.h"
#include "hiba.h"
#include "misc.h"
Expand Down
2 changes: 2 additions & 0 deletions hiba-grl.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#define HIBA_INTERNAL

#include "config.h"

#include "log.h"
#include "hiba.h"
#include "misc.h"
Expand Down
26 changes: 26 additions & 0 deletions openssh/includes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2021 The HIBA Authors
*
* Wrapper to openssh headers.
*
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file or at
* https://developers.google.com/open-source/licenses/bsd
*/
#ifndef _OPENSSH_WRAPPER_INCLUDES_H
#define _OPENSSH_WRAPPER_INCLUDES_H

#include <includes.h>

/*
* The includes header indirectly includes the config.h file from the OpenSSH
* project which conflicts/overrides HIBA's config.h
*/
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_URL
#undef PACKAGE_VERSION

#endif /* _OPENSSH_WRAPPER_INCLUDES_H */
4 changes: 3 additions & 1 deletion revocations.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
#include <sys/types.h>
#include <time.h>

#include "errors.h"
#include "config.h"

#include "log.h"
#include "errors.h"
#include "revocations.h"

#define HIBA_CURRENT_GRL_VERSION 0x1
Expand Down
6 changes: 5 additions & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
#include <sys/types.h>
#include <unistd.h>

#include "config.h"

#include "certificates.h"
#include "errors.h"
#include "extensions.h"
#include "log.h"
#include "hiba.h"
#include "misc.h"
#include "openbsd-compat/bsd-misc.h"
#include "ssherr.h"
Expand Down