Skip to content

Commit a024adf

Browse files
committed
fix: downgrade to edition 2021 and MSRV 1.80 for stable Rust compatibility
Edition 2024 requires Rust 1.85+ which breaks installation for users on stable toolchains (e.g., Rust 1.84). Since we support Python 3.9+ targeting enterprise environments, a conservative MSRV aligns with that philosophy. Changes: - Cargo.toml: edition 2024 → 2021, rust-version 1.85 → 1.80 - FFI: #[unsafe(no_mangle)] → #[no_mangle] (edition 2021 syntax) - Import ordering updated by rustfmt (edition 2021 style) Fixes cachekit-io/cachekit-py#30
1 parent 805339c commit a024adf

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "cachekit-core"
33
version = "0.1.0"
4-
edition = "2024"
4+
edition = "2021"
55
authors = ["cachekit Contributors"]
66
description = "LZ4 compression, xxHash3 integrity, AES-256-GCM encryption for byte payloads"
7-
rust-version = "1.85"
7+
rust-version = "1.80"
88
license = "MIT"
99
repository = "https://github.com/cachekit-io/cachekit-core"
1010
homepage = "https://github.com/cachekit-io/cachekit-core"

examples/bench_throughput.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn bench_size(size: usize, iterations: usize) {
5555
// AES-256-GCM Encrypt
5656
#[cfg(feature = "encryption")]
5757
{
58-
use ring::aead::{AES_256_GCM, Aad, LessSafeKey, Nonce, UnboundKey};
58+
use ring::aead::{Aad, LessSafeKey, Nonce, UnboundKey, AES_256_GCM};
5959
let key_bytes = [0u8; 32];
6060
let unbound = UnboundKey::new(&AES_256_GCM, &key_bytes).unwrap();
6161
let key = LessSafeKey::new(unbound);
@@ -75,7 +75,7 @@ fn bench_size(size: usize, iterations: usize) {
7575
// AES-256-GCM Decrypt
7676
#[cfg(feature = "encryption")]
7777
{
78-
use ring::aead::{AES_256_GCM, Aad, LessSafeKey, Nonce, UnboundKey};
78+
use ring::aead::{Aad, LessSafeKey, Nonce, UnboundKey, AES_256_GCM};
7979
let key_bytes = [0u8; 32];
8080
let unbound = UnboundKey::new(&AES_256_GCM, &key_bytes).unwrap();
8181
let key = LessSafeKey::new(unbound);

src/encryption/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
2222
use crate::metrics::OperationMetrics;
2323
use ring::{
24-
aead::{AES_256_GCM, Aad, LessSafeKey, Nonce, UnboundKey},
24+
aead::{Aad, LessSafeKey, Nonce, UnboundKey, AES_256_GCM},
2525
rand::{SecureRandom, SystemRandom},
2626
};
2727
use std::sync::atomic::{AtomicU64, Ordering};

src/encryption/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub mod key_rotation;
1616

1717
// Re-exports for convenience
1818
pub use core::{EncryptionError, ZeroKnowledgeEncryptor};
19-
pub use key_derivation::{KeyDerivationError, derive_domain_key};
19+
pub use key_derivation::{derive_domain_key, KeyDerivationError};
2020
pub use key_rotation::{KeyRotationState, RotationAwareHeader};
2121

2222
// RotationAwareHeader is the canonical encryption header
@@ -59,7 +59,7 @@ mod tests {
5959
assert_eq!(decoded.key_fingerprint, [0x12; 16]);
6060
assert_eq!(decoded.domain, *b"ench");
6161
assert_eq!(decoded.key_version, 0); // Non-rotated data
62-
// Verify algorithm is always AES-256-GCM (byte value 0)
62+
// Verify algorithm is always AES-256-GCM (byte value 0)
6363
assert_eq!(bytes[1], 0);
6464
}
6565

src/ffi/byte_storage.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use std::slice;
3636
/// - Pointers remain valid for duration of call
3737
///
3838
/// Function is panic-safe and will never unwind across FFI boundary.
39-
#[unsafe(no_mangle)]
39+
#[no_mangle]
4040
pub unsafe extern "C" fn cachekit_compress(
4141
input: *const u8,
4242
input_len: usize,
@@ -133,7 +133,7 @@ pub unsafe extern "C" fn cachekit_compress(
133133
/// - Pointers remain valid for duration of call
134134
///
135135
/// Function is panic-safe and will never unwind across FFI boundary.
136-
#[unsafe(no_mangle)]
136+
#[no_mangle]
137137
pub unsafe extern "C" fn cachekit_decompress(
138138
input: *const u8,
139139
input_len: usize,
@@ -220,7 +220,7 @@ pub unsafe extern "C" fn cachekit_decompress(
220220
///
221221
/// # Safety
222222
/// This is a pure computation with no memory access. Always safe to call.
223-
#[unsafe(no_mangle)]
223+
#[no_mangle]
224224
pub extern "C" fn cachekit_compressed_bound(input_len: usize) -> usize {
225225
// LZ4 worst case: input_len + (input_len / 255) + 16
226226
// See: https://github.com/lz4/lz4/blob/dev/lib/lz4.h#L166

src/ffi/encryption.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const TAG_SIZE: usize = 16;
1919
const CIPHERTEXT_OVERHEAD: usize = NONCE_SIZE + TAG_SIZE; // 28 bytes
2020

2121
#[cfg(feature = "encryption")]
22-
use crate::encryption::{ZeroKnowledgeEncryptor, derive_domain_key};
22+
use crate::encryption::{derive_domain_key, ZeroKnowledgeEncryptor};
2323
#[cfg(feature = "encryption")]
2424
use crate::ffi::error::CachekitError;
2525
#[cfg(feature = "encryption")]
@@ -77,7 +77,7 @@ use std::slice;
7777
/// **RECOMMENDATION**: Store the encryptor handle in a global/singleton and reuse it.
7878
/// Each handle supports 2^32 (~4 billion) encryptions before requiring a new key.
7979
#[cfg(feature = "encryption")]
80-
#[unsafe(no_mangle)]
80+
#[no_mangle]
8181
pub unsafe extern "C" fn cachekit_encryptor_new(
8282
error_out: *mut CachekitError,
8383
) -> *mut CachekitEncryptor {
@@ -115,7 +115,7 @@ pub unsafe extern "C" fn cachekit_encryptor_new(
115115
/// - `handle` must not be used after this call
116116
/// - Function is panic-safe and will never unwind across FFI boundary
117117
#[cfg(feature = "encryption")]
118-
#[unsafe(no_mangle)]
118+
#[no_mangle]
119119
pub unsafe extern "C" fn cachekit_encryptor_free(handle: *mut CachekitEncryptor) {
120120
let _ = catch_unwind(|| {
121121
// from_opaque_ptr handles null check and validity tracking
@@ -144,7 +144,7 @@ pub unsafe extern "C" fn cachekit_encryptor_free(handle: *mut CachekitEncryptor)
144144
/// - `handle` must remain valid for duration of call
145145
/// - Function is panic-safe and will never unwind across FFI boundary
146146
#[cfg(feature = "encryption")]
147-
#[unsafe(no_mangle)]
147+
#[no_mangle]
148148
pub unsafe extern "C" fn cachekit_encryptor_get_counter(handle: *const CachekitEncryptor) -> u64 {
149149
let result = catch_unwind(|| {
150150
// as_ref handles null check and validity tracking
@@ -195,7 +195,7 @@ pub unsafe extern "C" fn cachekit_encryptor_get_counter(handle: *const CachekitE
195195
///
196196
/// Function is panic-safe and will never unwind across FFI boundary.
197197
#[cfg(feature = "encryption")]
198-
#[unsafe(no_mangle)]
198+
#[no_mangle]
199199
pub unsafe extern "C" fn cachekit_encrypt(
200200
handle: *mut CachekitEncryptor,
201201
key: *const u8,
@@ -324,7 +324,7 @@ pub unsafe extern "C" fn cachekit_encrypt(
324324
///
325325
/// Function is panic-safe and will never unwind across FFI boundary.
326326
#[cfg(feature = "encryption")]
327-
#[unsafe(no_mangle)]
327+
#[no_mangle]
328328
pub unsafe extern "C" fn cachekit_decrypt(
329329
handle: *const CachekitEncryptor,
330330
key: *const u8,
@@ -438,7 +438,7 @@ pub unsafe extern "C" fn cachekit_decrypt(
438438
///
439439
/// Function is panic-safe and will never unwind across FFI boundary.
440440
#[cfg(feature = "encryption")]
441-
#[unsafe(no_mangle)]
441+
#[no_mangle]
442442
pub unsafe extern "C" fn cachekit_derive_key(
443443
master: *const u8,
444444
master_len: usize,

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ pub use byte_storage::{ByteStorage, StorageEnvelope};
6868
pub mod encryption;
6969
#[cfg(feature = "encryption")]
7070
pub use encryption::{
71-
EncryptionError, EncryptionHeader, KeyDerivationError, KeyDomain, KeyRotationState,
72-
RotationAwareHeader, ZeroKnowledgeEncryptor, derive_domain_key,
71+
derive_domain_key, EncryptionError, EncryptionHeader, KeyDerivationError, KeyDomain,
72+
KeyRotationState, RotationAwareHeader, ZeroKnowledgeEncryptor,
7373
};
7474

7575
// C FFI layer (feature-gated)

tests/encryption_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
mod common;
2020

2121
use cachekit_core::encryption::core::{EncryptionError, ZeroKnowledgeEncryptor};
22-
use cachekit_core::encryption::key_derivation::{KeyDerivationError, derive_domain_key};
22+
use cachekit_core::encryption::key_derivation::{derive_domain_key, KeyDerivationError};
2323
use common::fixtures::*;
2424

2525
// Local test constants only used in encryption tests

0 commit comments

Comments
 (0)