Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/tls: Replace cert_info::bytes with vector<byte> #113

Merged
merged 1 commit into from
May 7, 2024
Merged
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
5 changes: 2 additions & 3 deletions include/seastar/net/api.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <chrono>
#include <memory>
#include <vector>
#include <cstddef>
#include <cstring>
#include <sys/types.h>
#endif
Expand Down Expand Up @@ -178,9 +179,7 @@ struct session_dn {

/// Information about a certificate
struct cert_info {
static constexpr size_t bytes_inline_size = 31;
using bytes = basic_sstring<uint8_t, uint32_t, bytes_inline_size, false>;
bytes serial;
std::vector<std::byte> serial;
time_t expiry;
};

Expand Down
4 changes: 2 additions & 2 deletions src/net/tls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ static void gtls_chk(int res) {
}
}

static cert_info::bytes extract_x509_serial(gnutls_x509_crt_t cert) {
static std::vector<std::byte> extract_x509_serial(gnutls_x509_crt_t cert) {
constexpr size_t serial_max = 128;
size_t serial_size{serial_max};
cert_info::bytes serial(cert_info::bytes::initialized_later{}, serial_size);
std::vector<std::byte> serial(serial_size);
gtls_chk(gnutls_x509_crt_get_serial(cert, serial.data(), &serial_size));
serial.resize(serial_size);
return serial;
Expand Down