fix configure: Thanks to Sumedha Widyadharma
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,5 +1,16 @@
|
|||||||
2013-09-25 Niibe Yutaka <gniibe@fsij.org>
|
2013-09-25 Niibe Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* VERSION: New file.
|
||||||
|
|
||||||
|
* src/configure (SERIALNO, SERIALNO_STR_LEN_DEFINE): New.
|
||||||
|
(REVISION): Use the file VERSION if it doesn't have .git.
|
||||||
|
Thanks to Sumedha Widyadharma for the bug report.
|
||||||
|
|
||||||
|
* src/config.h.in (SERIALNO_STR_LEN_DEFINE): New.
|
||||||
|
* src/main.c (ID_OFFSET): Use SERIALNO_STR_LEN.
|
||||||
|
* src/usb_desc.c (gnukStringSerial): Remove. It's now
|
||||||
|
generated in usb-strings.c.inc.
|
||||||
|
|
||||||
* src/ec_p256.c (compute_kP): Fix for impossible cases.
|
* src/ec_p256.c (compute_kP): Fix for impossible cases.
|
||||||
(point_is_on_the_curve): New.
|
(point_is_on_the_curve): New.
|
||||||
(coefficient_a, coefficient_b): New.
|
(coefficient_a, coefficient_b): New.
|
||||||
|
|||||||
6
README
6
README
@@ -297,8 +297,10 @@ please contact Niibe, so that it is listed to the file in the official
|
|||||||
release of the source code.
|
release of the source code.
|
||||||
|
|
||||||
When you are modifing Gnuk and installing the binary to device, you
|
When you are modifing Gnuk and installing the binary to device, you
|
||||||
should replace the vendor string to yours, so that users can see it's
|
should replace the vendor string and serial number to yours (in the
|
||||||
not by original vendor, and it is modified version.
|
file GNUK_USB_DEVICE_ID and SERIALNO of the script of src/configure),
|
||||||
|
so that users can see it's not by original vendor, and it is modified
|
||||||
|
version.
|
||||||
|
|
||||||
FSIJ allows you to use USB device ID of FSIJ (234b:0000) for devices
|
FSIJ allows you to use USB device ID of FSIJ (234b:0000) for devices
|
||||||
with Gnuk under one of following conditions:
|
with Gnuk under one of following conditions:
|
||||||
|
|||||||
@@ -6,3 +6,4 @@
|
|||||||
@PINPAD_DEFINE@
|
@PINPAD_DEFINE@
|
||||||
@PINPAD_MORE_DEFINE@
|
@PINPAD_MORE_DEFINE@
|
||||||
@CERTDO_DEFINE@
|
@CERTDO_DEFINE@
|
||||||
|
@SERIALNO_STR_LEN@
|
||||||
|
|||||||
21
src/configure
vendored
21
src/configure
vendored
@@ -200,7 +200,18 @@ else
|
|||||||
echo "Key generation on device is NOT supported"
|
echo "Key generation on device is NOT supported"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -d ../.git; then
|
||||||
REVISION=`git describe --dirty="-modified"`
|
REVISION=`git describe --dirty="-modified"`
|
||||||
|
else
|
||||||
|
REVISION=`cat ../VERSION`
|
||||||
|
fi
|
||||||
|
|
||||||
|
### !!! Replace following string of "FSIJ" to yours !!! ####
|
||||||
|
SERIALNO="FSIJ-`cat ../VERSION | sed -e 's%^[^/]*/%%'`-"
|
||||||
|
|
||||||
|
SERIALNO_STR_LEN_DEFINE="#define SERIALNO_STR_LEN ${#SERIALNO}"
|
||||||
|
|
||||||
|
|
||||||
CONFIG="$target:dfu=$with_dfu:debug=$debug:pinpad=$pinpad:certdo=$certdo:keygen=$keygen"
|
CONFIG="$target:dfu=$with_dfu:debug=$debug:pinpad=$pinpad:certdo=$certdo:keygen=$keygen"
|
||||||
|
|
||||||
if !(IFS=" "
|
if !(IFS=" "
|
||||||
@@ -223,6 +234,15 @@ if !(IFS=" "
|
|||||||
echo $PRODUCT | sed -n -e "s/\(........\)/\1\n/gp" | sed -n -e "s/\(.\)/'\1', 0, /g" -e "s/^/ /" -e "s/ $//p"
|
echo $PRODUCT | sed -n -e "s/\(........\)/\1\n/gp" | sed -n -e "s/\(.\)/'\1', 0, /g" -e "s/^/ /" -e "s/ $//p"
|
||||||
echo '};'
|
echo '};'
|
||||||
echo
|
echo
|
||||||
|
echo 'const uint8_t gnukStringSerial[] = {'
|
||||||
|
echo " ${#SERIALNO}*2+2+16, /* bLength */"
|
||||||
|
echo " USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */"
|
||||||
|
echo " /* Serial number: \"$SERIALNO\" */"
|
||||||
|
echo $SERIALNO | sed -n -e "s/\(........\)/\1\n/gp" | sed -n -e "s/\(.\)/'\1', 0, /g" -e "s/^/ /" -e "s/ $//p"
|
||||||
|
echo " 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,"
|
||||||
|
echo " 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,"
|
||||||
|
echo '};'
|
||||||
|
echo
|
||||||
echo '#ifdef USB_STRINGS_FOR_GNUK'
|
echo '#ifdef USB_STRINGS_FOR_GNUK'
|
||||||
echo 'static const uint8_t gnuk_revision_detail[] = {'
|
echo 'static const uint8_t gnuk_revision_detail[] = {'
|
||||||
echo " ${#REVISION}*2+2, /* bLength */"
|
echo " ${#REVISION}*2+2, /* bLength */"
|
||||||
@@ -278,5 +298,6 @@ sed -e "s/@DEBUG_DEFINE@/$DEBUG_DEFINE/" \
|
|||||||
-e "s/@PINPAD_DEFINE@/$PINPAD_DEFINE/" \
|
-e "s/@PINPAD_DEFINE@/$PINPAD_DEFINE/" \
|
||||||
-e "s/@PINPAD_MORE_DEFINE@/$PINPAD_MORE_DEFINE/" \
|
-e "s/@PINPAD_MORE_DEFINE@/$PINPAD_MORE_DEFINE/" \
|
||||||
-e "s/@CERTDO_DEFINE@/$CERTDO_DEFINE/" \
|
-e "s/@CERTDO_DEFINE@/$CERTDO_DEFINE/" \
|
||||||
|
-e "s/@SERIALNO_STR_LEN@/$SERIALNO_STR_LEN_DEFINE/" \
|
||||||
< config.h.in > config.h
|
< config.h.in > config.h
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -121,8 +121,7 @@ extern void *USBthread (void *arg);
|
|||||||
#define LED_TIMEOUT_STOP (200*1000)
|
#define LED_TIMEOUT_STOP (200*1000)
|
||||||
|
|
||||||
|
|
||||||
/* It has two-byte prefix and content is "FSIJ-1.0.1-" (2 + 11*2). */
|
#define ID_OFFSET (2+SERIALNO_STR_LEN*2)
|
||||||
#define ID_OFFSET 24
|
|
||||||
static void
|
static void
|
||||||
device_initialize_once (void)
|
device_initialize_once (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -272,17 +272,6 @@ static const uint8_t gnukStringLangID[] = {
|
|||||||
#define USB_STRINGS_FOR_GNUK 1
|
#define USB_STRINGS_FOR_GNUK 1
|
||||||
#include "usb-strings.c.inc"
|
#include "usb-strings.c.inc"
|
||||||
|
|
||||||
const uint8_t gnukStringSerial[] = {
|
|
||||||
19*2+2, /* bLength */
|
|
||||||
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
||||||
/* FSIJ-1.0.1- */
|
|
||||||
'F', 0, 'S', 0, 'I', 0, 'J', 0, '-', 0,
|
|
||||||
'1', 0, '.', 0, '0', 0, '.', 0, '2', 0, /* Version number of Gnuk */
|
|
||||||
'-', 0,
|
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct Descriptor Device_Descriptor = {
|
static const struct Descriptor Device_Descriptor = {
|
||||||
gnukDeviceDescriptor,
|
gnukDeviceDescriptor,
|
||||||
sizeof (gnukDeviceDescriptor)
|
sizeof (gnukDeviceDescriptor)
|
||||||
|
|||||||
Reference in New Issue
Block a user