build: require boost >= 1.71.0
Refs: #5276
Change-Id: Ifc719cf5e4b8704e0408cab1f9ab849006061dfc
diff --git a/src/detail/crypto-helpers.cpp b/src/detail/crypto-helpers.cpp
index 16e56a5..0834ad8 100644
--- a/src/detail/crypto-helpers.cpp
+++ b/src/detail/crypto-helpers.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2017-2022, Regents of the University of California.
+ * Copyright (c) 2017-2023, Regents of the University of California.
*
* This file is part of ndncert, a certificate management system based on NDN.
*
@@ -362,33 +362,10 @@
// }
}
-#ifndef NDNCERT_HAVE_TESTS
-static
-#endif
-uint32_t
+static uint32_t
loadBigU32(const uint8_t* src) noexcept
{
-#if BOOST_VERSION >= 107100
return boost::endian::endian_load<uint32_t, 4, boost::endian::order::big>(src);
-#else
- uint32_t dest;
- std::memcpy(reinterpret_cast<uint8_t*>(&dest), src, sizeof(dest));
- return boost::endian::big_to_native(dest);
-#endif
-}
-
-#ifndef NDNCERT_HAVE_TESTS
-static
-#endif
-void
-storeBigU32(uint8_t* dest, uint32_t src) noexcept
-{
-#if BOOST_VERSION >= 107100
- boost::endian::endian_store<uint32_t, 4, boost::endian::order::big>(dest, src);
-#else
- boost::endian::native_to_big_inplace(src);
- std::memcpy(dest, reinterpret_cast<const uint8_t*>(&src), sizeof(src));
-#endif
}
static void
@@ -404,7 +381,7 @@
else {
counter += increment;
}
- storeBigU32(&iv[8], counter);
+ boost::endian::endian_store<uint32_t, 4, boost::endian::order::big>(&iv[8], counter);
}
Block
diff --git a/src/detail/crypto-helpers.hpp b/src/detail/crypto-helpers.hpp
index 235c6b5..1cf8df4 100644
--- a/src/detail/crypto-helpers.hpp
+++ b/src/detail/crypto-helpers.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2017-2021, Regents of the University of California.
+ * Copyright (c) 2017-2023, Regents of the University of California.
*
* This file is part of ndncert, a certificate management system based on NDN.
*
@@ -139,7 +139,7 @@
*
* The TLV spec: https://github.com/named-data/ndncert/wiki/NDNCERT-Protocol-0.3#242-aes-gcm-encryption.
*
- * @param tlv_type The TLV TYPE of the encoded block, either ApplicationParameters or Content.
+ * @param tlvType The TLV TYPE of the encoded block, either ApplicationParameters or Content.
* @param key The AES key used for encryption.
* @param payload The plaintext payload.
* @param payloadSize The size of the plaintext payload.
@@ -173,14 +173,6 @@
const uint8_t* associatedData, size_t associatedDataSize,
std::vector<uint8_t>& decryptionIv, const std::vector<uint8_t>& encryptionIv);
-#ifdef NDNCERT_HAVE_TESTS
-uint32_t
-loadBigU32(const uint8_t* src) noexcept;
-
-void
-storeBigU32(uint8_t* dest, uint32_t src) noexcept;
-#endif
-
} // namespace ndncert
#endif // NDNCERT_DETAIL_CRYPTO_HELPERS_HPP
diff --git a/tests/io-fixture.hpp b/tests/io-fixture.hpp
index 209026f..d7b18e1 100644
--- a/tests/io-fixture.hpp
+++ b/tests/io-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,7 +24,7 @@
#include "tests/clock-fixture.hpp"
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
namespace ndncert::tests {
@@ -35,17 +35,13 @@
afterTick() final
{
if (m_io.stopped()) {
-#if BOOST_VERSION >= 106600
m_io.restart();
-#else
- m_io.reset();
-#endif
}
m_io.poll();
}
protected:
- boost::asio::io_service m_io;
+ boost::asio::io_context m_io;
};
} // namespace ndncert::tests
diff --git a/tests/unit-tests/crypto-helpers.t.cpp b/tests/unit-tests/crypto-helpers.t.cpp
index ff645dd..f8ec1a4 100644
--- a/tests/unit-tests/crypto-helpers.t.cpp
+++ b/tests/unit-tests/crypto-helpers.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2017-2022, Regents of the University of California.
+ * Copyright (c) 2017-2023, Regents of the University of California.
*
* This file is part of ndncert, a certificate management system based on NDN.
*
@@ -22,6 +22,8 @@
#include "tests/boost-test.hpp"
+#include <boost/endian/conversion.hpp>
+
namespace ndncert::tests {
BOOST_AUTO_TEST_SUITE(TestCryptoHelpers)
@@ -271,6 +273,8 @@
BOOST_AUTO_TEST_CASE(AesIV)
{
+ namespace be = boost::endian;
+
const uint8_t key[] = {0xbc, 0x22, 0xf3, 0xf0, 0x5c, 0xc4, 0x0d, 0xb9,
0x31, 0x1e, 0x41, 0x92, 0x96, 0x6f, 0xee, 0x92};
const std::string plaintext = "alongstringalongstringalongstringalongstringalongstringalongstringalongstringalongstring";
@@ -282,8 +286,8 @@
auto ivBlock = block.get(tlv::InitializationVector);
ndn::Buffer ivBuf(ivBlock.value(), ivBlock.value_size());
BOOST_CHECK_EQUAL(ivBuf.size(), 12);
- BOOST_CHECK_EQUAL(loadBigU32(&encryptionIv[8]), 6);
- BOOST_CHECK_EQUAL(loadBigU32(&ivBuf[8]), 0);
+ BOOST_CHECK_EQUAL((be::endian_load<uint32_t, 4, be::order::big>(&encryptionIv[8])), 6);
+ BOOST_CHECK_EQUAL((be::endian_load<uint32_t, 4, be::order::big>(&ivBuf[8])), 0);
block = encodeBlockWithAesGcm128(ndn::tlv::ApplicationParameters, key, (uint8_t*)plaintext.c_str(), plaintext.size(),
(uint8_t*)associatedData.c_str(), associatedData.size(), encryptionIv);
diff --git a/tools/ndncert-ca-server.cpp b/tools/ndncert-ca-server.cpp
index 144f416..566f355 100644
--- a/tools/ndncert-ca-server.cpp
+++ b/tools/ndncert-ca-server.cpp
@@ -20,8 +20,8 @@
#include "ca-module.hpp"
-#include <boost/asio.hpp>
#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/signal_set.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
@@ -45,11 +45,7 @@
writeDataToRepo(const Data& data)
{
boost::asio::ip::tcp::iostream requestStream;
-#if BOOST_VERSION >= 106600
requestStream.expires_after(std::chrono::seconds(5));
-#else
- requestStream.expires_from_now(boost::posix_time::seconds(5));
-#endif // BOOST_VERSION >= 106600
requestStream.connect(repoHost, repoPort);
if (!requestStream) {
std::cerr << "ERROR: Cannot publish the certificate to repo-ng"
diff --git a/wscript b/wscript
index 8fd6573..ad13479 100644
--- a/wscript
+++ b/wscript
@@ -40,8 +40,8 @@
conf.check_openssl(lib='crypto', atleast_version='1.1.1')
conf.check_boost(lib='filesystem', mt=True)
- if conf.env.BOOST_VERSION_NUMBER < 106501:
- conf.fatal('The minimum supported version of Boost is 1.65.1.\n'
+ if conf.env.BOOST_VERSION_NUMBER < 107100:
+ conf.fatal('The minimum supported version of Boost is 1.71.0.\n'
'Please upgrade your distribution or manually install a newer version of Boost.\n'
'For more information, see https://redmine.named-data.net/projects/nfd/wiki/Boost')