Skip to content

Commit c79c927

Browse files
authored
Merge pull request #57 from cisco/fix-build
Get CI builds passing
2 parents 240fe3a + 59343e3 commit c79c927

File tree

7 files changed

+22
-15
lines changed

7 files changed

+22
-15
lines changed

.github/workflows/build.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ jobs:
3232
env:
3333
CMAKE_BUILD_DIR: ${{ github.workspace }}/build
3434
CMAKE_TEST_DIR: ${{ github.workspace }}/build/test
35+
CMAKE_GENERATOR: "Ninja"
3536

3637
steps:
3738
- uses: actions/checkout@v4
3839

3940
- name: dependencies (macos)
4041
if: ${{ matrix.os == 'macos-latest' }}
4142
run: |
42-
brew install llvm
43+
brew install llvm ninja
4344
ln -s "/usr/local/opt/llvm/bin/clang-format" "/usr/local/bin/clang-format"
4445
ln -s "/usr/local/opt/llvm/bin/clang-tidy" "/usr/local/bin/clang-tidy"
4546
@@ -60,5 +61,5 @@ jobs:
6061
6162
- name: Unit tests
6263
run: |
63-
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target "${{ matrix.ctest-target }}" --config Release
64+
ctest --test-dir "${{ env.CMAKE_BUILD_DIR }}"
6465

.github/workflows/style.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616
- name: check clang-format
17-
uses: jidicula/[email protected]
17+
uses: jidicula/[email protected]
18+
with:
19+
clang-format-version: "17"
20+
exclude-regex: "gsl-lite.hpp"
1821

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ elseif(MSVC)
2626
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
2727
endif()
2828

29-
if (SANITIZERS AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
29+
if (SANITIZERS AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) AND NOT WIN32)
3030
set (SANITIZERS "-fsanitize=address -fsanitize=undefined")
3131
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZERS}")
3232
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZERS}")

include/sframe/sframe.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <gsl/gsl-lite.hpp>
4+
#include <optional>
45

56
namespace sframe {
67

src/crypto.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ cipher_digest_size(CipherSuite suite);
2222
size_t
2323
cipher_key_size(CipherSuite suite);
2424
size_t
25+
cipher_enc_key_size(CipherSuite suite);
26+
size_t
2527
cipher_nonce_size(CipherSuite suite);
2628

2729
///

src/sframe.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,17 @@ ContextBase::unprotect(const Header& header,
9595
}
9696

9797
static auto
98-
from_ascii(const char* str)
98+
from_ascii(const char* str, size_t len)
9999
{
100100
const auto ptr = reinterpret_cast<const uint8_t*>(str);
101-
return input_bytes(ptr, strlen(str));
101+
return input_bytes(ptr, len);
102102
}
103103

104-
static const auto base_label = from_ascii("SFrame 1.0 Secret ");
105-
static const auto key_label = from_ascii("key ");
106-
static const auto salt_label = from_ascii("salt ");
104+
static const auto base_label = from_ascii("SFrame 1.0 Secret ", 18);
105+
static const auto key_label = from_ascii("key ", 4);
106+
static const auto salt_label = from_ascii("salt ", 5);
107107

108-
owned_bytes<32>
108+
static owned_bytes<32>
109109
sframe_key_label(CipherSuite suite, KeyID key_id)
110110
{
111111
auto label = owned_bytes<32>(base_label);
@@ -119,7 +119,7 @@ sframe_key_label(CipherSuite suite, KeyID key_id)
119119
return label;
120120
}
121121

122-
owned_bytes<33>
122+
static owned_bytes<33>
123123
sframe_salt_label(CipherSuite suite, KeyID key_id)
124124
{
125125
auto label = owned_bytes<33>(base_label);

test/vectors.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ struct HexBytes
1818
};
1919

2020
// Seems redundant, but works
21-
bool
21+
static bool
2222
operator==(const HexBytes& hex, const input_bytes& other)
2323
{
2424
return input_bytes(hex) == other;
2525
}
2626

27-
bool
27+
static bool
2828
operator==(const input_bytes& other, const HexBytes& hex)
2929
{
3030
return hex == other;
3131
}
3232

33-
void
33+
static void
3434
from_json(const json& j, HexBytes& b)
3535
{
3636
const auto hex = j.get<std::string>();
@@ -47,7 +47,7 @@ from_json(const json& j, HexBytes& b)
4747
}
4848
}
4949

50-
void
50+
static void
5151
to_json(json& /* j */, const HexBytes& /* p */)
5252
{
5353
// Included just so that macros work

0 commit comments

Comments
 (0)