Skip to content

Commit

Permalink
cleanup: Remove apidsl; remove crypto_memcmp.
Browse files Browse the repository at this point in the history
* `crypto_memcmp` was replaced by more specific functions. We never want
  to compare arbitrary amounts of data this way. We use these functions
  to compare key material.
* apidsl has been bothering people, so now we un-bother them. You're
  welcome.
* Added the memlock/unlock functions from the New Group Chats branch.
* Remove some system dependencies in crypto_core_mem.c.
* Renamed UPPERCASE_NAMES to Snake_Camel_Case names.
  • Loading branch information
iphydf committed Dec 19, 2021
1 parent a42b0d6 commit 24c924d
Show file tree
Hide file tree
Showing 23 changed files with 447 additions and 4,562 deletions.
4 changes: 2 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
cirrus-ci_task:
container:
image: toxchat/toktok-stack:0.0.27-third_party
image: toxchat/toktok-stack:0.0.28-third_party
cpu: 2
memory: 2G
configure_script:
Expand All @@ -19,7 +19,7 @@ cirrus-ci_task:

cimple_task:
container:
image: toxchat/toktok-stack:0.0.27-third_party
image: toxchat/toktok-stack:0.0.28-third_party
cpu: 2
memory: 4G
configure_script:
Expand Down
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ message("SOVERSION: ${SOVERSION}")
#
################################################################################

include(ApiDsl)
include(CTest)
include(ModulePackage)
include(StrictAbi)
Expand Down Expand Up @@ -240,7 +239,6 @@ set(toxcore_SOURCES ${toxcore_SOURCES}

# LAYER 8: Public API
# -------------------
apidsl(toxcore/tox.api.h)
set(toxcore_SOURCES ${toxcore_SOURCES}
toxcore/tox_api.c
toxcore/tox.c
Expand All @@ -255,7 +253,6 @@ set(toxcore_API_HEADERS ${toxcore_API_HEADERS} ${toxcore_SOURCE_DIR}/toxcore/tox
################################################################################

if(BUILD_TOXAV)
apidsl(toxav/toxav.api.h)
set(toxcore_SOURCES ${toxcore_SOURCES}
toxav/audio.c
toxav/audio.h
Expand Down Expand Up @@ -286,7 +283,6 @@ endif()
#
################################################################################

apidsl(toxencryptsave/toxencryptsave.api.h)
set(toxcore_SOURCES ${toxcore_SOURCES}
toxencryptsave/toxencryptsave.c
toxencryptsave/toxencryptsave.h)
Expand Down
44 changes: 0 additions & 44 deletions cmake/ApiDsl.cmake

This file was deleted.

57 changes: 0 additions & 57 deletions other/astyle/format-source
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -ex

SOURCE_DIR="$1"
ASTYLE="$2"
APIDSL="$3"

# Go to the source root.
if [ -z "$SOURCE_DIR" ]; then
Expand All @@ -22,62 +21,6 @@ if ! which "$ASTYLE"; then
exit 1
fi

if ! which "$APIDSL"; then
if [ -f ../apidsl/apigen.native ]; then
APIDSL=../apidsl/apigen.native
else
APIDSL=apidsl_curl
fi
fi

TO_JSON='s/\\/\\\\/g;s/\n/\\n/g;s/"/\\"/g;s/^(.*)$/"$1"/'
FROM_JSON='s/\\"/"/g;s/^"(.*)"$/$1/;s/\\\\/\\/g;s/\\n/\n/g'

apidsl_request() {
TMPFILE=$(mktemp /tmp/apidsl.XXXXXX)
curl -s -o "$TMPFILE" -X POST --data @<(
echo '["Request",'
cat "$2"
echo ']'
) "https://apidsl.herokuapp.com/$1"
if grep '\[1,"' "$TMPFILE" >/dev/null; then
echo "Error: $(grep -o '".*"' /tmp/apidsl-$$ | perl -0777 -pe "$FROM_JSON")" >&2
rm "$TMPFILE"
exit 1
fi
perl -0777 -pe 's/^\[0,(.*)\]$/$1/' "$TMPFILE"
rm "$TMPFILE"
}

apidsl_curl() {
echo "apidsl_curl $*" >&2
apidsl_request "c" <(
apidsl_request "parse" <(
perl -0777 -pe "$TO_JSON" "$1"
)
) | perl -0777 -pe "$FROM_JSON"
}

# Check if apidsl generated sources are up to date.
set +x
"$APIDSL" toxcore/tox.api.h >toxcore/tox.h &
"$APIDSL" toxav/toxav.api.h >toxav/toxav.h &
"$APIDSL" toxencryptsave/toxencryptsave.api.h >toxencryptsave/toxencryptsave.h &
set -x

wait
wait
wait
wait
wait
wait
wait

if grep '<unresolved>' ./*/*.h; then
echo "error: some apidsl references were unresolved"
exit 1
fi

readarray -t CC_SOURCES <<<"$(find . '(' -name '*.cc' ')')"
CC_SOURCES+=(toxcore/crypto_core.c)
CC_SOURCES+=(toxcore/ping_array.c)
Expand Down
14 changes: 4 additions & 10 deletions toxav/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ cc_library(
"toxav_old.c",
],
hdrs = [
"toxav.api.h",
"toxav.h",
],
visibility = ["//c-toxcore:__subpackages__"],
Expand All @@ -125,16 +124,11 @@ cc_library(
],
)

CIMPLE_SRCS = glob(
[
"*.c",
"*.h",
],
exclude = ["*.api.h"],
)

sh_library(
name = "cimple_files",
srcs = CIMPLE_SRCS,
srcs = glob([
"*.c",
"*.h",
]),
visibility = ["//c-toxcore/testing:__pkg__"],
)
Loading

0 comments on commit 24c924d

Please sign in to comment.