diff options
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl10/openssl-c_rehash.sh')
-rw-r--r-- | meta/recipes-connectivity/openssl/openssl10/openssl-c_rehash.sh | 222 |
1 files changed, 222 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl10/openssl-c_rehash.sh b/meta/recipes-connectivity/openssl/openssl10/openssl-c_rehash.sh new file mode 100644 index 0000000000..6620fdcb53 --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl10/openssl-c_rehash.sh @@ -0,0 +1,222 @@ +#!/bin/sh +# +# Ben Secrest <blsecres@gmail.com> +# +# sh c_rehash script, scan all files in a directory +# and add symbolic links to their hash values. +# +# based on the c_rehash perl script distributed with openssl +# +# LICENSE: See OpenSSL license +# ^^acceptable?^^ +# + +# default certificate location +DIR=/etc/openssl + +# for filetype bitfield +IS_CERT=$(( 1 << 0 )) +IS_CRL=$(( 1 << 1 )) + + +# check to see if a file is a certificate file or a CRL file +# arguments: +# 1. the filename to be scanned +# returns: +# bitfield of file type; uses ${IS_CERT} and ${IS_CRL} +# +check_file() +{ + local IS_TYPE=0 + + # make IFS a newline so we can process grep output line by line + local OLDIFS=${IFS} + IFS=$( printf "\n" ) + + # XXX: could be more efficient to have two 'grep -m' but is -m portable? + for LINE in $( grep '^-----BEGIN .*-----' ${1} ) + do + if echo ${LINE} \ + | grep -q -E '^-----BEGIN (X509 |TRUSTED )?CERTIFICATE-----' + then + IS_TYPE=$(( ${IS_TYPE} | ${IS_CERT} )) + + if [ $(( ${IS_TYPE} & ${IS_CRL} )) -ne 0 ] + then + break + fi + elif echo ${LINE} | grep -q '^-----BEGIN X509 CRL-----' + then + IS_TYPE=$(( ${IS_TYPE} | ${IS_CRL} )) + + if [ $(( ${IS_TYPE} & ${IS_CERT} )) -ne 0 ] + then + break + fi + fi + done + + # restore IFS + IFS=${OLDIFS} + + return ${IS_TYPE} +} + + +# +# use openssl to fingerprint a file +# arguments: +# 1. the filename to fingerprint +# 2. the method to use (x509, crl) +# returns: +# none +# assumptions: +# user will capture output from last stage of pipeline +# +fingerprint() +{ + ${SSL_CMD} ${2} -fingerprint -noout -in ${1} | sed 's/^.*=//' | tr -d ':' +} + + +# +# link_hash - create links to certificate files +# arguments: +# 1. the filename to create a link for +# 2. the type of certificate being linked (x509, crl) +# returns: +# 0 on success, 1 otherwise +# +link_hash() +{ + local FINGERPRINT=$( fingerprint ${1} ${2} ) + local HASH=$( ${SSL_CMD} ${2} -hash -noout -in ${1} ) + local SUFFIX=0 + local LINKFILE='' + local TAG='' + + if [ ${2} = "crl" ] + then + TAG='r' + fi + + LINKFILE=${HASH}.${TAG}${SUFFIX} + + while [ -f ${LINKFILE} ] + do + if [ ${FINGERPRINT} = $( fingerprint ${LINKFILE} ${2} ) ] + then + echo "NOTE: Skipping duplicate file ${1}" >&2 + return 1 + fi + + SUFFIX=$(( ${SUFFIX} + 1 )) + LINKFILE=${HASH}.${TAG}${SUFFIX} + done + + echo "${3} => ${LINKFILE}" + + # assume any system with a POSIX shell will either support symlinks or + # do something to handle this gracefully + ln -s ${3} ${LINKFILE} + + return 0 +} + + +# hash_dir create hash links in a given directory +hash_dir() +{ + echo "Doing ${1}" + + cd ${1} + + ls -1 * 2>/dev/null | while read FILE + do + if echo ${FILE} | grep -q -E '^[[:xdigit:]]{8}\.r?[[:digit:]]+$' \ + && [ -h "${FILE}" ] + then + rm ${FILE} + fi + done + + ls -1 *.pem *.cer *.crt *.crl 2>/dev/null | while read FILE + do + REAL_FILE=${FILE} + # if we run on build host then get to the real files in rootfs + if [ -n "${SYSROOT}" -a -h ${FILE} ] + then + FILE=$( readlink ${FILE} ) + # check the symlink is absolute (or dangling in other word) + if [ "x/" = "x This patch adds support for Sharp CE-RH2 on Akita and CE-RH1 on C7x0.
This patch is a bit ugly:
- Device specific functions should be moved to platform infrastructure.
- Maybe define generic *_scoopexp functions handling Akita x Spitz differences.
Index: linux-2.6.24/drivers/input/keyboard/sharpsl_rc.c
===================================================================
--- linux-2.6.24.orig/drivers/input/keyboard/sharpsl_rc.c 2008-03-08 19:29:02.000000000 +0000
+++ linux-2.6.24/drivers/input/keyboard/sharpsl_rc.c 2008-03-08 22:23:35.000000000 +0000
@@ -21,12 +21,10 @@
#include <linux/module.h>
#include <linux/slab.h>
-#ifdef CONFIG_MACH_SPITZ
+#include <asm/mach-types.h>
#include <asm/arch/spitz.h>
-#endif
-#ifdef CONFIG_MACH_CORGI
+#include <asm/arch/akita.h>
#include <asm/arch/corgi.h>
-#endif
#include <asm/arch/hardware.h>
#include <asm/arch/pxa-regs.h>
@@ -42,12 +40,8 @@
unsigned char key;
};
-#ifdef CONFIG_MACH_SPITZ
-#define REMOTE_AKIN_PULLUP SPITZ_SCP2_AKIN_PULLUP
-#define REMOTE_SCOOP_DEVICE spitzscoop2_device
-#define REMOTE_GPIO_INT SPITZ_GPIO_AK_INT
-#define REMOTE_IRQ_INT SPITZ_IRQ_GPIO_AK_INT
-static struct remote_control_key remote_keys[] = {
+static struct remote_control_key remote_keys_spitz[] = {
+ /* CE-RH2 values */
{ 25, 35, KEY_STOPCD},
{ 55, 65, KEY_PLAYPAUSE},
{ 85, 95, KEY_NEXTSONG},
@@ -56,23 +50,15 @@
{ 180, 190, KEY_MUTE},
{ 215, 225, KEY_VOLUMEDOWN},
};
-#endif
-#ifdef CONFIG_MACH_CORGI
-#define REMOTE_AKIN_PULLUP CORGI_SCP_AKIN_PULLUP
-#define REMOTE_SCOOP_DEVICE corgiscoop_device
-#define REMOTE_GPIO_INT CORGI_GPIO_AK_INT
-#define REMOTE_IRQ_INT CORGI_IRQ_GPIO_AK_INT
-static struct remote_control_key remote_keys[] = {
- //These need to be fixed for the CE-RH1's values
- { 25, 35, KEY_STOPCD},
- { 55, 65, KEY_PLAYPAUSE},
- { 85, 95, KEY_NEXTSONG},
- { 115, 125, KEY_VOLUMEUP},
- { 145, 155, KEY_PREVIOUSSONG},
- { 180, 190, KEY_MUTE},
- { 215, 225, KEY_VOLUMEDOWN},
+static struct remote_control_key remote_keys_corgi[] = {
+ /* CE-RH1 values */
+ { 27, 35, KEY_STOPCD},
+ { 7, 13, KEY_PLAYPAUSE},
+ { 77, 93, KEY_NEXTSONG},
+ { 115, 132, KEY_VOLUMEUP},
+ { 46, 58, KEY_PREVIOUSSONG},
+ { 170, 186, KEY_VOLUMEDOWN},
};
-#endif
#define RELEASE_HI 230
#define MAX_EARPHONE 6
@@ -98,9 +84,17 @@
static int get_remocon_raw(void)
{
int i, val;
+ struct remote_control_key *remote_keys;
+
+ if (machine_is_borzoi() || machine_is_spitz() || machine_is_akita())
+ remote_keys = remote_keys_spitz;
+ else
+ remote_keys = remote_keys_corgi;
val = sharpsl_pm_pxa_read_max1111(MAX1111_REMCOM);
- for (i = 0; i < ARRAY_SIZE(remote_keys); ++i) {
+ for (i = 0; i < (machine_is_borzoi() || machine_is_spitz() || machine_is_akita() ?
+ ARRAY_SIZE(remote_keys_spitz) : ARRAY_SIZE(remote_keys_corgi));
+ ++i) {
if (val >= remote_keys[i].min
&& val <= remote_keys[i].max) {
printk("get_remocon_raw: VAL=%i, KEY=%i\n", val, remote_keys[i].key);
@@ -121,8 +115,12 @@
data->state = 0;
data->last_key = 0;
- reset_scoop_gpio(&REMOTE_SCOOP_DEVICE.dev, REMOTE_AKIN_PULLUP);
-
+ if (machine_is_borzoi() || machine_is_spitz())
+ reset_scoop_gpio(platform_scoop_config->devs[1].dev, SPITZ_SCP2_AKIN_PULLUP);
+ else if (machine_is_akita())
+ akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_AKIN_PULLUP);
+ else
+ reset_scoop_gpio(platform_scoop_config->devs[0].dev, CORGI_SCP_AKIN_PULLUP);
mod_timer(&data->rctimer, jiffies + msecs_to_jiffies(RC_POLL_MS));
}
return IRQ_HANDLED;
@@ -182,7 +180,12 @@
if (timer) {
mod_timer(&data->rctimer, jiffies + msecs_to_jiffies(RC_POLL_MS));
} else {
- set_scoop_gpio(&REMOTE_SCOOP_DEVICE.dev, REMOTE_AKIN_PULLUP);
+ if (machine_is_borzoi() || machine_is_spitz())
+ set_scoop_gpio(platform_scoop_config->devs[1].dev, SPITZ_SCP2_AKIN_PULLUP);
+ else if (machine_is_akita())
+ akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_AKIN_PULLUP);
+ else
+ set_scoop_gpio(platform_scoop_config->devs[0].dev, CORGI_SCP_AKIN_PULLUP);
data->handling_press = 0;
}
}
@@ -192,6 +195,7 @@
struct sharpsl_rc *sharpsl_rc;
struct input_dev *input_dev;
int i, ret;
+ struct remote_control_key *remote_keys;
dev_dbg(&pdev->dev, "sharpsl_rc_probe\n");
@@ -225,17 +229,32 @@
input_dev->evbit[0] = BIT(EV_KEY);
- for (i = 0; i <= ARRAY_SIZE(remote_keys); i++)
+ if (machine_is_borzoi() || machine_is_spitz() || machine_is_akita())
+ remote_keys = remote_keys_spitz;
+ else
+ remote_keys = remote_keys_corgi;
+ for (i = 0; i < (machine_is_borzoi() || machine_is_spitz() || machine_is_akita() ?
+ ARRAY_SIZE(remote_keys_spitz) : ARRAY_SIZE(remote_keys_corgi));
+ ++i)
set_bit(remote_keys[i].key, input_dev->keybit);
input_register_device(sharpsl_rc->input);
- pxa_gpio_mode(REMOTE_GPIO_INT | GPIO_IN);
- ret = request_irq(REMOTE_IRQ_INT,
- sharpsl_rc_interrupt,
- IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_SHARED,
- "sharpsl_rc",
- sharpsl_rc);
+ if (machine_is_borzoi() || machine_is_spitz() || machine_is_akita()) {
+ pxa_gpio_mode(SPITZ_GPIO_AK_INT | GPIO_IN);
+ ret = request_irq(SPITZ_IRQ_GPIO_AK_INT,
+ sharpsl_rc_interrupt,
+ IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_SHARED,
+ "sharpsl_rc",
+ sharpsl_rc);
+ } else {
+ pxa_gpio_mode(CORGI_GPIO_AK_INT | GPIO_IN);
+ ret = request_irq(CORGI_IRQ_GPIO_AK_INT,
+ sharpsl_rc_interrupt,
+ IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_SHARED,
+ "sharpsl_rc",
+ sharpsl_rc);
+ }
if (ret < 0) {
dev_dbg(&pdev->dev, "Can't get IRQ: %d!\n", i);
kfree(sharpsl_rc);
@@ -252,7 +271,10 @@
dev_dbg(&pdev->dev, "sharpsl_rc_remove\n");
- free_irq(REMOTE_IRQ_INT, sharpsl_rc);
+ if (machine_is_borzoi() || machine_is_spitz() || machine_is_akita())
+ free_irq(SPITZ_IRQ_GPIO_AK_INT, sharpsl_rc);
+ else
+ free_irq(CORGI_IRQ_GPIO_AK_INT, sharpsl_rc);
del_timer_sync(&sharpsl_rc->rctimer);
input_unregister_device(sharpsl_rc->input);
kfree(sharpsl_rc);
|