public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/dislocker] rawhide: spec: build using openssl instead of mbedtls
@ 2026-09-11 15:53 Bill Roberts
  0 siblings, 0 replies; only message in thread
From: Bill Roberts @ 2026-09-11 15:53 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/dislocker
            Branch : rawhide
            Commit : 78d152d47c3289a15c297d2f6a269f4d39214d81
            Author : Bill Roberts <bill.roberts@arm.com>
            Date   : 2026-09-10T15:09:47-05:00
            Stats  : +1200/-2 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/dislocker/c/78d152d47c3289a15c297d2f6a269f4d39214d81?branch=rawhide

            Log:
            spec: build using openssl instead of mbedtls

- Add OpenSSL backend support
- Build and test against OpenSSL

Signed-off-by: Bill Roberts <bill.roberts@arm.com>

---
diff --git a/dislocker-openssl-support.patch b/dislocker-openssl-support.patch
new file mode 100644
index 0000000..ac5078a
--- /dev/null
+++ b/dislocker-openssl-support.patch
@@ -0,0 +1,1188 @@
+From 2327aaa808878a767cfb7109337987453a2b7198 Mon Sep 17 00:00:00 2001
+From: Connor Cihula <connor.cihula@arm.com>
+Date: Wed, 24 Jun 2026 15:42:41 -0500
+Subject: [PATCH] crypto: support OpenSSL crypto backend
+
+---
+ CMakeLists.txt                                |   7 +-
+ include/dislocker/accesses/stretch_key.h      |   2 +-
+ include/dislocker/encryption/aes-xts.h        |   2 +-
+ include/dislocker/encryption/encommon.priv.h  |   2 +-
+ .../mbedtls/ssl_bindings.h}                   |  50 +---
+ .../encryption/openssl/ssl_bindings.h         | 202 +++++++++++++
+ src/CMakeLists.txt                            |  48 ++-
+ src/encryption/aes-xts.c                      |   2 +-
+ src/encryption/decrypt.c                      |   4 +-
+ src/encryption/encommon.c                     |  12 +-
+ test/CMakeLists.txt                           |  26 ++
+ test/test-crypto.c                            | 280 ++++++++++++++++++
+ test/test.h                                   |  68 +++++
+ test/test_vectors.h                           | 265 +++++++++++++++++
+ 14 files changed, 903 insertions(+), 67 deletions(-)
+ rename include/dislocker/{ssl_bindings.h.in => encryption/mbedtls/ssl_bindings.h} (54%)
+ create mode 100644 include/dislocker/encryption/openssl/ssl_bindings.h
+ create mode 100644 test/CMakeLists.txt
+ create mode 100644 test/test-crypto.c
+ create mode 100644 test/test.h
+ create mode 100644 test/test_vectors.h
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5753aa5..75e708a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -24,6 +24,9 @@ set (AUTHOR "Romain Coltel")
+ 
+ find_program (GIT_EXE NAMES git PATHS /usr/bin /usr/local/bin)
+ 
++include(CTest)
++enable_testing()
++
+ if(GIT_EXE)
+ 	execute_process (
+ 		COMMAND ${GIT_EXE} rev-parse --abbrev-ref HEAD
+@@ -47,7 +50,9 @@ set (VERSION_RELEASE 2)
+ set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}")
+ 
+ add_subdirectory (${PROJECT_SOURCE_DIR}/src)
+-
++if(BUILD_TESTING)
++	add_subdirectory (${PROJECT_SOURCE_DIR}/test)
++endif()
+ configure_file(
+ 	"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+ 	"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+diff --git a/include/dislocker/accesses/stretch_key.h b/include/dislocker/accesses/stretch_key.h
+index 1a1820d..906dbe6 100644
+--- a/include/dislocker/accesses/stretch_key.h
++++ b/include/dislocker/accesses/stretch_key.h
+@@ -26,7 +26,7 @@
+ 
+ #include "dislocker/common.h"
+ 
+-#include "dislocker/ssl_bindings.h"
++#include "ssl_bindings.h"
+ 
+ 
+ 
+diff --git a/include/dislocker/encryption/aes-xts.h b/include/dislocker/encryption/aes-xts.h
+index 060fd88..bfcfa0e 100644
+--- a/include/dislocker/encryption/aes-xts.h
++++ b/include/dislocker/encryption/aes-xts.h
+@@ -23,7 +23,7 @@
+ #ifndef DIS_AES_XTS_H
+ #define DIS_AES_XTS_H
+ 
+-#include "dislocker/ssl_bindings.h"
++#include "ssl_bindings.h"
+ 
+ 
+ /*
+diff --git a/include/dislocker/encryption/encommon.priv.h b/include/dislocker/encryption/encommon.priv.h
+index 35eb8d1..aee01e7 100644
+--- a/include/dislocker/encryption/encommon.priv.h
++++ b/include/dislocker/encryption/encommon.priv.h
+@@ -26,7 +26,7 @@
+ 
+ #include "dislocker/encryption/encommon.h"
+ 
+-#include "dislocker/ssl_bindings.h"
++#include "ssl_bindings.h"
+ 
+ 
+ 
+diff --git a/include/dislocker/ssl_bindings.h.in b/include/dislocker/encryption/mbedtls/ssl_bindings.h
+similarity index 54%
+rename from include/dislocker/ssl_bindings.h.in
+rename to include/dislocker/encryption/mbedtls/ssl_bindings.h
+index 34e05df..4291828 100644
+--- a/include/dislocker/ssl_bindings.h.in
++++ b/include/dislocker/encryption/mbedtls/ssl_bindings.h
+@@ -24,63 +24,23 @@
+ #define SSL_BINDINGS_H
+ 
+ /*
+- * Here stand the bindings for polarssl SHA256/SHA2/SHA-2 function for dislocker
++ * Here stand the bindings for MbedTLS SHA256/SHA2/SHA-2 function for dislocker
+  */
+-#include "@POLARSSL_INC_FOLDER@/version.h"
+-#if MBEDTLS_VERSION_MAJOR >= 3
+-#include "@POLARSSL_INC_FOLDER@/mbedtls_config.h"
+-#include "@POLARSSL_INC_FOLDER@/compat-2.x.h"
+-#else
+-#include "@POLARSSL_INC_FOLDER@/config.h"
+-#endif
+-#include "@POLARSSL_INC_FOLDER@/aes.h"
+-
+-// Function's name changed
+-#if defined(MBEDTLS_SHA256_C)
+-#  include "mbedtls/sha256.h"
+-#  if MBEDTLS_VERSION_NUMBER >= 0x02070000
+-#    define SHA256(input, len, output)         mbedtls_sha256_ret(input, len, output, 0)
+-#  else
+-#    define SHA256(input, len, output)         mbedtls_sha256(input, len, output, 0)
+-#  endif /* POLARSSL_VERSION_NUMBER >= 0x02070000 */
+-#else /* defined(MBEDTLS_SHA256_C) */
+-
+-#  if defined(POLARSSL_SHA256_C)
+-#    include "polarssl/sha256.h"
+-#    define SHA256(input, len, output)       sha256(input, len, output, 0)
+-#  else /* defined(POLARSSL_SHA256_C) */
+-#    include "polarssl/sha2.h"
+-
+-// 0x00630500 = version 0.99.5, argument's type changed in this release
+-#    if POLARSSL_VERSION_NUMBER >= 0x00630500
+-#     define SHA256(input, len, output)       sha2(input, len, output, 0)
+-#    else
+-#     define SHA256(input, len, output)       sha2(input, (int)len, output, 0)
+-#    endif /* POLARSSL_VERSION_NUMBER >= 0x00630500 */
+-
+-#  endif /* defined(POLARSSL_SHA256_C) */
+-#endif /* defined(MBEDTLS_SHA256_C) */
++#include "mbedtls/aes.h"
++#include "mbedtls/sha256.h"
+ 
++#define SHA256(input, len, output)        mbedtls_sha256(input, len, output, 0)
+ 
+ /* Here stand the bindings for AES functions and contexts */
+-#if defined(MBEDTLS_AES_H)
+ #  define AES_CONTEXT                     mbedtls_aes_context
+ #  define AES_SETENC_KEY(ctx, key, size)  mbedtls_aes_setkey_enc(ctx, key, size)
+ #  define AES_SETDEC_KEY(ctx, key, size)  mbedtls_aes_setkey_dec(ctx, key, size)
++#  define AES_FREE(ctx)                   mbedtls_aes_free(ctx)
+ #  define AES_ECB_ENC(ctx, mode, in, out) mbedtls_aes_crypt_ecb(ctx, mode, in, out)
+ #  define AES_CBC(ctx, mode, size, iv, in, out) \
+                                           mbedtls_aes_crypt_cbc(ctx, mode, size, iv, in, out);
+ #  define AES_ENCRYPT                     MBEDTLS_AES_ENCRYPT
+ #  define AES_DECRYPT                     MBEDTLS_AES_DECRYPT
+-#else
+-#  define AES_CONTEXT                     aes_context
+-#  define AES_SETENC_KEY(ctx, key, size)  aes_setkey_enc(ctx, key, size)
+-#  define AES_SETDEC_KEY(ctx, key, size)  aes_setkey_dec(ctx, key, size)
+-#  define AES_ECB_ENC(ctx, mode, in, out) aes_crypt_ecb(ctx, mode, in, out)
+-#  define AES_CBC(ctx, mode, size, iv, in, out) \
+-                                          aes_crypt_cbc(ctx, mode, size, iv, in, out);
+-#endif /* defined(MBEDTLS_AES_H) */
+-
+ 
+ #include "dislocker/encryption/aes-xts.h"
+ #if defined(MBEDTLS_CIPHER_MODE_XEX)
+diff --git a/include/dislocker/encryption/openssl/ssl_bindings.h b/include/dislocker/encryption/openssl/ssl_bindings.h
+new file mode 100644
+index 0000000..c7bac9b
+--- /dev/null
++++ b/include/dislocker/encryption/openssl/ssl_bindings.h
+@@ -0,0 +1,202 @@
++/* -*- coding: utf-8 -*- */
++/* -*- mode: c -*- */
++/*
++ * Dislocker -- enables to read/write on BitLocker encrypted partitions under
++ * Linux
++ * Copyright (C) 2026 Arm Ltd.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
++ * USA.
++ */
++#ifndef SSL_BINDINGS_H
++#define SSL_BINDINGS_H
++
++#include <string.h>
++
++#include <openssl/aes.h>
++#include <openssl/crypto.h>
++#include <openssl/evp.h>
++#include <openssl/sha.h>
++
++#define DIS_OSSL_MAX_AES_KEY_BYTES 512/8
++
++typedef struct dis_ossl_aes_ctx dis_ossl_aes_ctx;
++struct dis_ossl_aes_ctx {
++	unsigned char key[DIS_OSSL_MAX_AES_KEY_BYTES];
++	size_t len;
++	int enc_dec;
++	EVP_CIPHER_CTX *ossl_ctx;
++};
++
++#define AES_CONTEXT                     dis_ossl_aes_ctx
++
++#define DIS_OSSL_CIPHER_ECB 0
++#define DIS_OSSL_CIPHER_CBC 1
++
++#if defined(EVP_CIPH_XTS_MODE)
++static inline const EVP_CIPHER *dis_ossl_get_xts_cipher(size_t key_len)
++{
++	switch (key_len)
++	{
++		case 16: return EVP_aes_128_xts();
++		case 32: return EVP_aes_256_xts();
++		default: return NULL;
++	}
++}
++#endif
++
++static inline const EVP_CIPHER *dis_ossl_get_cipher(size_t key_len, int ossl_mode)
++{
++	if (ossl_mode == DIS_OSSL_CIPHER_ECB)
++	{
++		switch (key_len)
++		{
++			case 16: return EVP_aes_128_ecb();
++			case 24: return EVP_aes_192_ecb();
++			case 32: return EVP_aes_256_ecb();
++			default: return NULL;
++		}
++	}
++	else if (ossl_mode == DIS_OSSL_CIPHER_CBC)
++	{
++		switch (key_len)
++		{
++			case 16: return EVP_aes_128_cbc();
++			case 24: return EVP_aes_192_cbc();
++			case 32: return EVP_aes_256_cbc();
++			default: return NULL;
++		}
++	}
++	return NULL;
++}
++
++static inline int dis_ossl_set_key(AES_CONTEXT *ctx, const unsigned char *key, size_t key_bits, int enc_dec)
++{
++	size_t key_len = key_bits / 8;
++	if (key_len > sizeof(ctx->key))
++		return 1;
++	if (!ctx->ossl_ctx)
++	{
++		ctx->ossl_ctx = EVP_CIPHER_CTX_new();
++		if (!ctx->ossl_ctx)
++			return 1;
++	}
++
++	memcpy(ctx->key, key, key_len);
++	ctx->len = key_len;
++	ctx->enc_dec = enc_dec;
++
++	return 0;
++}
++
++static inline void dis_ossl_free(AES_CONTEXT *ctx)
++{
++	if (!ctx)
++		return;
++
++	EVP_CIPHER_CTX_free(ctx->ossl_ctx);
++	ctx->ossl_ctx = NULL;
++	OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
++}
++
++static inline int dis_ossl_aes_crypt(
++	AES_CONTEXT *ctx,
++	int mode,
++	int size,
++	const unsigned char *iv,
++	const unsigned char *input,
++	unsigned char *output,
++	int cipher)
++{
++	int out_len = 0;
++
++	const EVP_CIPHER *ossl_cipher = dis_ossl_get_cipher(ctx->len, cipher);
++	if (!ossl_cipher)
++		return 1;
++
++	EVP_CIPHER_CTX *ossl_ctx = ctx->ossl_ctx;
++	if (!ossl_ctx)
++		return 1;
++
++	if (!EVP_CIPHER_CTX_reset(ossl_ctx))
++		return 1;
++
++	if (!EVP_CipherInit_ex(ossl_ctx, ossl_cipher, NULL, ctx->key, iv, mode == AES_ENCRYPT)) return 1;
++	if (!EVP_CIPHER_CTX_set_padding(ossl_ctx, 0)) return 1;
++	if (!EVP_CipherUpdate(ossl_ctx, output, &out_len, input, size)) return 1;
++	if (!EVP_CipherFinal_ex(ossl_ctx, &output[out_len], &out_len)) return 1;
++
++	return 0;
++}
++
++#if defined(EVP_CIPH_XTS_MODE)
++static inline int dis_ossl_aes_crypt_xts(
++	AES_CONTEXT *crypt_ctx,
++	AES_CONTEXT *tweak_ctx,
++	int mode,
++	size_t size,
++	unsigned char *iv,
++	const unsigned char *input,
++	unsigned char *output)
++{
++	int out_len = 0;
++	unsigned char xts_key[DIS_OSSL_MAX_AES_KEY_BYTES] = {0};
++
++	const EVP_CIPHER *ossl_cipher = dis_ossl_get_xts_cipher(crypt_ctx->len);
++	if (!ossl_cipher)
++		return 1;
++
++	EVP_CIPHER_CTX *ossl_ctx = crypt_ctx->ossl_ctx;
++	if (!ossl_ctx)
++		return 1;
++
++	memcpy(xts_key, crypt_ctx->key, crypt_ctx->len);
++	memcpy(xts_key + crypt_ctx->len, tweak_ctx->key, tweak_ctx->len);
++
++	if (!EVP_CIPHER_CTX_reset(ossl_ctx))
++		return 1;
++
++	if (!EVP_CipherInit_ex(ossl_ctx, ossl_cipher, NULL, xts_key, iv, mode == AES_ENCRYPT)) return 1;
++	if (!EVP_CIPHER_CTX_set_padding(ossl_ctx, 0)) return 1;
++	if (!EVP_CipherUpdate(ossl_ctx, output, &out_len, input, (int)size)) return 1;
++	if (!EVP_CipherFinal_ex(ossl_ctx, &output[out_len], &out_len)) return 1;
++
++	return 0;
++}
++#endif
++
++#define AES_SETENC_KEY(ctx, key, size)  dis_ossl_set_key(ctx, key, size, AES_ENCRYPT)
++#define AES_SETDEC_KEY(ctx, key, size)  dis_ossl_set_key(ctx, key, size, AES_DECRYPT)
++#define AES_FREE(ctx)	dis_ossl_free(ctx)
++#define AES_ECB_ENC(ctx, mode, in, out) dis_ossl_aes_crypt(ctx, mode, 16, NULL, in, out, DIS_OSSL_CIPHER_ECB)
++#define AES_CBC(ctx, mode, size, iv, in, out) dis_ossl_aes_crypt(ctx, mode, size, iv, in, out, DIS_OSSL_CIPHER_CBC)
++
++/*
++ * OpenSSL doesn't provide XEX, so just use the dislocker implementations. Note that
++ * the dislocker implementations use the OpenSSL primitives already defined, these are optional
++ */
++#include "dislocker/encryption/aes-xts.h"
++#define AES_XEX(ctx1, ctx2, mode, size, iv, in, out) \
++			  dis_aes_crypt_xex(ctx1, ctx2, mode, size, iv, in, out)
++
++#if defined(EVP_CIPH_XTS_MODE)
++#  define AES_XTS(ctx1, ctx2, mode, size, iv, in, out) \
++			  dis_ossl_aes_crypt_xts(ctx1, ctx2, mode, size, iv, in, out)
++#else
++#  define AES_XTS(ctx1, ctx2, mode, size, iv, in, out) \
++			  dis_aes_crypt_xts(ctx1, ctx2, mode, size, iv, in, out)
++#endif
++
++#endif /* SSL_BINDINGS_H */
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index e4b0b8f..ee7b140 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -47,7 +47,6 @@ endif()
+ if( NOT CMAKE_CROSSCOMPILING )
+ 	include_directories (SYSTEM /usr/local/include)
+ endif()
+-include_directories (${PROJECT_SOURCE_DIR}/include)
+ 
+ set (LIB pthread)
+ set (SOURCES
+@@ -118,15 +117,6 @@ endif()
+ # Libraries
+ set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+ 
+-find_package (PolarSSL REQUIRED)
+-if(POLARSSL_FOUND  AND  POLARSSL_INCLUDE_DIRS  AND  POLARSSL_LIBRARIES)
+-	include_directories (${POLARSSL_INCLUDE_DIRS})
+-	set (LIB ${LIB} ${POLARSSL_LIBRARIES})
+-	configure_file (${PROJECT_SOURCE_DIR}/include/dislocker/ssl_bindings.h.in ${PROJECT_SOURCE_DIR}/include/dislocker/ssl_bindings.h ESCAPE_QUOTES @ONLY)
+-else()
+-	return ()
+-endif()
+-
+ # Ruby bindings
+ set(WITH_RUBY "AUTO" CACHE STRING "Enable Ruby bindings. Valid values are ON, OFF, or AUTO")
+ if (NOT "${WITH_RUBY}" STREQUAL "OFF")
+@@ -207,7 +197,8 @@ endif()
+ 
+ # Targets
+ add_library (${PROJECT_NAME} SHARED ${SOURCES})
+-target_link_libraries (${PROJECT_NAME} ${LIB})
++target_include_directories (${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include)
++target_link_libraries (${PROJECT_NAME} PUBLIC ${LIB})
+ set_target_properties (${PROJECT_NAME} PROPERTIES VERSION "${VERSION}" SOVERSION "${VERSION_MAJOR}.${VERSION_MINOR}")
+ install (TARGETS ${PROJECT_NAME} LIBRARY DESTINATION "${libdir}")
+ 
+@@ -219,12 +210,45 @@ if (${APPLE})
+ 	install (TARGETS ${BUNDLE_NAME} DESTINATION "${libdir}")
+ endif()
+ 
++set(CRYPTO_BACKEND "mbedtls" CACHE STRING "Crypto library backend")
++set_property(CACHE CRYPTO_BACKEND PROPERTY STRINGS "mbedtls" "openssl")
++
++add_library(dislocker_crypto_backend INTERFACE)
++
++message(STATUS "Crypto backend: ${CRYPTO_BACKEND}")
++if(CRYPTO_BACKEND STREQUAL "mbedtls")
++  find_package (MbedTLS 3 REQUIRED)
++  target_link_libraries(${PROJECT_NAME}
++    PRIVATE
++      MbedTLS::mbedcrypto
++  )
++  target_link_libraries(dislocker_crypto_backend INTERFACE MbedTLS::mbedcrypto)
++  target_include_directories(${PROJECT_NAME}
++    PUBLIC
++    ${CMAKE_SOURCE_DIR}/include/${PROJECT_NAME}/encryption/mbedtls
++  )
++elseif(CRYPTO_BACKEND STREQUAL "openssl")
++  find_package(OpenSSL 1.1.0 REQUIRED)
++  target_link_libraries(${PROJECT_NAME}
++    PRIVATE
++      OpenSSL::Crypto
++  )
++  target_link_libraries(dislocker_crypto_backend INTERFACE OpenSSL::Crypto)
++  target_include_directories(${PROJECT_NAME}
++    PUBLIC
++    ${CMAKE_SOURCE_DIR}/include/${PROJECT_NAME}/encryption/openssl
++  )
++else()
++  message(FATAL_ERROR "Unknown CRYPTO_BACKEND='${CRYPTO_BACKEND}'.")
++endif()
++
++
+ set (CLEAN_FILES "")
+ 
+ if(FUSE_FOUND)
+ 	set (BIN_FUSE ${PROJECT_NAME}-fuse)
+ 	add_executable (${BIN_FUSE} ${BIN_FUSE}.c)
+-	target_link_libraries (${BIN_FUSE} ${FUSE_LIBBRARIES} ${PROJECT_NAME})
++	target_link_libraries (${BIN_FUSE} PRIVATE ${FUSE_LIBBRARIES} ${LIB} ${PROJECT_NAME})
+ 	set_target_properties (${BIN_FUSE} PROPERTIES COMPILE_DEFINITIONS FUSE_USE_VERSION=26)
+ 	set_target_properties (${BIN_FUSE} PROPERTIES LINK_FLAGS "-pie -fPIE")
+ 	add_custom_command (TARGET ${BIN_FUSE} POST_BUILD
+diff --git a/src/encryption/aes-xts.c b/src/encryption/aes-xts.c
+index be09c46..bb80120 100644
+--- a/src/encryption/aes-xts.c
++++ b/src/encryption/aes-xts.c
+@@ -24,7 +24,7 @@
+ #include <stdint.h>
+ #include <string.h>
+ 
+-#include "dislocker/ssl_bindings.h"
++#include "ssl_bindings.h"
+ 
+ #ifndef GET_UINT64_LE
+ #define GET_UINT64_LE(n,b,i)                            \
+diff --git a/src/encryption/decrypt.c b/src/encryption/decrypt.c
+index 1aab41a..c0960b0 100644
+--- a/src/encryption/decrypt.c
++++ b/src/encryption/decrypt.c
+@@ -73,7 +73,7 @@ int decrypt_key(
+ 		return FALSE;
+ 
+ 
+-	AES_CONTEXT ctx;
++	AES_CONTEXT ctx = {0};
+ 
+ 	uint8_t mac_first [AUTHENTICATOR_LENGTH];
+ 	uint8_t mac_second[AUTHENTICATOR_LENGTH];
+@@ -138,7 +138,7 @@ int decrypt_key(
+ 	);
+ 
+ 
+-	memset(&ctx, 0, sizeof(AES_CONTEXT));
++	AES_FREE(&ctx);
+ 
+ 
+ 
+diff --git a/src/encryption/encommon.c b/src/encryption/encommon.c
+index 0623901..13df65d 100644
+--- a/src/encryption/encommon.c
++++ b/src/encryption/encommon.c
+@@ -28,8 +28,8 @@
+ #include "dislocker/encryption/encrypt.h"
+ #include "dislocker/encryption/decrypt.h"
+ #include "dislocker/encryption/encommon.priv.h"
++#include "ssl_bindings.h"
+ 
+-#include <string.h>
+ 
+ 
+ /**
+@@ -115,6 +115,12 @@ int dis_crypt_set_fvekey(dis_crypt_t crypt, uint16_t algorithm, uint8_t* fvekey)
+ 
+ void dis_crypt_destroy(dis_crypt_t crypt)
+ {
+-	if(crypt)
+-		dis_free(crypt);
++	if (!crypt)
++		return;
++
++	AES_FREE(&crypt->ctx.FVEK_D_ctx);
++	AES_FREE(&crypt->ctx.FVEK_E_ctx);
++	AES_FREE(&crypt->ctx.TWEAK_D_ctx);
++	AES_FREE(&crypt->ctx.TWEAK_E_ctx);
++	dis_free(crypt);
+ }
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+new file mode 100644
+index 0000000..7bbea3a
+--- /dev/null
++++ b/test/CMakeLists.txt
+@@ -0,0 +1,26 @@
++# Dislocker -- enables to read/write on BitLocker encrypted partitions under
++# Linux
++# Copyright (C) 2026 Arm Ltd
++#
++# This program is free software; you can redistribute it and/or
++# modify it under the terms of the GNU General Public License
++# as published by the Free Software Foundation; either version 2
++# of the License, or (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
++# USA.
++
++add_executable(crypto_tests
++  test-crypto.c
++)
++
++target_link_libraries(crypto_tests PRIVATE ${PROJECT_NAME} dislocker_crypto_backend)
++
++add_test(NAME crypto_tests COMMAND crypto_tests)
+diff --git a/test/test-crypto.c b/test/test-crypto.c
+new file mode 100644
+index 0000000..ef776c3
+--- /dev/null
++++ b/test/test-crypto.c
+@@ -0,0 +1,280 @@
++/* -*- coding: utf-8 -*- */
++/* -*- mode: c -*- */
++/*
++ * Dislocker -- enables to read/write on BitLocker encrypted partitions under
++ * Linux
++ * Copyright (C) 2026 Arm Ltd.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
++ * USA.
++ */
++#include <setjmp.h>
++#include <stdio.h>
++#include <string.h>
++
++#include "ssl_bindings.h"
++
++#include "test.h"
++#include "test_vectors.h"
++
++static void test_ecb_encrypt_128(void)
++{
++	AES_CONTEXT ctx = {0};
++
++	NEW_ARRAY_FROM(unsigned char, buf, orig_16);
++
++	/* Test AES ECB 128 Encryption */
++	AES_SETENC_KEY(&ctx, key_aes_128, sizeof(key_aes_128) * 8);
++
++	AES_ECB_ENC(&ctx, AES_ENCRYPT, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, aes_ecb_128_expected);
++
++	/* Test AES ECB 128 Decryption */
++	AES_SETDEC_KEY(&ctx, key_aes_128, sizeof(key_aes_128) * 8);
++
++	AES_ECB_ENC(&ctx, AES_DECRYPT, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, orig_16);
++
++	AES_FREE(&ctx);
++}
++
++static void test_ecb_encrypt_256(void) {
++	AES_CONTEXT ctx = {0};
++
++	NEW_ARRAY_FROM(unsigned char, buf, orig_16);
++
++	/* Test AES ECB 256 Encryption */
++	AES_SETENC_KEY(&ctx, key_aes_256, sizeof(key_aes_256) * 8);
++
++	AES_ECB_ENC(&ctx, AES_ENCRYPT, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, expected_aes_ecb_256);
++
++	/* Test AES ECB 256 Decryption */
++	AES_SETDEC_KEY(&ctx, key_aes_256, sizeof(key_aes_256) * 8);
++
++	AES_ECB_ENC(&ctx, AES_DECRYPT, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, orig_16);
++
++	AES_FREE(&ctx);
++}
++
++static void test_cbc_encrypt_128(void) {
++	AES_CONTEXT ctx = {0};
++
++	NEW_ARRAY_FROM(unsigned char, buf, orig_512);
++
++	/* mbedtls requires a mutable IV */
++	NEW_ARRAY_FROM(unsigned char, iv, static_iv);
++
++	/* Test AES CBC 128 Encryption
++	 *
++	 * In at least one test, modify the key to ensure the internal
++	 * context buffer doesn't depend on the key pointer remaining
++	 * constant.
++	 */
++	unsigned char mutable_key[sizeof(key_aes_128)];
++	memcpy(mutable_key, key_aes_128, sizeof(mutable_key));
++	AES_SETENC_KEY(&ctx, mutable_key, sizeof(key_aes_128) * 8);
++	memset(mutable_key, 0xFF, sizeof(mutable_key));
++
++	AES_CBC(&ctx, AES_ENCRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, expected_cbc_128);
++
++	/* Test AES CBC 128 Decryption */
++	memcpy(iv, static_iv, sizeof(iv));
++
++	AES_SETDEC_KEY(&ctx, key_aes_128, sizeof(key_aes_128) * 8);
++
++	AES_CBC(&ctx, AES_DECRYPT, sizeof(expected_cbc_128), iv, expected_cbc_128, buf);
++
++	CHECK_STATIC_BUFFERS(buf, orig_512);
++
++	AES_FREE(&ctx);
++}
++
++static void test_cbc_encrypt_256(void) {
++	AES_CONTEXT ctx = {0};
++
++	NEW_ARRAY_FROM(unsigned char, buf, orig_512);
++
++	/* mbedtls requires a mutable IV */
++	NEW_ARRAY_FROM(unsigned char, iv, static_iv);
++
++	/* Test AES CBC 256 Encryption */
++	AES_SETENC_KEY(&ctx, key_aes_256, sizeof(key_aes_256) * 8);
++
++	AES_CBC(&ctx, AES_ENCRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, expected_cbc_256);
++
++	/* Test AES CBC 256 Decryption */
++	memcpy(iv, static_iv, sizeof(iv));
++
++	AES_SETDEC_KEY(&ctx, key_aes_256, sizeof(key_aes_256) * 8);
++
++	AES_CBC(&ctx, AES_DECRYPT, sizeof(expected_cbc_256), iv, expected_cbc_256, buf);
++
++	CHECK_STATIC_BUFFERS(buf, orig_512);
++
++	AES_FREE(&ctx);
++}
++
++static void test_xex_encrypt_128(void) {
++	AES_CONTEXT ctx = {0};
++	AES_CONTEXT tweak_ctx = {0};
++
++	NEW_ARRAY_FROM(unsigned char, buf, orig_16);
++
++	/* mbedtls requires a mutable IV */
++	NEW_ARRAY_FROM(unsigned char, iv, static_iv);
++
++	/* Test AES XEX 128 Encryption */
++	AES_SETENC_KEY(&ctx, key_aes_128, sizeof(key_aes_128) * 8);
++	AES_SETENC_KEY(&tweak_ctx, key_aes_tweak_128, sizeof(key_aes_tweak_128) * 8);
++
++	AES_XEX(&ctx, &tweak_ctx, AES_ENCRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, expected_xex_128);
++
++	/* Test AES XEX 128 Decryption */
++	memcpy(iv, static_iv, sizeof(iv));
++
++	AES_SETDEC_KEY(&ctx, key_aes_128, sizeof(key_aes_128) * 8);
++
++	AES_XEX(&ctx, &tweak_ctx, AES_DECRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, orig_16);
++
++	AES_FREE(&ctx);
++	AES_FREE(&tweak_ctx);
++}
++
++static void test_xex_encrypt_256(void) {
++	AES_CONTEXT ctx = {0};
++	AES_CONTEXT tweak_ctx = {0};
++
++	NEW_ARRAY_FROM(unsigned char, buf, orig_16);
++
++	/* mbedtls requires a mutable IV */
++	NEW_ARRAY_FROM(unsigned char, iv, static_iv);
++
++	/* Test AES XEX 256 Encryption */
++	AES_SETENC_KEY(&ctx, key_aes_256, sizeof(key_aes_256) * 8);
++	AES_SETENC_KEY(&tweak_ctx, key_aes_tweak_256, sizeof(key_aes_tweak_256) * 8);
++
++	AES_XEX(&ctx, &tweak_ctx, AES_ENCRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, expected_xex_256);
++
++	/* Test AES XEX 256 Decryption */
++	memcpy(iv, static_iv, sizeof(iv));
++
++	AES_SETDEC_KEY(&ctx, key_aes_256, sizeof(key_aes_256) * 8);
++
++	AES_XEX(&ctx, &tweak_ctx, AES_DECRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, orig_16);
++
++	AES_FREE(&ctx);
++	AES_FREE(&tweak_ctx);
++}
++
++static void test_xts_encrypt_128(void) {
++	AES_CONTEXT ctx = {0};
++	AES_CONTEXT tweak_ctx = {0};
++
++	NEW_ARRAY_FROM(unsigned char, buf, orig_16);
++
++	/* mbedtls requires a mutable IV */
++	NEW_ARRAY_FROM(unsigned char, iv, static_iv);
++
++	/* Test AES XTS 128 Encryption */
++	AES_SETENC_KEY(&ctx, key_aes_128, sizeof(key_aes_128) * 8);
++	AES_SETENC_KEY(&tweak_ctx, key_aes_tweak_128, sizeof(key_aes_tweak_128) * 8);
++
++	AES_XTS(&ctx, &tweak_ctx, AES_ENCRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, expected_xts_128);
++
++	/* Test AES XTS 128 Decryption */
++	memcpy(iv, static_iv, sizeof(iv));
++
++	AES_SETDEC_KEY(&ctx, key_aes_128, sizeof(key_aes_128) * 8);
++
++	AES_XTS(&ctx, &tweak_ctx, AES_DECRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, orig_16);
++
++	AES_FREE(&ctx);
++	AES_FREE(&tweak_ctx);
++}
++
++static void test_xts_encrypt_256(void) {
++	AES_CONTEXT ctx = {0};
++	AES_CONTEXT tweak_ctx = {0};
++
++	NEW_ARRAY_FROM(unsigned char, buf, orig_16);
++
++	/* mbedtls requires a mutable IV */
++	NEW_ARRAY_FROM(unsigned char, iv, static_iv);
++
++	/* Test AES XTS 256 Encryption */
++	AES_SETENC_KEY(&ctx, key_aes_256, sizeof(key_aes_256) * 8);
++	AES_SETENC_KEY(&tweak_ctx, key_aes_tweak_256, sizeof(key_aes_tweak_256) * 8);
++
++	AES_XTS(&ctx, &tweak_ctx, AES_ENCRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, expected_xts_256);
++
++	/* Test AES XTS 256 Decryption */
++	memcpy(iv, static_iv, sizeof(iv));
++
++	AES_SETDEC_KEY(&ctx, key_aes_256, sizeof(key_aes_256) * 8);
++
++	AES_XTS(&ctx, &tweak_ctx, AES_DECRYPT, sizeof(buf), iv, buf, buf);
++
++	CHECK_STATIC_BUFFERS(buf, orig_16);
++
++	AES_FREE(&ctx);
++	AES_FREE(&tweak_ctx);
++}
++
++int main(int argc, char *argv[])
++{
++	ADD_TEST(test_ecb_encrypt_128);
++	ADD_TEST(test_ecb_encrypt_256);
++
++	ADD_TEST(test_cbc_encrypt_128);
++	ADD_TEST(test_cbc_encrypt_256);
++
++	ADD_TEST(test_xex_encrypt_128);
++	ADD_TEST(test_xex_encrypt_256);
++
++	ADD_TEST(test_xts_encrypt_128);
++	ADD_TEST(test_xts_encrypt_256);
++
++	printf("--- Statistics ---\n");
++	printf("Total: %d\n", _tests);
++	printf("Pass:  %d\n", _tests - _failures);
++	printf("Fail:  %d\n", _failures);
++	printf("-------------------\n");
++
++	return _failures & 0xFF;
++}
+diff --git a/test/test.h b/test/test.h
+new file mode 100644
+index 0000000..311a8a9
+--- /dev/null
++++ b/test/test.h
+@@ -0,0 +1,68 @@
++/* -*- coding: utf-8 -*- */
++/* -*- mode: c -*- */
++/*
++ * Dislocker -- enables to read/write on BitLocker encrypted partitions under
++ * Linux
++ * Copyright (C) 2026 Arm Ltd.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
++ * USA.
++ */
++#ifndef TEST_H_
++#define TEST_H_
++
++static int _failures;
++static int _tests;
++static jmp_buf _jmp;
++
++#define ADD_TEST(name) \
++	do { \
++		_tests++; \
++		int x = setjmp(_jmp); \
++		if (!x) \
++			name(); \
++	} while(0)
++
++
++static void _CHECK_BUFFERS(const void *a, const void *b, size_t size_a, size_t size_b,
++		const char *file_name, const char *func_name, int lineno)
++{
++	if(size_a != size_b)
++	{
++		fprintf(stderr, "%s:%s:%d: Buffer size mismatch: %zu != %zu\n",
++			file_name, func_name, lineno, size_a, size_b);
++		_failures++;
++		longjmp(_jmp, 1);
++	}
++	if (memcmp(a, b, size_a))
++	{
++		fprintf(stderr, "%s:%s:%d: Buffers do not match\n",
++				file_name, func_name, lineno);
++		_failures++;
++		longjmp(_jmp, 1);
++	}
++}
++
++#define CHECK_BUFFERS(a, b, a_size, b_size) \
++	_CHECK_BUFFERS(a, b, a_size, b_size, __FILE__, __func__, __LINE__)
++
++#define CHECK_STATIC_BUFFERS(a, b) \
++		CHECK_BUFFERS(a, b, sizeof(a), sizeof(b))
++
++#define NEW_ARRAY_FROM(t, n, from) \
++	t n[sizeof(from)]; \
++	memcpy(n, from, sizeof(n));
++
++#endif /* TEST_H_ */
+diff --git a/test/test_vectors.h b/test/test_vectors.h
+new file mode 100644
+index 0000000..2264233
+--- /dev/null
++++ b/test/test_vectors.h
+@@ -0,0 +1,265 @@
++/* -*- coding: utf-8 -*- */
++/* -*- mode: c -*- */
++/*
++ * Dislocker -- enables to read/write on BitLocker encrypted partitions under
++ * Linux
++ * Copyright (C) 2026 Arm Ltd.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
++ * USA.
++ */
++#ifndef TEST_VECTORS_H_
++#define TEST_VECTORS_H_
++
++static const char key_aes_128[] = {
++	'0', '1', '2', '3', '4', '5', '6', '7',
++	'8', '9', '0', '1', '2', '3', '4', '5'
++};
++
++static const char key_aes_256[] = {
++	'0', '1', '2', '3', '4', '5', '6', '7',
++	'8', '9', '0', '1', '2', '3', '4', '5',
++	'0', '1', '2', '3', '4', '5', '6', '7',
++	'8', '9', '0', '1', '2', '3', '4', '5'
++};
++
++static const char key_aes_tweak_128[] = {
++	'5', '4', '3', '2', '1', '0', '9', '8',
++	'7', '6', '5', '4', '3', '2', '1', '0'
++};
++
++static const char key_aes_tweak_256[] = {
++	'5', '4', '3', '2', '1', '0', '9', '8',
++	'7', '6', '5', '4', '3', '2', '1', '0',
++	'5', '4', '3', '2', '1', '0', '9', '8',
++	'7', '6', '5', '4', '3', '2', '1', '0'
++};
++
++const static char static_iv[] = {
++    0x9F, 0x3C, 0xA7, 0xD2,
++    0x48, 0x6B, 0x91, 0xEE,
++    0x14, 0x5A, 0xC8, 0x70,
++    0x2D, 0xF4, 0x89, 0xB6
++};
++
++static const char orig_16[] = {
++	'A','B','C','D','E','F','G','H',
++	'I','J','K','L','M','N','O','P'
++};
++
++static const char aes_ecb_128_expected[] = {
++	0x4F, 0x57, 0xA4, 0x78,
++	0x47, 0x19, 0x5F, 0x80,
++	0xE5, 0x09, 0x45, 0x72,
++	0x6F, 0xA7, 0xF8, 0x92
++};
++
++static const char expected_aes_ecb_256[] = {
++    0xB5, 0x73, 0x10, 0xBB,
++    0x6B, 0xC2, 0xFE, 0x09,
++    0xA6, 0x13, 0xC6, 0x2A,
++    0x0F, 0xA4, 0x09, 0xFD
++};
++
++static const char orig_512[] = {
++    0x3A, 0x7F, 0x12, 0xC4, 0x9B, 0xE1, 0x55, 0x8D,
++    0x6A, 0xF0, 0x24, 0xB7, 0x91, 0x0E, 0xDC, 0x48,
++    0xAF, 0x62, 0x19, 0xE8, 0x73, 0x04, 0x9D, 0xC1,
++    0x56, 0xB2, 0xF9, 0x0A, 0x8C, 0x47, 0xDE, 0x31,
++    0x6E, 0x95, 0xCB, 0x18, 0xF4, 0x02, 0x7A, 0xAD,
++    0x40, 0xE7, 0x29, 0x93, 0xBD, 0x54, 0x08, 0xF1,
++    0xCA, 0x6C, 0x9E, 0x13, 0x85, 0xDF, 0x22, 0xB8,
++    0x4D, 0xF6, 0x01, 0x97, 0xAC, 0x38, 0xE2, 0x59,
++    0x71, 0x0F, 0xC9, 0xB4, 0x2A, 0x8E, 0xD3, 0x64,
++    0xF8, 0x15, 0x9A, 0x43, 0xED, 0x70, 0x06, 0xBC,
++    0x52, 0x91, 0xAF, 0x28, 0xE4, 0x0B, 0x7D, 0xC6,
++    0x39, 0xF2, 0x84, 0x1E, 0xD8, 0x6B, 0x95, 0x40,
++    0xAE, 0x57, 0x03, 0xF7, 0x9C, 0x21, 0xC0, 0x68,
++    0x14, 0xDB, 0x85, 0x3E, 0xFA, 0x92, 0x07, 0x4C,
++    0xB1, 0xE9, 0x26, 0x7C, 0xD5, 0x90, 0x58, 0x0D,
++    0xC7, 0xA3, 0xF5, 0x1B, 0x6F, 0x84, 0x2E, 0x99,
++    0x3A, 0x7F, 0x12, 0xC4, 0x9B, 0xE1, 0x55, 0x8D,
++    0x6A, 0xF0, 0x24, 0xB7, 0x91, 0x0E, 0xDC, 0x48,
++    0xAF, 0x62, 0x19, 0xE8, 0x73, 0x04, 0x9D, 0xC1,
++    0x56, 0xB2, 0xF9, 0x0A, 0x8C, 0x47, 0xDE, 0x31,
++    0x6E, 0x95, 0xCB, 0x18, 0xF4, 0x02, 0x7A, 0xAD,
++    0x40, 0xE7, 0x29, 0x93, 0xBD, 0x54, 0x08, 0xF1,
++    0xCA, 0x6C, 0x9E, 0x13, 0x85, 0xDF, 0x22, 0xB8,
++    0x4D, 0xF6, 0x01, 0x97, 0xAC, 0x38, 0xE2, 0x59,
++    0x71, 0x0F, 0xC9, 0xB4, 0x2A, 0x8E, 0xD3, 0x64,
++    0xF8, 0x15, 0x9A, 0x43, 0xED, 0x70, 0x06, 0xBC,
++    0x52, 0x91, 0xAF, 0x28, 0xE4, 0x0B, 0x7D, 0xC6,
++    0x39, 0xF2, 0x84, 0x1E, 0xD8, 0x6B, 0x95, 0x40,
++    0xAE, 0x57, 0x03, 0xF7, 0x9C, 0x21, 0xC0, 0x68,
++    0x14, 0xDB, 0x85, 0x3E, 0xFA, 0x92, 0x07, 0x4C,
++    0xB1, 0xE9, 0x26, 0x7C, 0xD5, 0x90, 0x58, 0x0D,
++    0xC7, 0xA3, 0xF5, 0x1B, 0x6F, 0x84, 0x2E, 0x99,
++    0x3A, 0x7F, 0x12, 0xC4, 0x9B, 0xE1, 0x55, 0x8D,
++    0x6A, 0xF0, 0x24, 0xB7, 0x91, 0x0E, 0xDC, 0x48,
++    0xAF, 0x62, 0x19, 0xE8, 0x73, 0x04, 0x9D, 0xC1,
++    0x56, 0xB2, 0xF9, 0x0A, 0x8C, 0x47, 0xDE, 0x31,
++    0x6E, 0x95, 0xCB, 0x18, 0xF4, 0x02, 0x7A, 0xAD,
++    0x40, 0xE7, 0x29, 0x93, 0xBD, 0x54, 0x08, 0xF1,
++    0xCA, 0x6C, 0x9E, 0x13, 0x85, 0xDF, 0x22, 0xB8,
++    0x4D, 0xF6, 0x01, 0x97, 0xAC, 0x38, 0xE2, 0x59,
++    0x71, 0x0F, 0xC9, 0xB4, 0x2A, 0x8E, 0xD3, 0x64,
++    0xF8, 0x15, 0x9A, 0x43, 0xED, 0x70, 0x06, 0xBC,
++    0x52, 0x91, 0xAF, 0x28, 0xE4, 0x0B, 0x7D, 0xC6,
++    0x39, 0xF2, 0x84, 0x1E, 0xD8, 0x6B, 0x95, 0x40,
++    0xAE, 0x57, 0x03, 0xF7, 0x9C, 0x21, 0xC0, 0x68,
++    0x14, 0xDB, 0x85, 0x3E, 0xFA, 0x92, 0x07, 0x4C,
++    0xB1, 0xE9, 0x26, 0x7C, 0xD5, 0x90, 0x58, 0x0D,
++    0xC7, 0xA3, 0xF5, 0x1B, 0x6F, 0x84, 0x2E, 0x99,
++    0x3A, 0x7F, 0x12, 0xC4, 0x9B, 0xE1, 0x55, 0x8D,
++    0x6A, 0xF0, 0x24, 0xB7, 0x91, 0x0E, 0xDC, 0x48,
++    0xAF, 0x62, 0x19, 0xE8, 0x73, 0x04, 0x9D, 0xC1,
++    0x56, 0xB2, 0xF9, 0x0A, 0x8C, 0x47, 0xDE, 0x31,
++    0x6E, 0x95, 0xCB, 0x18, 0xF4, 0x02, 0x7A, 0xAD,
++    0x40, 0xE7, 0x29, 0x93, 0xBD, 0x54, 0x08, 0xF1,
++    0xCA, 0x6C, 0x9E, 0x13, 0x85, 0xDF, 0x22, 0xB8,
++    0x4D, 0xF6, 0x01, 0x97, 0xAC, 0x38, 0xE2, 0x59,
++    0x71, 0x0F, 0xC9, 0xB4, 0x2A, 0x8E, 0xD3, 0x64,
++    0xF8, 0x15, 0x9A, 0x43, 0xED, 0x70, 0x06, 0xBC,
++    0x52, 0x91, 0xAF, 0x28, 0xE4, 0x0B, 0x7D, 0xC6,
++    0x39, 0xF2, 0x84, 0x1E, 0xD8, 0x6B, 0x95, 0x40,
++    0xAE, 0x57, 0x03, 0xF7, 0x9C, 0x21, 0xC0, 0x68,
++    0x14, 0xDB, 0x85, 0x3E, 0xFA, 0x92, 0x07, 0x4C,
++    0xB1, 0xE9, 0x26, 0x7C, 0xD5, 0x90, 0x58, 0x0D,
++    0xC7, 0xA3, 0xF5, 0x1B, 0x6F, 0x84, 0x2E, 0x99
++};
++
++static const char expected_cbc_128[] = {
++	0xAE, 0xA3, 0x5C, 0x8A, 0x86, 0xB7, 0x4A, 0xA4,
++	0x51, 0x24, 0xC9, 0x55, 0x3C, 0x1F, 0xEA, 0x9B,
++	0xAF, 0x5D, 0xD3, 0xDF, 0x01, 0x31, 0x15, 0x93,
++	0xA2, 0x14, 0xEE, 0xBA, 0xA5, 0x37, 0xCE, 0x77,
++	0x6A, 0xB3, 0x5C, 0x0D, 0x20, 0xBA, 0x08, 0xC4,
++	0x65, 0x41, 0x43, 0xF9, 0x0B, 0x79, 0x85, 0x37,
++	0xDA, 0xDA, 0xF8, 0xE4, 0x06, 0xE8, 0xDD, 0xB0,
++	0x1C, 0x43, 0xA8, 0x10, 0xB1, 0x57, 0x58, 0xA7,
++	0x6B, 0x7E, 0xAF, 0x5C, 0x51, 0x55, 0xD0, 0x92,
++	0x22, 0x6E, 0x8B, 0xAB, 0x33, 0xCE, 0x5E, 0xE0,
++	0x01, 0x03, 0x23, 0x35, 0xDD, 0x54, 0x15, 0x26,
++	0x6A, 0xE8, 0xC2, 0xCA, 0xC3, 0x0D, 0x7F, 0xE8,
++	0x31, 0x26, 0x97, 0x9F, 0x25, 0x3A, 0x67, 0xB8,
++	0xE3, 0xEF, 0x49, 0xAA, 0xF5, 0x45, 0x9C, 0x35,
++	0x11, 0x49, 0xCE, 0x98, 0x40, 0x02, 0x21, 0x4E,
++	0x58, 0x00, 0x35, 0xFB, 0xE5, 0x92, 0x83,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5B, 0x5C, 0xA0, 0x02, 0x92,
++	0x92, 0x95, 0x67, 0x1A, 0xA5, 0xB6, 0xA8, 0xE0,
++	0x91, 0x26, 0xDC, 0xD3, 0xD7, 0xB3, 0xEE, 0xEE,
++	0x0E, 0x27, 0xA3, 0x13, 0x34, 0x00, 0x32, 0x01,
++	0x7B, 0xDA, 0x80, 0x52, 0xD9, 0x4D, 0xF5, 0xD1
++};
++
++static const char expected_cbc_256[] = {
++	0xD0, 0x6B, 0x93, 0x3B, 0x8F, 0xE0, 0x67, 0x2E, 0x8F, 0xE2, 0x75, 0xDD, 0x90, 0x1D, 0xFE, 0xD9,
++	0xA0, 0x67, 0xDB, 0x2F, 0xE9, 0x99, 0xEF, 0x9D, 0xD0, 0x25, 0x9F, 0x87, 0xFD, 0xE7, 0x53, 0xFA,
++	0xD0, 0x61, 0x29, 0x9E, 0xA3, 0x26, 0xDD, 0xB1, 0x91, 0x18, 0x38, 0xD2, 0xED, 0xBC, 0x28, 0x7D,
++	0xA5, 0x53, 0xEE, 0xC1, 0x88, 0xEC, 0xDB, 0x7E, 0x60, 0xD5, 0x48, 0x76, 0x58, 0xC1, 0x6C, 0x8D,
++	0x4B, 0x7F, 0xC6, 0x1C, 0x4F, 0x13, 0x40, 0x3C, 0x1F, 0x63, 0x46, 0x28, 0xD8, 0x3C, 0x30, 0x4D,
++	0x3A, 0x8F, 0xA0, 0xE2, 0x0A, 0x19, 0x56, 0x11, 0x66, 0xD9, 0xCC, 0x9D, 0x71, 0xCB, 0xF5, 0xC0,
++	0xB9, 0x71, 0x29, 0x8F, 0xB9, 0xD4, 0x8E, 0xF2, 0xC3, 0xFB, 0xB9, 0xF8, 0x73, 0xC9, 0xEE, 0x37,
++	0xE7, 0xDA, 0xEE, 0xB4, 0xB6, 0xFA, 0x28, 0x80, 0xED, 0xBE, 0x95, 0x96, 0x7D, 0x3F, 0x62, 0xE0,
++	0x4E, 0x15, 0xBC, 0x03, 0x47, 0x8C, 0x8F, 0x62, 0xAE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,
++	0xFD, 0x08, 0xF0, 0xB8, 0xA1, 0xA3, 0xD8, 0x4D, 0xB8, 0xD5, 0x72, 0x3B, 0x13, 0x06, 0x75, 0xC9,
++};
++
++static const char expected_xex_128[] = {
++	0xC6, 0xA7, 0x96, 0xD5, 0xF4, 0xB8, 0x5C, 0xFF,
++	0xD9, 0x5A, 0xC6, 0x49, 0x6D, 0xA5, 0x21, 0xDC
++};
++
++static const char expected_xex_256[] = {
++	0x0D, 0x77, 0x51, 0xB6, 0x7E, 0xD1, 0xAE, 0x57,
++	0xFE, 0xBA, 0x0C, 0xD2, 0x64, 0x33, 0x9C, 0x96
++};
++
++static const char expected_xts_128[] = {
++	0xC6, 0xA7, 0x96, 0xD5, 0xF4, 0xB8, 0x5C, 0xFF,
++	0xD9, 0x5A, 0xC6, 0x49, 0x6D, 0xA5, 0x21, 0xDC
++};
++
++static const char expected_xts_256[] = {
++	0x0D, 0x77, 0x51, 0xB6, 0x7E, 0xD1, 0xAE, 0x57,
++	0xFE, 0xBA, 0x0C, 0xD2, 0x64, 0x33, 0x9C, 0x96
++};
++
++#endif /* TEST_VECTORS_H_ */

diff --git a/dislocker.spec b/dislocker.spec
index 302b494..ce75723 100644
--- a/dislocker.spec
+++ b/dislocker.spec
@@ -1,7 +1,7 @@
 Summary:         Utility to access BitLocker encrypted volumes
 Name:            dislocker
 Version:         0.7.3
-Release:         25%{?dist}
+Release:         26%{?dist}
 License:         GPL-2.0-or-later
 URL:             https://github.com/Aorimn/dislocker
 Source0:         https://github.com/Aorimn/dislocker/archive/v%{version}/%{name}-%{version}.tar.gz
@@ -9,6 +9,8 @@ Source0:         https://github.com/Aorimn/dislocker/archive/v%{version}/%{name}
 Patch0:          https://github.com/Aorimn/dislocker/compare/v0.7.3...3e7aea196eaa176c38296a9bc75c0201df0a3679.patch#/dislocker-0.7.3-upstream-changes.patch
 # Multibyte character support in passwords, see https://github.com/Aorimn/dislocker/pull/118
 Patch1:          https://github.com/Aorimn/dislocker/pull/333.patch#/dislocker-0.7.3-multibyte-support.patch
+# OpenSSL backend support, see https://github.com/Aorimn/dislocker/pull/358
+Patch2:          dislocker-openssl-support.patch
 Requires:        %{name}-libs%{?_isa} = %{version}-%{release}
 Requires:        ruby(release)
 Requires:        ruby(runtime_executable)
@@ -17,7 +19,7 @@ Requires(preun): %{?el8:/usr/sbin/}alternatives
 Provides:        %{_bindir}/%{name}
 BuildRequires:   cmake
 BuildRequires:   gcc
-BuildRequires:   mbedtls-devel
+BuildRequires:   openssl-devel
 BuildRequires:   ruby-devel
 BuildRequires:   %{_bindir}/ruby
 
@@ -71,6 +73,7 @@ reading from it or writing to it is possible.
 %build
 %cmake \
   -D WARN_FLAGS="-Wall -Wno-error -Wextra" \
+  -D CRYPTO_BACKEND=openssl \
   -D CMAKE_POLICY_VERSION_MINIMUM=3.5
 %cmake_build
 
@@ -84,6 +87,9 @@ rm -f $RPM_BUILD_ROOT{%{_bindir}/%{name},%{_mandir}/man1/%{name}.1*}
 for file in *.md; do mv -f $file ${file%.md}; done
 for file in *.txt; do mv -f $file ${file%.txt}; done
 
+%check
+%ctest
+
 %post
 alternatives --install %{_bindir}/%{name} %{name} %{_bindir}/%{name}-file 60
 
@@ -122,6 +128,10 @@ fi
 %{_mandir}/man1/%{name}-fuse.1*
 
 %changelog
+* Mon Aug 03 2026 Connor Cihula <connor.cihula@gmail.com> - 0.7.3-26
+- Build against OpenSSL instead of MbedTLS backend
+- Run CMake testsuite
+
 * Wed Jul 15 2026 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-25
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11 15:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 15:53 [rpms/dislocker] rawhide: spec: build using openssl instead of mbedtls Bill Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox