Skip to content

Commit

Permalink
chore: Add autotools build; exempt crypto_pwhash from tokstyle.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Dec 13, 2021
1 parent fd32c87 commit 5c53e6a
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 25 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ci

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build-nacl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run:
sudo apt-get update &&
sudo apt-get install -y --no-install-recommends
libconfig-dev
libopus-dev
libvpx-dev
pkg-config

- name: Build NaCl
run: .travis/autotools-linux install

- name: Build toxcore
run: CC=gcc .travis/autotools-linux script
1 change: 0 additions & 1 deletion .travis/autotools-linux
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ travis_script() {
add_config_flag --disable-ipv6
add_config_flag --enable-nacl
add_config_flag --enable-daemon
add_config_flag --enable-logging
add_config_flag --with-log-level=TRACE

autoreconf -fi
Expand Down
2 changes: 0 additions & 2 deletions auto_tests/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
if BUILD_TESTS

TESTS = \
bootstrap_test \
conference_double_invite_test \
conference_invite_merge_test \
conference_peer_nick_test \
Expand Down Expand Up @@ -34,7 +33,6 @@ TESTS = \
set_status_message_test \
skeleton_test \
TCP_test \
tcp_relay_test \
tox_many_tcp_test \
tox_many_test \
tox_one_test \
Expand Down
15 changes: 15 additions & 0 deletions testing/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

CIMPLE_FILES = [
"//c-toxcore/toxav:cimple_files",
"//c-toxcore/toxcore:cimple_files",
"//c-toxcore/toxencryptsave:cimple_files",
]

sh_test(
name = "cimple_test",
size = "small",
srcs = ["//hs-tokstyle/tools:check-cimple"],
args = ["$(locations %s)" % f for f in CIMPLE_FILES],
data = CIMPLE_FILES,
tags = ["haskell"],
)

cc_library(
name = "misc_tools",
srcs = ["misc_tools.c"],
Expand Down
11 changes: 4 additions & 7 deletions toxav/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,8 @@ CIMPLE_SRCS = glob(
exclude = ["*.api.h"],
)

sh_test(
name = "cimple_test",
size = "small",
srcs = ["//hs-tokstyle/tools:check-cimple"],
args = ["$(location %s)" % f for f in CIMPLE_SRCS],
data = CIMPLE_SRCS,
tags = ["haskell"],
sh_library(
name = "cimple_files",
srcs = CIMPLE_SRCS,
visibility = ["//c-toxcore/testing:__pkg__"],
)
11 changes: 4 additions & 7 deletions toxcore/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,8 @@ CIMPLE_SRCS = glob(
exclude = ["*.api.h"],
)

sh_test(
name = "cimple_test",
size = "small",
srcs = ["//hs-tokstyle/tools:check-cimple"],
args = ["$(location %s)" % f for f in CIMPLE_SRCS],
data = CIMPLE_SRCS,
tags = ["haskell"],
sh_library(
name = "cimple_files",
srcs = CIMPLE_SRCS,
visibility = ["//c-toxcore/testing:__pkg__"],
)
6 changes: 6 additions & 0 deletions toxcore/crypto_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
* Copyright © 2013 Tox project.
*/

//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
//!TOKSTYLE+

/*
* Functions for the core crypto.
*
Expand Down
8 changes: 8 additions & 0 deletions toxcore/crypto_core_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
//!TOKSTYLE+

// For explicit_bzero.
#ifndef _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#endif

#include "crypto_core.h"

Expand All @@ -30,6 +37,7 @@
#include <windows.h>
#include <wincrypt.h>
#endif
#include <string.h>
#endif


Expand Down
5 changes: 5 additions & 0 deletions toxcore/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
* Copyright © 2016-2018 The TokTok team.
* Copyright © 2013 Tox project.
*/
//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
//!TOKSTYLE+

/*
* Functions for the core networking.
Expand Down
12 changes: 5 additions & 7 deletions toxencryptsave/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ CIMPLE_SRCS = glob(
[
"*.c",
"*.h",
"*/*.h",
],
exclude = ["*.api.h"],
)

sh_test(
name = "cimple_test",
size = "small",
srcs = ["//hs-tokstyle/tools:check-cimple"],
args = ["$(location %s)" % f for f in CIMPLE_SRCS],
data = CIMPLE_SRCS,
tags = ["haskell"],
sh_library(
name = "cimple_files",
srcs = CIMPLE_SRCS,
visibility = ["//c-toxcore/testing:__pkg__"],
)
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#ifndef C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_H
#define C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_H

//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef VANILLA_NACL /* toxcore only uses this when libsodium is unavailable */
#ifdef VANILLA_NACL /* toxcore only uses this when libsodium is unavailable */

#ifndef crypto_pwhash_scryptsalsa208sha256_H
#define crypto_pwhash_scryptsalsa208sha256_H
Expand Down Expand Up @@ -93,5 +94,6 @@ int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdl
#endif

#endif
//!TOKSTYLE+

#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_CRYPTO_SCRYPT_H
#define C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_CRYPTO_SCRYPT_H

//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down Expand Up @@ -94,5 +95,6 @@ extern uint8_t * escrypt_gensalt_r(
#endif /* !_CRYPTO_SCRYPT_H_ */

#endif
//!TOKSTYLE+

#endif
2 changes: 2 additions & 0 deletions toxencryptsave/crypto_pwhash_scryptsalsa208sha256/export.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_EXPORT_H
#define C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_EXPORT_H

//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down Expand Up @@ -39,5 +40,6 @@
#endif

#endif
//!TOKSTYLE+

#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_PBKDF2_SHA256_H
#define C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_PBKDF2_SHA256_H

//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down Expand Up @@ -53,5 +54,6 @@ void PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t,
#endif /* !_SHA256_H_ */

#endif
//!TOKSTYLE+

#endif
2 changes: 2 additions & 0 deletions toxencryptsave/crypto_pwhash_scryptsalsa208sha256/runtime.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_RUNTIME_H
#define C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_RUNTIME_H

//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down Expand Up @@ -34,5 +35,6 @@ int sodium_runtime_has_sse3(void);
#endif

#endif
//!TOKSTYLE+

#endif
2 changes: 2 additions & 0 deletions toxencryptsave/crypto_pwhash_scryptsalsa208sha256/sysendian.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SYSENDIAN_H
#define C_TOXCORE_TOXENCRYPTSAVE_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SYSENDIAN_H

//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down Expand Up @@ -154,5 +155,6 @@ le64enc(void *pp, uint64_t x)
#endif /* !_SYSENDIAN_H_ */

#endif
//!TOKSTYLE+

#endif
2 changes: 2 additions & 0 deletions toxencryptsave/toxencryptsave.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
/*
* Batch encryption functions.
*/
//!TOKSTYLE-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
//!TOKSTYLE+

#include "../toxcore/ccompat.h"
#include "../toxcore/crypto_core.h"
Expand Down

0 comments on commit 5c53e6a

Please sign in to comment.