created opensc-asn1
fixes installation of egk-tool.exe on win32
This commit is contained in:
parent
2846295e1f
commit
4317df10e6
|
@ -4,5 +4,6 @@
|
|||
*/
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
#include <stddef.h>
|
||||
size_t strlcat(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
*/
|
||||
|
||||
#ifndef HAVE_STRNLEN
|
||||
#include <stddef.h>
|
||||
size_t strnlen(const char *str, size_t maxlen);
|
||||
#endif
|
||||
|
|
|
@ -21,22 +21,23 @@ do_subst = $(SED) \
|
|||
EGK_TOOL_BUILT_SOURCES = egk-tool-cmdline.h egk-tool-cmdline.c
|
||||
NPA_TOOL_BUILT_SOURCES = npa-tool-cmdline.h npa-tool-cmdline.c
|
||||
OPENSC_NOTIFY_BUILT_SOURCES = opensc-notify-cmdline.h opensc-notify-cmdline.c
|
||||
OPENSC_ASN1_BUILT_SOURCES = opensc-asn1-cmdline.h opensc-asn1-cmdline.c
|
||||
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/versioninfo-tools.rc $(srcdir)/versioninfo-opensc-notify.rc
|
||||
EXTRA_DIST = Makefile.mak versioninfo-tools.rc.in versioninfo-opensc-notify.rc.in npa-tool.ggo.in npa-tool.1 opensc-notify.ggo.in egk-tool.ggo.in egk-tool.1
|
||||
EXTRA_DIST = Makefile.mak versioninfo-tools.rc.in versioninfo-opensc-notify.rc.in npa-tool.ggo.in npa-tool.1 opensc-notify.ggo.in egk-tool.ggo.in egk-tool.1 opensc-asn1.ggo.in opensc-asn1.1
|
||||
|
||||
noinst_HEADERS = util.h fread_to_eof.h
|
||||
noinst_PROGRAMS = sceac-example
|
||||
bin_PROGRAMS = opensc-tool opensc-explorer opensc-notify \
|
||||
pkcs15-tool pkcs15-crypt pkcs11-tool \
|
||||
cardos-tool eidenv openpgp-tool iasecc-tool egk-tool
|
||||
cardos-tool eidenv openpgp-tool iasecc-tool egk-tool opensc-asn1
|
||||
if ENABLE_OPENSSL
|
||||
bin_PROGRAMS += cryptoflex-tool pkcs15-init netkey-tool piv-tool \
|
||||
westcos-tool sc-hsm-tool dnie-tool gids-tool npa-tool
|
||||
endif
|
||||
|
||||
if ENABLE_MAN
|
||||
dist_man1_MANS = npa-tool.1 opensc-notify.1 egk-tool.1
|
||||
dist_man1_MANS = npa-tool.1 opensc-notify.1 egk-tool.1 opensc-asn1.1
|
||||
endif
|
||||
|
||||
# compile with $(PTHREAD_CFLAGS) to allow debugging with gdb
|
||||
|
@ -164,6 +165,30 @@ egk-tool.1:
|
|||
--source='$(PACKAGE_STRING)' \
|
||||
$(builddir)/egk-tool$(EXEEXT)
|
||||
|
||||
opensc_asn1_SOURCES = opensc-asn1.c fread_to_eof.c $(OPENSC_ASN1_BUILT_SOURCES)
|
||||
opensc_asn1_LDADD = $(top_builddir)/src/libopensc/libopensc.la $(OPTIONAL_ZLIB_LIBS)
|
||||
opensc_asn1_CFLAGS = -I$(top_srcdir)/src $(OPTIONAL_ZLIB_CFLAGS)
|
||||
opensc_asn1_CFLAGS += -Wno-unused-but-set-variable -Wno-unknown-warning-option
|
||||
|
||||
opensc-asn1.c: $(abs_builddir)/opensc-asn1.ggo $(OPENSC_ASN1_BUILT_SOURCES)
|
||||
|
||||
# We only want *cmdline* to be generated when they have explicitly been removed.
|
||||
$(OPENSC_ASN1_BUILT_SOURCES):
|
||||
$(MAKE) $(abs_builddir)/opensc-asn1.ggo
|
||||
$(GENGETOPT) --include-getopt --file-name=opensc-asn1-cmdline --output-dir=$(builddir) < $(abs_builddir)/opensc-asn1.ggo --unamed-opts
|
||||
|
||||
$(abs_builddir)/opensc-asn1.ggo: opensc-asn1.ggo.in
|
||||
$(do_subst) < $(abs_srcdir)/opensc-asn1.ggo.in > $@
|
||||
|
||||
# We only want opensc-asn1.1 to be generated when it has explicitly been removed.
|
||||
opensc-asn1.1:
|
||||
$(MAKE) opensc-asn1$(EXEEXT)
|
||||
$(HELP2MAN) \
|
||||
--output=$@ \
|
||||
--no-info \
|
||||
--source='$(PACKAGE_STRING)' \
|
||||
$(builddir)/opensc-asn1$(EXEEXT)
|
||||
|
||||
if WIN32
|
||||
opensc_tool_SOURCES += versioninfo-tools.rc
|
||||
piv_tool_SOURCES += versioninfo-tools.rc
|
||||
|
|
|
@ -6,7 +6,7 @@ default: all
|
|||
|
||||
TARGETS = opensc-tool.exe opensc-explorer.exe pkcs15-tool.exe pkcs15-crypt.exe \
|
||||
pkcs11-tool.exe cardos-tool.exe eidenv.exe openpgp-tool.exe iasecc-tool.exe \
|
||||
opensc-notify.exe egk-tool.exe \
|
||||
opensc-notify.exe egk-tool.exe opensc-asn1.exe \
|
||||
$(PROGRAMS_OPENSSL)
|
||||
|
||||
OBJECTS = util.obj versioninfo-tools.res
|
||||
|
@ -37,6 +37,11 @@ egk-tool.exe: egk-tool-cmdline.obj $(LIBS)
|
|||
link $(LINKFLAGS) /pdb:$*.pdb /out:$@ $*.obj egk-tool-cmdline.obj $(LIBS) $(ZLIB_LIB) gdi32.lib shell32.lib User32.lib ws2_32.lib
|
||||
mt -manifest exe.manifest -outputresource:$@;1
|
||||
|
||||
opensc-asn1.exe: opensc-asn1-cmdline.obj fread_to_eof.obj $(LIBS)
|
||||
cl $(COPTS) /c $*.c
|
||||
link $(LINKFLAGS) /pdb:$*.pdb /out:$@ $*.obj opensc-asn1-cmdline.obj fread_to_eof.obj $(LIBS) gdi32.lib shell32.lib User32.lib ws2_32.lib
|
||||
mt -manifest exe.manifest -outputresource:$@;1
|
||||
|
||||
.c.exe:
|
||||
cl $(COPTS) /c $<
|
||||
link $(LINKFLAGS) /pdb:$*.pdb /out:$@ $*.obj $(OBJECTS) $(LIBS) $(OPENSSL_LIB) gdi32.lib shell32.lib User32.lib ws2_32.lib
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#ifndef _FREAD_TO_EOF_H
|
||||
#define _FREAD_TO_EOF_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
int fread_to_eof(const char *file, unsigned char **buf, size_t *buflen);
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,175 @@
|
|||
/** @file opensc-asn1-cmdline.h
|
||||
* @brief The header file for the command line option parser
|
||||
* generated by GNU Gengetopt version 2.22.6
|
||||
* http://www.gnu.org/software/gengetopt.
|
||||
* DO NOT modify this file, since it can be overwritten
|
||||
* @author GNU Gengetopt by Lorenzo Bettini */
|
||||
|
||||
#ifndef OPENSC_ASN1_CMDLINE_H
|
||||
#define OPENSC_ASN1_CMDLINE_H
|
||||
|
||||
/* If we use autoconf. */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h> /* for FILE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifndef CMDLINE_PARSER_PACKAGE
|
||||
/** @brief the program name (used for printing errors) */
|
||||
#define CMDLINE_PARSER_PACKAGE "opensc-asn1"
|
||||
#endif
|
||||
|
||||
#ifndef CMDLINE_PARSER_PACKAGE_NAME
|
||||
/** @brief the complete program name (used for help and version) */
|
||||
#define CMDLINE_PARSER_PACKAGE_NAME "opensc-asn1"
|
||||
#endif
|
||||
|
||||
#ifndef CMDLINE_PARSER_VERSION
|
||||
/** @brief the program version */
|
||||
#define CMDLINE_PARSER_VERSION VERSION
|
||||
#endif
|
||||
|
||||
/** @brief Where the command line options are stored */
|
||||
struct gengetopt_args_info
|
||||
{
|
||||
const char *help_help; /**< @brief Print help and exit help description. */
|
||||
const char *version_help; /**< @brief Print version and exit help description. */
|
||||
|
||||
unsigned int help_given ; /**< @brief Whether help was given. */
|
||||
unsigned int version_given ; /**< @brief Whether version was given. */
|
||||
|
||||
char **inputs ; /**< @brief unamed options (options without names) */
|
||||
unsigned inputs_num ; /**< @brief unamed options number */
|
||||
} ;
|
||||
|
||||
/** @brief The additional parameters to pass to parser functions */
|
||||
struct cmdline_parser_params
|
||||
{
|
||||
int override; /**< @brief whether to override possibly already present options (default 0) */
|
||||
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
|
||||
int check_required; /**< @brief whether to check that all required options were provided (default 1) */
|
||||
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
|
||||
int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
|
||||
} ;
|
||||
|
||||
/** @brief the purpose string of the program */
|
||||
extern const char *gengetopt_args_info_purpose;
|
||||
/** @brief the usage string of the program */
|
||||
extern const char *gengetopt_args_info_usage;
|
||||
/** @brief the description string of the program */
|
||||
extern const char *gengetopt_args_info_description;
|
||||
/** @brief all the lines making the help output */
|
||||
extern const char *gengetopt_args_info_help[];
|
||||
|
||||
/**
|
||||
* The command line parser
|
||||
* @param argc the number of command line options
|
||||
* @param argv the command line options
|
||||
* @param args_info the structure where option information will be stored
|
||||
* @return 0 if everything went fine, NON 0 if an error took place
|
||||
*/
|
||||
int cmdline_parser (int argc, char **argv,
|
||||
struct gengetopt_args_info *args_info);
|
||||
|
||||
/**
|
||||
* The command line parser (version with additional parameters - deprecated)
|
||||
* @param argc the number of command line options
|
||||
* @param argv the command line options
|
||||
* @param args_info the structure where option information will be stored
|
||||
* @param override whether to override possibly already present options
|
||||
* @param initialize whether to initialize the option structure my_args_info
|
||||
* @param check_required whether to check that all required options were provided
|
||||
* @return 0 if everything went fine, NON 0 if an error took place
|
||||
* @deprecated use cmdline_parser_ext() instead
|
||||
*/
|
||||
int cmdline_parser2 (int argc, char **argv,
|
||||
struct gengetopt_args_info *args_info,
|
||||
int override, int initialize, int check_required);
|
||||
|
||||
/**
|
||||
* The command line parser (version with additional parameters)
|
||||
* @param argc the number of command line options
|
||||
* @param argv the command line options
|
||||
* @param args_info the structure where option information will be stored
|
||||
* @param params additional parameters for the parser
|
||||
* @return 0 if everything went fine, NON 0 if an error took place
|
||||
*/
|
||||
int cmdline_parser_ext (int argc, char **argv,
|
||||
struct gengetopt_args_info *args_info,
|
||||
struct cmdline_parser_params *params);
|
||||
|
||||
/**
|
||||
* Save the contents of the option struct into an already open FILE stream.
|
||||
* @param outfile the stream where to dump options
|
||||
* @param args_info the option struct to dump
|
||||
* @return 0 if everything went fine, NON 0 if an error took place
|
||||
*/
|
||||
int cmdline_parser_dump(FILE *outfile,
|
||||
struct gengetopt_args_info *args_info);
|
||||
|
||||
/**
|
||||
* Save the contents of the option struct into a (text) file.
|
||||
* This file can be read by the config file parser (if generated by gengetopt)
|
||||
* @param filename the file where to save
|
||||
* @param args_info the option struct to save
|
||||
* @return 0 if everything went fine, NON 0 if an error took place
|
||||
*/
|
||||
int cmdline_parser_file_save(const char *filename,
|
||||
struct gengetopt_args_info *args_info);
|
||||
|
||||
/**
|
||||
* Print the help
|
||||
*/
|
||||
void cmdline_parser_print_help(void);
|
||||
/**
|
||||
* Print the version
|
||||
*/
|
||||
void cmdline_parser_print_version(void);
|
||||
|
||||
/**
|
||||
* Initializes all the fields a cmdline_parser_params structure
|
||||
* to their default values
|
||||
* @param params the structure to initialize
|
||||
*/
|
||||
void cmdline_parser_params_init(struct cmdline_parser_params *params);
|
||||
|
||||
/**
|
||||
* Allocates dynamically a cmdline_parser_params structure and initializes
|
||||
* all its fields to their default values
|
||||
* @return the created and initialized cmdline_parser_params structure
|
||||
*/
|
||||
struct cmdline_parser_params *cmdline_parser_params_create(void);
|
||||
|
||||
/**
|
||||
* Initializes the passed gengetopt_args_info structure's fields
|
||||
* (also set default values for options that have a default)
|
||||
* @param args_info the structure to initialize
|
||||
*/
|
||||
void cmdline_parser_init (struct gengetopt_args_info *args_info);
|
||||
/**
|
||||
* Deallocates the string fields of the gengetopt_args_info structure
|
||||
* (but does not deallocate the structure itself)
|
||||
* @param args_info the structure to deallocate
|
||||
*/
|
||||
void cmdline_parser_free (struct gengetopt_args_info *args_info);
|
||||
|
||||
/**
|
||||
* Checks that all the required options were specified
|
||||
* @param args_info the structure to check
|
||||
* @param prog_name the name of the program that will be used to print
|
||||
* possible errors
|
||||
* @return
|
||||
*/
|
||||
int cmdline_parser_required (struct gengetopt_args_info *args_info,
|
||||
const char *prog_name);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* OPENSC_ASN1_CMDLINE_H */
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (C) 2017 Frank Morgner <frankmorgner@gmail.com>
|
||||
*
|
||||
* This file is part of OpenSC.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "fread_to_eof.h"
|
||||
#include "libopensc/asn1.h"
|
||||
#include "opensc-asn1-cmdline.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct gengetopt_args_info cmdline;
|
||||
unsigned char *buf = NULL;
|
||||
size_t buflen = 0, i;
|
||||
|
||||
if (cmdline_parser(argc, argv, &cmdline) != 0)
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < cmdline.inputs_num; i++) {
|
||||
if (!fread_to_eof(cmdline.inputs[i], &buf, &buflen))
|
||||
continue;
|
||||
|
||||
printf("Parsing '%s' (%"SC_FORMAT_LEN_SIZE_T"u byte%s)\n",
|
||||
cmdline.inputs[i], buflen, buflen == 1 ? "" : "s");
|
||||
sc_asn1_print_tags(buf, buflen);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
cmdline_parser_free (&cmdline);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package "opensc-asn1"
|
||||
purpose "@PACKAGE_SUMMARY@"
|
||||
description "Parse ASN.1 data."
|
||||
|
||||
text "
|
||||
Report bugs to @PACKAGE_BUGREPORT@
|
||||
|
||||
Written by Frank Morgner <frankmorgner@gmail.com>"
|
|
@ -125,6 +125,9 @@
|
|||
<Component Id="opensc.dll" Guid="*" Win64="$(var.Win64YesNo)">
|
||||
<File Source="$(var.SOURCE_DIR)\src\libopensc\opensc.dll" Vital="yes"/>
|
||||
</Component>
|
||||
<Component Id="opensc_asn1.exe" Guid="*" Win64="$(var.Win64YesNo)">
|
||||
<File Source="$(var.SOURCE_DIR)\src\tools\opensc-asn1.exe" Vital="yes"/>
|
||||
</Component>
|
||||
<Component Id="opensc_explorer.exe" Guid="*" Win64="$(var.Win64YesNo)">
|
||||
<File Source="$(var.SOURCE_DIR)\src\tools\opensc-explorer.exe" Vital="yes"/>
|
||||
</Component>
|
||||
|
@ -140,6 +143,9 @@
|
|||
<Component Id="cardos_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
|
||||
<File Source="$(var.SOURCE_DIR)\src\tools\cardos-tool.exe" Vital="yes"/>
|
||||
</Component>
|
||||
<Component Id="egk_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
|
||||
<File Source="$(var.SOURCE_DIR)\src\tools\egk-tool.exe" Vital="yes"/>
|
||||
</Component>
|
||||
<Component Id="eidenv.exe" Guid="*" Win64="$(var.Win64YesNo)">
|
||||
<File Source="$(var.SOURCE_DIR)\src\tools\eidenv.exe" Vital="yes"/>
|
||||
</Component>
|
||||
|
@ -343,11 +349,13 @@
|
|||
</Feature>
|
||||
<!-- Tools and profiles are for personalization -->
|
||||
<Feature Id="OpenSC_tools" Level="1" Title="Tools and profiles" Description="Tools for debugging and personalization. Includes profiles needed for running pkcs15-init.exe">
|
||||
<ComponentRef Id="opensc_asn1.exe"/>
|
||||
<ComponentRef Id="opensc_explorer.exe"/>
|
||||
<ComponentRef Id="opensc_tool.exe"/>
|
||||
<ComponentRef Id="opensc_notify.exe"/>
|
||||
<ComponentRef Id="pkcs11_tool.exe"/>
|
||||
<ComponentRef Id="cardos_tool.exe"/>
|
||||
<ComponentRef Id="egk_tool.exe"/>
|
||||
<ComponentRef Id="eidenv.exe"/>
|
||||
<ComponentRef Id="pkcs15_tool.exe"/>
|
||||
<ComponentRef Id="pkcs15_crypt.exe"/>
|
||||
|
|
Loading…
Reference in New Issue