From 023dffe70c9d52e5887c170718a1eacb49eaba08 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Fri, 10 Nov 2023 12:58:11 +0100 Subject: [PATCH] Add support for i686-linux --- flake.nix | 4 +++- rust-toolchain.toml | 1 + src/domain/tls/certificate.rs | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index afad8bc..f605050 100644 --- a/flake.nix +++ b/flake.nix @@ -9,12 +9,14 @@ outputs = { self, nixpkgs, utils, naersk, rust-overlay }: let - supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; buildTargetsBySystem = { "x86_64-linux" = "x86_64-unknown-linux-musl"; + "i686-linux" = "i686-unknown-linux-musl"; "aarch64-linux" = "aarch64-unknown-linux-musl"; }; + supportedSystems = builtins.attrNames buildTargetsBySystem; + eachCrossSystem = callback: (builtins.foldl' (overall: buildSystem: overall // { ${buildSystem} = (builtins.foldl' diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 1917628..89137ef 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -3,5 +3,6 @@ channel = "nightly-2023-07-23" components = [ "rustfmt", "rustc-dev", "clippy", "cargo" ] targets = [ "x86_64-unknown-linux-musl", + "i686-unknown-linux-musl", "aarch64-unknown-linux-musl" ] diff --git a/src/domain/tls/certificate.rs b/src/domain/tls/certificate.rs index 9a78cf4..bbba4eb 100644 --- a/src/domain/tls/certificate.rs +++ b/src/domain/tls/certificate.rs @@ -42,7 +42,7 @@ impl Certificate { .or_unexpected_while("setting not_before")?; // 9999/07/23 - let not_after = Asn1Time::from_unix(253388296800).expect("initializing not_after"); + let not_after = Asn1Time::from_str("99990723000000Z").expect("initializing not_after"); builder .set_not_after(not_after.as_ref()) .or_unexpected_while("setting not_after")?; @@ -157,3 +157,19 @@ impl std::iter::IntoIterator for CertificateChain { self.0.into_iter() } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::domain; + use crate::domain::tls::PrivateKey; + use std::str::FromStr; + + #[test] + fn make_cert() { + let pkey = PrivateKey::new(); + let domain = domain::Name::from_str("foo.com").expect("domain name parsed"); + let cert = Certificate::new_self_signed(&pkey, &domain).expect("cert created"); + println!("{}", cert); + } +}