Skip to content

Commit

Permalink
Moved XML plist support to libfplist
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Nov 4, 2016
1 parent 4e90ef6 commit 3e60abc
Show file tree
Hide file tree
Showing 37 changed files with 1,102 additions and 4,064 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -151,6 +151,7 @@ stamp-h[1-9]
/libfcache
/libfdata
/libfguid
/libfplist
/libfvalue
/libhmac
/libuna
5 changes: 5 additions & 0 deletions Makefile.am
Expand Up @@ -17,6 +17,7 @@ SUBDIRS = \
libfcache \
libfdata \
libfguid \
libfplist \
libfvalue \
libhmac \
libcaes \
Expand Down Expand Up @@ -96,6 +97,8 @@ library:
(cd $(srcdir)/libfcache && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfdata && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfguid && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfvalue && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfplist && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libhmac && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libcaes && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libfvde && $(MAKE) $(AM_MAKEFLAGS))
Expand Down Expand Up @@ -128,6 +131,8 @@ splint:
(cd $(srcdir)/libfcache && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libfdata && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libfguid && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libfvalue && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libfplist && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libhmac && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libcaes && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libfvde && $(MAKE) splint $(AM_MAKEFLAGS))
Expand Down
4 changes: 1 addition & 3 deletions acinclude.m4
Expand Up @@ -2,7 +2,5 @@ dnl Function to detect if libfvde dependencies are available
AC_DEFUN([AX_LIBFVDE_CHECK_LOCAL],
[dnl Check for internationalization functions in libfvde/libfvde_i18n.c
AC_CHECK_FUNCS([bindtextdomain])
AM_PROG_LEX
AC_PROG_YACC])
])

4 changes: 2 additions & 2 deletions appveyor.yml
Expand Up @@ -18,8 +18,8 @@ install:
before_build:
- ps: .\synclibs.ps1
- ps: .\autogen.ps1
- cmd: ..\win_flex_bison\win_flex.exe -Cf libfvde\libfvde_xml_plist_scanner.l && move lex.yy.c libfvde\libfvde_xml_plist_scanner.c
- cmd: ..\win_flex_bison\win_bison.exe -d -v -l -p xml_plist_scanner_ libfvde\libfvde_xml_plist_parser.y && move libfvde_xml_plist_parser.tab.c libfvde\libfvde_xml_plist_parser.c && move libfvde_xml_plist_parser.tab.h libfvde\libfvde_xml_plist_parser.h
- cmd: ..\win_flex_bison\win_flex.exe -Cf libfplist\libfplist_xml_scanner.l && move lex.yy.c libfplist\libfplist_xml_scanner.c
- cmd: ..\win_flex_bison\win_bison.exe -d -v -l -p xml_scanner_ libfplist\libfplist_xml_parser.y && move libfplist_xml_parser.tab.c libfplist\libfplist_xml_parser.c && move libfplist_xml_parser.tab.h libfplist\libfplist_xml_parser.h
- cmd: C:\Python27\python.exe ..\libyal\scripts\msvscpp-convert.py --to 2010 msvscpp\libfvde.sln

build:
Expand Down
11 changes: 8 additions & 3 deletions configure.ac
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ( 2.59 )

AC_INIT(
[libfvde],
[20161103],
[20161104],
[joachim.metz@gmail.com])

AC_CONFIG_SRCDIR(
Expand Down Expand Up @@ -91,12 +91,15 @@ AX_LIBFCACHE_CHECK_ENABLE
dnl Check for enabling libfdata for file data types support
AX_LIBFDATA_CHECK_ENABLE

dnl Check for enabling libfguid for file GUID/UUID support
dnl Check for enabling libfguid for GUID/UUID format support
AX_LIBFGUID_CHECK_ENABLE

dnl Check for enabling libfvalue for file value support
AX_LIBFVALUE_CHECK_ENABLE

dnl Check for enabling libfplist for plist formats support
AX_LIBFPLIST_CHECK_ENABLE

dnl Check for enabling libhmac for message digest hash function support
AX_LIBHMAC_CHECK_ENABLE

Expand Down Expand Up @@ -183,7 +186,7 @@ CFLAGS="$CFLAGS -Wall";

dnl Check if requires and build requires should be set in spec file
AS_IF(
[test "x$ac_cv_libcstring" = xyes || test "x$ac_cv_libcerror" = xyes || test "x$ac_cv_libcthreads" = xyes || test "x$ac_cv_libcdata" = xyes || test "x$ac_cv_libclocale" = xyes || test "x$ac_cv_libcnotify" = xyes || test "x$ac_cv_libcsplit" = xyes || test "x$ac_cv_libuna" = xyes || test "x$ac_cv_libcfile" = xyes || test "x$ac_cv_libcpath" = xyes || test "x$ac_cv_libbfio" = xyes || test "x$ac_cv_libfdata" = xyes || test "x$ac_cv_libfguid" = xyes || test "x$ac_cv_libfvalue" = xyes || test "x$ac_cv_zlib" != xno || test "x$ac_cv_libcaes" = xyes || test "x$ac_cv_libhmac" = xyes || test "x$ac_cv_libcrypto" = xyes],
[test "x$ac_cv_libcstring" = xyes || test "x$ac_cv_libcerror" = xyes || test "x$ac_cv_libcthreads" = xyes || test "x$ac_cv_libcdata" = xyes || test "x$ac_cv_libclocale" = xyes || test "x$ac_cv_libcnotify" = xyes || test "x$ac_cv_libcsplit" = xyes || test "x$ac_cv_libuna" = xyes || test "x$ac_cv_libcfile" = xyes || test "x$ac_cv_libcpath" = xyes || test "x$ac_cv_libbfio" = xyes || test "x$ac_cv_libfdata" = xyes || test "x$ac_cv_libfguid" = xyes || test "x$ac_cv_libfvalue" = xyes || test "x$ac_cv_libfplist" = xyes || test "x$ac_cv_zlib" != xno || test "x$ac_cv_libcaes" = xyes || test "x$ac_cv_libhmac" = xyes || test "x$ac_cv_libcrypto" = xyes],
[AC_SUBST(
[libfvde_spec_requires],
[Requires:])
Expand Down Expand Up @@ -233,6 +236,7 @@ AC_CONFIG_FILES([libfcache/Makefile])
AC_CONFIG_FILES([libfdata/Makefile])
AC_CONFIG_FILES([libfguid/Makefile])
AC_CONFIG_FILES([libfvalue/Makefile])
AC_CONFIG_FILES([libfplist/Makefile])
AC_CONFIG_FILES([libhmac/Makefile])
AC_CONFIG_FILES([libcaes/Makefile])
AC_CONFIG_FILES([libfvde/Makefile])
Expand Down Expand Up @@ -282,6 +286,7 @@ Building:
libfdata support: $ac_cv_libfdata
libfguid support: $ac_cv_libfguid
libfvalue support: $ac_cv_libfvalue
libfplist support: $ac_cv_libfplist
DEFLATE compression support: $ac_cv_uncompress
libhmac support: $ac_cv_libhmac
SHA256 support: $ac_cv_libhmac_sha256
Expand Down
2 changes: 1 addition & 1 deletion include/libfvde/definitions.h.in
@@ -1,7 +1,7 @@
/*
* Definitions for libfvde
*
* Copyright (C) 2011-2016, Omar Choudary <choudary.omar@gmail.com>
* Copyright (C) 2011-2016, Omar Choudary <choudary.omar@gmail.com>,
* Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
Expand Down
2 changes: 1 addition & 1 deletion libfvde.pc.in
Expand Up @@ -7,6 +7,6 @@ Name: libfvde
Description: Library to access the FileVault Drive Encryption (FVDE) format
Version: @VERSION@
Libs: -L${libdir} -lfvde
Libs.private: @ax_libbfio_pc_libs_private@ @ax_libcaes_pc_libs_private@ @ax_libcdata_pc_libs_private@ @ax_libcerror_pc_libs_private@ @ax_libcfile_pc_libs_private@ @ax_libclocale_pc_libs_private@ @ax_libcnotify_pc_libs_private@ @ax_libcpath_pc_libs_private@ @ax_libcrypto_pc_libs_private@ @ax_libcsplit_pc_libs_private@ @ax_libcstring_pc_libs_private@ @ax_libcthreads_pc_libs_private@ @ax_libfcache_pc_libs_private@ @ax_libfdata_pc_libs_private@ @ax_libfguid_pc_libs_private@ @ax_libfvalue_pc_libs_private@ @ax_libhmac_pc_libs_private@ @ax_libuna_pc_libs_private@ @ax_pthread_pc_libs_private@ @ax_zlib_pc_libs_private@
Libs.private: @ax_libbfio_pc_libs_private@ @ax_libcaes_pc_libs_private@ @ax_libcdata_pc_libs_private@ @ax_libcerror_pc_libs_private@ @ax_libcfile_pc_libs_private@ @ax_libclocale_pc_libs_private@ @ax_libcnotify_pc_libs_private@ @ax_libcpath_pc_libs_private@ @ax_libcrypto_pc_libs_private@ @ax_libcsplit_pc_libs_private@ @ax_libcstring_pc_libs_private@ @ax_libcthreads_pc_libs_private@ @ax_libfcache_pc_libs_private@ @ax_libfdata_pc_libs_private@ @ax_libfguid_pc_libs_private@ @ax_libfplist_pc_libs_private@ @ax_libfvalue_pc_libs_private@ @ax_libhmac_pc_libs_private@ @ax_libuna_pc_libs_private@ @ax_pthread_pc_libs_private@ @ax_zlib_pc_libs_private@
Cflags: -I${includedir}

4 changes: 2 additions & 2 deletions libfvde.spec.in
Expand Up @@ -7,8 +7,8 @@ License: LGPL
Source: %{name}-%{version}.tar.gz
URL: https://github.com/libyal/libfvde/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@libfvde_spec_requires@ @ax_libbfio_spec_requires@ @ax_libcaes_spec_requires@ @ax_libcdata_spec_requires@ @ax_libcerror_spec_requires@ @ax_libcfile_spec_requires@ @ax_libclocale_spec_requires@ @ax_libcnotify_spec_requires@ @ax_libcpath_spec_requires@ @ax_libcrypto_spec_requires@ @ax_libcsplit_spec_requires@ @ax_libcstring_spec_requires@ @ax_libcthreads_spec_requires@ @ax_libfcache_spec_requires@ @ax_libfdata_spec_requires@ @ax_libfguid_spec_requires@ @ax_libhmac_spec_requires@ @ax_libuna_spec_requires@ @ax_zlib_spec_requires@
@libfvde_spec_build_requires@ @ax_libbfio_spec_build_requires@ @ax_libcaes_spec_build_requires@ @ax_libcdata_spec_build_requires@ @ax_libcerror_spec_build_requires@ @ax_libcfile_spec_build_requires@ @ax_libclocale_spec_build_requires@ @ax_libcnotify_spec_build_requires@ @ax_libcpath_spec_build_requires@ @ax_libcrypto_spec_build_requires@ @ax_libcsplit_spec_build_requires@ @ax_libcstring_spec_build_requires@ @ax_libcthreads_spec_build_requires@ @ax_libfcache_spec_build_requires@ @ax_libfdata_spec_build_requires@ @ax_libfguid_spec_build_requires@ @ax_libuna_spec_build_requires@ @ax_zlib_spec_build_requires@
@libfvde_spec_requires@ @ax_libbfio_spec_requires@ @ax_libcaes_spec_requires@ @ax_libcdata_spec_requires@ @ax_libcerror_spec_requires@ @ax_libcfile_spec_requires@ @ax_libclocale_spec_requires@ @ax_libcnotify_spec_requires@ @ax_libcpath_spec_requires@ @ax_libcrypto_spec_requires@ @ax_libcsplit_spec_requires@ @ax_libcstring_spec_requires@ @ax_libcthreads_spec_requires@ @ax_libfcache_spec_requires@ @ax_libfdata_spec_requires@ @ax_libfguid_spec_requires@ @ax_libfplist_spec_requires@ @ax_libfvalue_spec_requires@ @ax_libhmac_spec_requires@ @ax_libuna_spec_requires@ @ax_zlib_spec_requires@
@libfvde_spec_build_requires@ @ax_libbfio_spec_build_requires@ @ax_libcaes_spec_build_requires@ @ax_libcdata_spec_build_requires@ @ax_libcerror_spec_build_requires@ @ax_libcfile_spec_build_requires@ @ax_libclocale_spec_build_requires@ @ax_libcnotify_spec_build_requires@ @ax_libcpath_spec_build_requires@ @ax_libcrypto_spec_build_requires@ @ax_libcsplit_spec_build_requires@ @ax_libcstring_spec_build_requires@ @ax_libcthreads_spec_build_requires@ @ax_libfcache_spec_build_requires@ @ax_libfdata_spec_build_requires@ @ax_libfguid_spec_build_requires@ @ax_libfplist_spec_build_requires@ @ax_libfvalue_spec_build_requires@ @ax_libuna_spec_build_requires@ @ax_zlib_spec_build_requires@

%description
libfvde is a library to access the FileVault Drive Encryption (FVDE) format
Expand Down
18 changes: 4 additions & 14 deletions libfvde/Makefile.am
@@ -1,6 +1,3 @@
AM_LFLAGS = -Cf
AM_YFLAGS = -d -v -l -p xml_plist_scanner_

AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/common \
Expand All @@ -19,13 +16,12 @@ AM_CPPFLAGS = \
@LIBFDATA_CPPFLAGS@ \
@LIBFGUID_CPPFLAGS@ \
@LIBFVALUE_CPPFLAGS@ \
@LIBFPLIST_CPPFLAGS@ \
@ZLIB_CPPFLAGS@ \
@LIBCRYPTO_CPPFLAGS@ \
@LIBHMAC_CPPFLAGS@ \
@LIBCAES_CPPFLAGS@

BUILT_SOURCES = libfvde_xml_plist_parser.h

lib_LTLIBRARIES = libfvde.la

libfvde_la_SOURCES = \
Expand Down Expand Up @@ -58,6 +54,7 @@ libfvde_la_SOURCES = \
libfvde_libfcache.h \
libfvde_libfdata.h \
libfvde_libfguid.h \
libfvde_libfplist.h \
libfvde_libfvalue.h \
libfvde_libhmac.h \
libfvde_libuna.h \
Expand All @@ -70,13 +67,7 @@ libfvde_la_SOURCES = \
libfvde_types.h \
libfvde_unused.h \
libfvde_volume.c libfvde_volume.h \
libfvde_volume_group.c libfvde_volume_group.h \
libfvde_xml_plist.c libfvde_xml_plist.h \
libfvde_xml_plist_attribute.c libfvde_xml_plist_attribute.h \
libfvde_xml_plist_key.c libfvde_xml_plist_key.h \
libfvde_xml_plist_parser.y \
libfvde_xml_plist_scanner.l \
libfvde_xml_plist_tag.c libfvde_xml_plist_tag.h
libfvde_volume_group.c libfvde_volume_group.h

libfvde_la_LIBADD = \
@LIBCSTRING_LIBADD@ \
Expand All @@ -94,6 +85,7 @@ libfvde_la_LIBADD = \
@LIBFDATA_LIBADD@ \
@LIBFGUID_LIBADD@ \
@LIBFVALUE_LIBADD@ \
@LIBFPLIST_LIBADD@ \
@ZLIB_LIBADD@ \
@LIBHMAC_LIBADD@ \
@LIBCAES_LIBADD@ \
Expand All @@ -105,8 +97,6 @@ libfvde_la_LDFLAGS = -no-undefined -version-info 1:0:0

EXTRA_DIST = \
libfvde_definitions.h.in \
libfvde_xml_plist_parser.c libfvde_xml_plist_parser.h \
libfvde_xml_plist_scanner.c \
libfvde.rc \
libfvde.rc.in

Expand Down
39 changes: 19 additions & 20 deletions libfvde/libfvde_encrypted_metadata.c
Expand Up @@ -38,11 +38,10 @@
#include "libfvde_libcnotify.h"
#include "libfvde_libcstring.h"
#include "libfvde_libfguid.h"
#include "libfvde_libfplist.h"
#include "libfvde_libfvalue.h"
#include "libfvde_metadata_block.h"
#include "libfvde_password.h"
#include "libfvde_xml_plist.h"
#include "libfvde_xml_plist_key.h"

#include "fvde_metadata.h"

Expand Down Expand Up @@ -1696,9 +1695,9 @@ int libfvde_encrypted_metadata_read_type_0x001a(
size_t block_data_size,
libcerror_error_t **error )
{
libfvde_xml_plist_t *xml_plist = NULL;
libfvde_xml_plist_key_t *root_key = NULL;
libfvde_xml_plist_key_t *xml_plist_key = NULL;
libfplist_plist_t *xml_plist = NULL;
libfplist_key_t *root_key = NULL;
libfplist_key_t *xml_plist_key = NULL;
const uint8_t *xml_plist_data = NULL;
static char *function = "libfvde_encrypted_metadata_read_type_0x001a";
size_t xml_length = 0;
Expand Down Expand Up @@ -1876,7 +1875,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(

goto on_error;
}
if( libfvde_xml_plist_initialize(
if( libfplist_plist_initialize(
&xml_plist,
error ) != 1 )
{
Expand All @@ -1889,7 +1888,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(

goto on_error;
}
if( libfvde_xml_plist_copy_from_byte_stream(
if( libfplist_plist_copy_from_byte_stream(
xml_plist,
xml_plist_data,
xml_length + 1,
Expand All @@ -1904,7 +1903,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(

goto on_error;
}
if( libfvde_xml_plist_get_root_key(
if( libfplist_plist_get_root_key(
xml_plist,
&root_key,
error ) != 1 )
Expand All @@ -1918,7 +1917,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(

goto on_error;
}
if( libfvde_xml_plist_key_get_sub_key_by_utf8_name(
if( libfplist_key_get_sub_key_by_utf8_name(
root_key,
(uint8_t *) "com.apple.corestorage.lv.familyUUID",
35,
Expand All @@ -1937,7 +1936,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(
#if defined( HAVE_DEBUG_OUTPUT )
if( libcnotify_verbose != 0 )
{
if( libfvde_xml_plist_key_get_value_string(
if( libfplist_key_get_value_string(
xml_plist_key,
&string,
&string_size,
Expand All @@ -1963,7 +1962,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(
string = NULL;
}
#endif
if( libfvde_xml_plist_key_value_uuid_string_copy_to_byte_stream(
if( libfplist_key_value_uuid_string_copy_to_byte_stream(
xml_plist_key,
encrypted_metadata->logical_volume_family_identifier,
16,
Expand All @@ -1978,7 +1977,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(

goto on_error;
}
if( libfvde_xml_plist_key_free(
if( libfplist_key_free(
&xml_plist_key,
error ) != 1 )
{
Expand All @@ -1991,7 +1990,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(

goto on_error;
}
if( libfvde_xml_plist_key_get_sub_key_by_utf8_name(
if( libfplist_key_get_sub_key_by_utf8_name(
root_key,
(uint8_t *) "com.apple.corestorage.lv.size",
29,
Expand All @@ -2007,7 +2006,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(

goto on_error;
}
if( libfvde_xml_plist_key_get_value_integer(
if( libfplist_key_get_value_integer(
xml_plist_key,
(uint64_t *) &logical_volume_size,
error ) != 1 )
Expand All @@ -2030,7 +2029,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(
logical_volume_size );
}
#endif
if( libfvde_xml_plist_key_free(
if( libfplist_key_free(
&xml_plist_key,
error ) != 1 )
{
Expand All @@ -2043,7 +2042,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(

goto on_error;
}
if( libfvde_xml_plist_key_free(
if( libfplist_key_free(
&root_key,
error ) != 1 )
{
Expand All @@ -2056,7 +2055,7 @@ int libfvde_encrypted_metadata_read_type_0x001a(

goto on_error;
}
if( libfvde_xml_plist_free(
if( libfplist_plist_free(
&xml_plist,
error ) != 1 )
{
Expand Down Expand Up @@ -2089,19 +2088,19 @@ int libfvde_encrypted_metadata_read_type_0x001a(
#endif
if( xml_plist_key != NULL )
{
libfvde_xml_plist_key_free(
libfplist_key_free(
&xml_plist_key,
NULL );
}
if( root_key != NULL )
{
libfvde_xml_plist_key_free(
libfplist_key_free(
&root_key,
NULL );
}
if( xml_plist != NULL )
{
libfvde_xml_plist_free(
libfplist_plist_free(
&xml_plist,
NULL );
}
Expand Down

0 comments on commit 3e60abc

Please sign in to comment.