Skip to content

Commit

Permalink
* genisoimage/jte.c: add support for bzip2-compressed templates
Browse files Browse the repository at this point in the history
  * genisoimage/jte.c: fix bzip2-compressed template data to be
    compatible with jigdo.
  * genisoimage/jte.c: fix exclude list handling.
  * genisoimage/checksum.[ch]: Add a generic infrastructure for
    checksums so we can use sha1/<whatever> as well as just
    md5sum. Will make things much faster for generating sha1sums for
    images and jigdos.
  * genisoimage/sha1.[ch]: Add GPL-licensed SHA1 implementation.
  * s/mkisofs/genisoimage/ in ABOUT


git-svn-id: svn://svn.debian.org/debburn/cdrkit/trunk@785 a95a6be8-091b-0410-adaf-d31e6857962f
  • Loading branch information
93sam committed Jan 6, 2008
1 parent 1fdbab8 commit c27b852
Show file tree
Hide file tree
Showing 10 changed files with 827 additions and 49 deletions.
4 changes: 2 additions & 2 deletions ABOUT
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ This package contains the following software:
cdrecord by Jörg Schilling <[email protected]> but
developed independently now.

- mkisofs (an ISO-9660 filesystem image creator)
- genisoimage (an ISO-9660 filesystem image creator)
By Eric Youngdale <[email protected]>, Jörg Schilling
<[email protected]>, James Pearson
<[email protected]> and other contributors.

- mkhybrid (an ISO-9660/HFS filesystem image creator)
Link to mkisofs
Link to genisoimage

- several diagnostic programs for ISO-9660, originaly from
cdrtools (by Jörg Schilling),
Expand Down
11 changes: 9 additions & 2 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ cdrkit (1.1.7) UNRELEASED; urgency=low
* wodim.1: small fixes.

[ Steve McIntyre ]
* genisoimage/jte.c: add support for bzip2-compressed templates
* genisoimage/jte.c: fix bzip2-compressed template data to be
compatible with jigdo.
* genisoimage/jte.c: fix exclude list handling.

-- Steve McIntyre <[email protected]> Wed, 19 Sep 2007 22:03:04 +0100
* genisoimage/checksum.[ch]: Add a generic infrastructure for
checksums so we can use sha1/<whatever> as well as just
md5sum. Will make things much faster for generating sha1sums for
images and jigdos.
* genisoimage/sha1.[ch]: Add GPL-licensed SHA1 implementation.
* s/mkisofs/genisoimage/ in ABOUT

-- Steve McIntyre <[email protected]> Sun, 06 Jan 2008 02:32:42 +0000

cdrkit (1.1.6) RELEASED; urgency=low

Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Priority: optional
Section: otherosfs
Maintainer: Joerg Jaspert <[email protected]>
Uploaders: Eduard Bloch <[email protected]>, Steve McIntyre <[email protected]>
Build-Depends: debhelper (>=5.0.37.3), zlib1g-dev, autotools-dev, cmake (>= 2.4.2-1), libcap-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], libcam-dev [kfreebsd-i386 kfreebsd-amd64], libmagic-dev
Build-Depends: debhelper (>=5.0.37.3), libbz2-dev, zlib1g-dev, autotools-dev, cmake (>= 2.4.2-1), libcap-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], libcam-dev [kfreebsd-i386 kfreebsd-amd64], libmagic-dev
Standards-Version: 3.7.2

Package: wodim
Expand Down
5 changes: 2 additions & 3 deletions genisoimage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ ENDIF(HAVE_ICONV_H)

ADD_DEFINITIONS(-DUSE_LARGEFILES -DABORT_DEEP_ISO_ONLY -DAPPLE_HYB -DUDF -DDVD_VIDEO -DSORTING -DHAVE_CONFIG_H -DUSE_LIBSCHILY -DUSE_SCG -DJIGDO_TEMPLATE)

SET(MKISOFS_MOST_SRCS apple.c boot.c desktop.c dvd_file.c dvd_reader.c eltorito.c exclude.c files.c fnmatch.c hash.c ifo_read.c joliet.c mac_label.c match.c multi.c name.c rock.c scsi.c stream.c tree.c udf.c vms.c volume.c write.c boot-alpha.c boot-hppa.c boot-mips.c md5.c jte.c rsync.c
boot-mipsel.c endian.c )
SET(MKISOFS_MOST_SRCS apple.c boot.c desktop.c dvd_file.c dvd_reader.c eltorito.c exclude.c files.c fnmatch.c hash.c ifo_read.c joliet.c mac_label.c match.c multi.c name.c rock.c scsi.c stream.c tree.c udf.c vms.c volume.c write.c boot-alpha.c boot-hppa.c boot-mips.c md5.c jte.c rsync.c boot-mipsel.c endian.c sha1.c checksum.c )

INCLUDE(CheckFunctionExists)
SET(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
Expand All @@ -40,7 +39,7 @@ ENDIF(NOT HAVE_GETOPT_LONG)
LINK_DIRECTORIES(../libhfs_iso ../librols ../libusal ../libunls ../wodim)

ADD_EXECUTABLE (genisoimage genisoimage.c ${MKISOFS_MOST_SRCS})
TARGET_LINK_LIBRARIES(genisoimage wodimstuff hfs_iso ${MAGICLIBS} c unls z ${EXTRA_LIBICONV} ${EXTRA_LIBS})
TARGET_LINK_LIBRARIES(genisoimage wodimstuff hfs_iso ${MAGICLIBS} c unls z bz2 ${EXTRA_LIBICONV} ${EXTRA_LIBS})

# common lib set and genisoimage source parts for the rest
LINK_LIBRARIES(wodimstuff ${EXTRA_LIBS} unls ${EXTRA_LIBICONV} )
Expand Down
164 changes: 164 additions & 0 deletions genisoimage/checksum.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
/*
* checksum.c
*
* Copyright (c) 2008- Steve McIntyre <[email protected]>
*
* Implementation of a generic checksum interface, used in JTE.
*
* GNU GPL v2
*/

#include <mconfig.h>
#include "genisoimage.h"
#include <timedefs.h>
#include <fctldefs.h>
#include <regex.h>
#include <stdlib.h>
#include "md5.h"
#include "sha1.h"
#include "checksum.h"

static void md5_init(void *context)
{
mk_MD5Init(context);
}
static void md5_update(void *context, unsigned char const *buf, unsigned int len)
{
mk_MD5Update(context, buf, len);
}
static void md5_final(unsigned char *digest, void *context)
{
mk_MD5Final(digest, context);
}

static void sha1_init(void *context)
{
sha1_init_ctx(context);
}
static void sha1_update(void *context, unsigned char const *buf, unsigned int len)
{
sha1_process_bytes(buf, len, context);
}
static void sha1_final(unsigned char *digest, void *context)
{
sha1_finish_ctx(context, digest);
}

struct checksum_details
{
char *name;
int digest_size;
int context_size;
void (*init)(void *context);
void (*update)(void *context, unsigned char const *buf, unsigned int len);
void (*final)(unsigned char *digest, void *context);
};

static const struct checksum_details algorithms[] =
{
{
"MD5",
16,
sizeof(struct mk_MD5Context),
md5_init,
md5_update,
md5_final
},
{
"SHA1",
20,
sizeof(struct sha1_ctx),
sha1_init,
sha1_update,
sha1_final
}
};

struct _checksum_context
{
void *context;
unsigned char *digest;
int enabled;
};

struct checksum_info *checksum_information(enum checksum_types which)
{
return (struct checksum_info *)&algorithms[which];
}

checksum_context_t *checksum_init_context(int checksums)
{
int i = 0;
struct _checksum_context *context = malloc(NUM_CHECKSUMS * sizeof(struct _checksum_context));
if (!context)
return NULL;

for (i = 0; i < NUM_CHECKSUMS; i++)
{
if ( (1 << i) & checksums)
{
context[i].context = malloc(algorithms[i].context_size);
if (!context[i].context)
return NULL;
context[i].digest = malloc(algorithms[i].digest_size);
if (!context[i].digest)
return NULL;
algorithms[i].init(context[i].context);
context[i].enabled = 1;
}
else
context[i].enabled = 0;
}

return context;
}

void checksum_free_context(checksum_context_t *context)
{
int i = 0;
struct _checksum_context *c = context;

for (i = 0; i < NUM_CHECKSUMS; i++)
{
free(c[i].context);
free(c[i].digest);
}
free(c);
}

void checksum_update(checksum_context_t *context,
unsigned char const *buf, unsigned int len)
{
int i = 0;
struct _checksum_context *c = context;

for (i = 0; i < NUM_CHECKSUMS; i++)
{
if (c[i].enabled)
algorithms[i].update(c[i].context, buf, len);
}
}

void checksum_final(checksum_context_t *context)
{
int i = 0;
struct _checksum_context *c = context;

for (i = 0; i < NUM_CHECKSUMS; i++)
{
if (c[i].enabled)
algorithms[i].final(c[i].digest, c[i].context);
}
}

void checksum_copy(checksum_context_t *context,
enum checksum_types which,
unsigned char *digest)
{
struct _checksum_context *c = context;

if (c[which].enabled)
memcpy(digest, c[which].digest, algorithms[which].digest_size);
}


56 changes: 56 additions & 0 deletions genisoimage/checksum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* checksum.h
*
* Copyright (c) 2008- Steve McIntyre <[email protected]>
*
* Definitions and prototypes for a generic checksum interface, used
* in JTE. Inspired heavily by the interface to the MD5 code we're
* using already.
*
* GNU GPL v2
*/

enum checksum_types
{
CHECK_MD5 = 0,
CHECK_SHA1,
NUM_CHECKSUMS
};

#define CHECK_MD5_USED (1 << CHECK_MD5)
#define CHECK_SHA1_USED (1 << CHECK_SHA1)

typedef void checksum_context_t;

struct checksum_info
{
char *name;
int digest_size;
};

/* Ask the library for information about a particular checksum
* algorithm. Returns a pointer to internal memory - DO NOT
* MODIFY/FREE! */
struct checksum_info *checksum_information(enum checksum_types which);

/* Allocate / initialise a context for the chosen checksums. OR
* together the desired checksums as the parameter */
checksum_context_t *checksum_init_context(int checksums);

/* Cleanup and free a context when it's finished with */
void checksum_free_context(checksum_context_t *context);

/* Pass a new buffer full of data through the checksum code */
void checksum_update(checksum_context_t *context,
unsigned char const *buf,
unsigned int len);

/* Finish the current set of checksums */
void checksum_final(checksum_context_t *context);

/* Extract a particular algorithm's checksum once checksum_final() has
* been called. Use the details in checksum_information() above first
* to see how big the digest will be. */
void checksum_copy(checksum_context_t *context,
enum checksum_types which,
unsigned char *digest);
Loading

0 comments on commit c27b852

Please sign in to comment.