summaryrefslogtreecommitdiffstats
path: root/fips/fips.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2011-04-12 17:41:53 +0000
committerDr. Stephen Henson <steve@openssl.org>2011-04-12 17:41:53 +0000
commit4bd1e895faa35a8d4810402fe3ba9d07c1166908 (patch)
tree076044a96d20e6b7a743646ecdf3bd3c5f404960 /fips/fips.c
parent9b08dbe903397b1545d3b04c264ec745f2fdeb57 (diff)
Update fips_pkey_signature_test: use fixed string if supplies tbs is
NULL. Always allocate signature buffer. Update ECDSA selftest to use fips_pkey_signature_test. Add copyright notice to file.
Diffstat (limited to 'fips/fips.c')
-rw-r--r--fips/fips.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/fips/fips.c b/fips/fips.c
index a4ed4f28fb..9ad1761f0d 100644
--- a/fips/fips.c
+++ b/fips/fips.c
@@ -397,21 +397,25 @@ unsigned char *fips_signature_witness(void)
*/
int fips_pkey_signature_test(EVP_PKEY *pkey,
- const unsigned char *tbs, int tbslen,
- const unsigned char *kat, unsigned int katlen,
+ const unsigned char *tbs, size_t tbslen,
+ const unsigned char *kat, size_t katlen,
const EVP_MD *digest, int pad_mode,
const char *fail_str)
{
int ret = 0;
- unsigned char sigtmp[256], *sig = sigtmp;
+ unsigned char *sig = NULL;
unsigned int siglen;
+ static const unsigned char str1[]="12345678901234567890";
DSA_SIG *dsig = NULL;
ECDSA_SIG *esig = NULL;
EVP_MD_CTX mctx;
FIPS_md_ctx_init(&mctx);
- if ((pkey->type == EVP_PKEY_RSA)
- && ((size_t)RSA_size(pkey->pkey.rsa) > sizeof(sigtmp)))
+
+ if (tbs == NULL)
+ tbs = str1;
+
+ if (pkey->type == EVP_PKEY_RSA)
{
sig = OPENSSL_malloc(RSA_size(pkey->pkey.rsa));
if (!sig)
@@ -421,7 +425,7 @@ int fips_pkey_signature_test(EVP_PKEY *pkey,
}
}
- if (tbslen == -1)
+ if (tbslen == 0)
tbslen = strlen((char *)tbs);
if (digest == NULL)
@@ -486,7 +490,7 @@ int fips_pkey_signature_test(EVP_PKEY *pkey,
FIPS_dsa_sig_free(dsig);
if (esig != NULL)
FIPS_ecdsa_sig_free(esig);
- if (sig != sigtmp)
+ if (sig)
OPENSSL_free(sig);
FIPS_md_ctx_cleanup(&mctx);
if (ret != 1)
f='#n253'>253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
menuconfig POWER_SUPPLY
	bool "Power supply class support"
	help
	  Say Y here to enable power supply class support. This allows
	  power supply (batteries, AC, USB) monitoring by userspace
	  via sysfs and uevent (if available) and/or APM kernel interface
	  (if selected below).

if POWER_SUPPLY

config POWER_SUPPLY_DEBUG
	bool "Power supply debug"
	help
	  Say Y here to enable debugging messages for power supply class
	  and drivers.

config PDA_POWER
	tristate "Generic PDA/phone power driver"
	depends on !S390
	help
	  Say Y here to enable generic power driver for PDAs and phones with
	  one or two external power supplies (AC/USB) connected to main and
	  backup batteries, and optional builtin charger.

config APM_POWER
	tristate "APM emulation for class batteries"
	depends on APM_EMULATION
	help
	  Say Y here to enable support APM status emulation using
	  battery class devices.

config GENERIC_ADC_BATTERY
	tristate "Generic battery support using IIO"
	depends on IIO
	help
	  Say Y here to enable support for the generic battery driver
	  which uses IIO framework to read adc.

config MAX8925_POWER
	tristate "MAX8925 battery charger support"
	depends on MFD_MAX8925
	help
	  Say Y here to enable support for the battery charger in the Maxim
	  MAX8925 PMIC.

config WM831X_BACKUP
	tristate "WM831X backup battery charger support"
	depends on MFD_WM831X
	help
	  Say Y here to enable support for the backup battery charger
	  in the Wolfson Microelectronics WM831x PMICs.

config WM831X_POWER
	tristate "WM831X PMU support"
	depends on MFD_WM831X
	help
	  Say Y here to enable support for the power management unit
	  provided by Wolfson Microelectronics WM831x PMICs.

config WM8350_POWER
        tristate "WM8350 PMU support"
        depends on MFD_WM8350
        help
          Say Y here to enable support for the power management unit
	  provided by the Wolfson Microelectronics WM8350 PMIC.

config TEST_POWER
	tristate "Test power driver"
	help
	  This driver is used for testing. It's safe to say M here.

config BATTERY_88PM860X
	tristate "Marvell 88PM860x battery driver"
	depends on MFD_88PM860X
	help
	  Say Y here to enable battery monitor for Marvell 88PM860x chip.

config BATTERY_DS2760
	tristate "DS2760 battery driver (HP iPAQ & others)"
	depends on W1 && W1_SLAVE_DS2760
	help
	  Say Y here to enable support for batteries with ds2760 chip.

config BATTERY_DS2780
	tristate "DS2780 battery driver"
	depends on HAS_IOMEM
	select W1
	select W1_SLAVE_DS2780
	help
	  Say Y here to enable support for batteries with ds2780 chip.

config BATTERY_DS2781
	tristate "DS2781 battery driver"
	depends on HAS_IOMEM
	select W1
	select W1_SLAVE_DS2781
	help
	  If you enable this you will have the DS2781 battery driver support.

	  The battery monitor chip is used in many batteries/devices
	  as the one who is responsible for charging/discharging/monitoring
	  Li+ batteries.

	  If you are unsure, say N.

config BATTERY_DS2782
	tristate "DS2782/DS2786 standalone gas-gauge"
	depends on I2C
	help
	  Say Y here to enable support for the DS2782/DS2786 standalone battery
	  gas-gauge.

config BATTERY_PMU
	tristate "Apple PMU battery"
	depends on PPC32 && ADB_PMU
	help
	  Say Y here to expose battery information on Apple machines
	  through the generic battery class.

config BATTERY_OLPC
	tristate "One Laptop Per Child battery"
	depends on X86_32 && OLPC
	help
	  Say Y to enable support for the battery on the OLPC laptop.

config BATTERY_TOSA
	tristate "Sharp SL-6000 (tosa) battery"
	depends on MACH_TOSA && MFD_TC6393XB && TOUCHSCREEN_WM97XX
	help
	  Say Y to enable support for the battery on the Sharp Zaurus
	  SL-6000 (tosa) models.

config BATTERY_COLLIE
	tristate "Sharp SL-5500 (collie) battery"
	depends on SA1100_COLLIE && MCP_UCB1200
	help
	  Say Y to enable support for the battery on the Sharp Zaurus
	  SL-5500 (collie) models.

config BATTERY_WM97XX
	bool "WM97xx generic battery driver"
	depends on TOUCHSCREEN_WM97XX=y
	help
	  Say Y to enable support for battery measured by WM97xx aux port.

config BATTERY_SBS
        tristate "SBS Compliant gas gauge"
        depends on I2C
        help
	  Say Y to include support for SBS battery driver for SBS-compliant
	  gas gauges.

config BATTERY_BQ27x00
	tristate "BQ27x00 battery driver"
	help
	  Say Y here to enable support for batteries with BQ27x00 (I2C/HDQ) chips.

config BATTERY_BQ27X00_I2C
	bool "BQ27200/BQ27500 support"
	depends on BATTERY_BQ27x00
	depends on I2C
	default y
	help
	  Say Y here to enable support for batteries with BQ27x00 (I2C) chips.

config BATTERY_BQ27X00_PLATFORM
	bool "BQ27000 support"
	depends on BATTERY_BQ27x00
	default y
	help
	  Say Y here to enable support for batteries with BQ27000 (HDQ) chips.

config BATTERY_DA9030
	tristate "DA9030 battery driver"
	depends on PMIC_DA903X
	help
	  Say Y here to enable support for batteries charger integrated into
	  DA9030 PMIC.

config BATTERY_DA9052
	tristate "Dialog DA9052 Battery"
	depends on PMIC_DA9052
	help
	  Say Y here to enable support for batteries charger integrated into
	  DA9052 PMIC.

config BATTERY_MAX17040
	tristate "Maxim MAX17040 Fuel Gauge"
	depends on I2C
	help
	  MAX17040 is fuel-gauge systems for lithium-ion (Li+) batteries
	  in handheld and portable equipment. The MAX17040 is configured
	  to operate with a single lithium cell

config BATTERY_MAX17042
	tristate "Maxim MAX17042/17047/17050/8997/8966 Fuel Gauge"
	depends on I2C
	help
	  MAX17042 is fuel-gauge systems for lithium-ion (Li+) batteries
	  in handheld and portable equipment. The MAX17042 is configured
	  to operate with a single lithium cell. MAX8997 and MAX8966 are
	  multi-function devices that include fuel gauages that are compatible
	  with MAX17042. This driver also supports max17047/50 chips which are
	  improved version of max17042.

config BATTERY_Z2
	tristate "Z2 battery driver"
	depends on I2C && MACH_ZIPIT2
	help
	  Say Y to include support for the battery on the Zipit Z2.

config BATTERY_S3C_ADC
	tristate "Battery driver for Samsung ADC based monitoring"
	depends on S3C_ADC
	help
	  Say Y here to enable support for iPAQ h1930/h1940/rx1950 battery

config CHARGER_88PM860X
	tristate "Marvell 88PM860x Charger driver"
	depends on MFD_88PM860X && BATTERY_88PM860X
	help
	  Say Y here to enable charger for Marvell 88PM860x chip.

config CHARGER_PCF50633
	tristate "NXP PCF50633 MBC"
	depends on MFD_PCF50633
	help
	 Say Y to include support for NXP PCF50633 Main Battery Charger.

config BATTERY_JZ4740
	tristate "Ingenic JZ4740 battery"
	depends on MACH_JZ4740
	depends on MFD_JZ4740_ADC
	help
	  Say Y to enable support for the battery on Ingenic JZ4740 based
	  boards.

	  This driver can be build as a module. If so, the module will be
	  called jz4740-battery.

config BATTERY_INTEL_MID
	tristate "Battery driver for Intel MID platforms"
	depends on INTEL_SCU_IPC && SPI
	help
	  Say Y here to enable the battery driver on Intel MID
	  platforms.

config BATTERY_RX51
	tristate "Nokia RX-51 (N900) battery driver"
	depends on TWL4030_MADC
	help
	  Say Y here to enable support for battery information on Nokia
	  RX-51, also known as N900 tablet.

config CHARGER_ISP1704
	tristate "ISP1704 USB Charger Detection"
	depends on USB_OTG_UTILS
	help
	  Say Y to enable support for USB Charger Detection with
	  ISP1707/ISP1704 USB transceivers.

config CHARGER_MAX8903
	tristate "MAX8903 Battery DC-DC Charger for USB and Adapter Power"
	depends on GENERIC_HARDIRQS
	help
	  Say Y to enable support for the MAX8903 DC-DC charger and sysfs.
	  The driver supports controlling charger-enable and current-limit
	  pins based on the status of charger connections with interrupt
	  handlers.

config CHARGER_TWL4030
	tristate "OMAP TWL4030 BCI charger driver"
	depends on TWL4030_CORE
	help
	  Say Y here to enable support for TWL4030 Battery Charge Interface.

config CHARGER_LP8727
	tristate "TI/National Semiconductor LP8727 charger driver"
	depends on I2C
	help
	  Say Y here to enable support for LP8727 Charger Driver.

config CHARGER_LP8788
	tristate "TI LP8788 charger driver"
	depends on MFD_LP8788
	depends on LP8788_ADC
	help
	  Say Y to enable support for the LP8788 linear charger.

config CHARGER_GPIO
	tristate "GPIO charger"
	depends on GPIOLIB
	help
	  Say Y to include support for chargers which report their online status
	  through a GPIO pin.

	  This driver can be build as a module. If so, the module will be
	  called gpio-charger.

config CHARGER_MANAGER
	bool "Battery charger manager for multiple chargers"
	depends on REGULATOR && RTC_CLASS
	select EXTCON
	help
          Say Y to enable charger-manager support, which allows multiple
          chargers attached to a battery and multiple batteries attached to a
          system. The charger-manager also can monitor charging status in
          runtime and in suspend-to-RAM by waking up the system periodically
          with help of suspend_again support.

config CHARGER_MAX8997
	tristate "Maxim MAX8997/MAX8966 PMIC battery charger driver"
	depends on MFD_MAX8997 && REGULATOR_MAX8997
	help
	  Say Y to enable support for the battery charger control sysfs and
	  platform data of MAX8997/LP3974 PMICs.

config CHARGER_MAX8998
	tristate "Maxim MAX8998/LP3974 PMIC battery charger driver"
	depends on MFD_MAX8998 && REGULATOR_MAX8998
	help
	  Say Y to enable support for the battery charger control sysfs and
	  platform data of MAX8998/LP3974 PMICs.

config CHARGER_SMB347
	tristate "Summit Microelectronics SMB347 Battery Charger"
	depends on I2C
	select REGMAP_I2C
	help
	  Say Y to include support for Summit Microelectronics SMB347
	  Battery Charger.

config AB8500_BM
	bool "AB8500 Battery Management Driver"
	depends on AB8500_CORE && AB8500_GPADC
	help
	  Say Y to include support for AB8500 battery management.

config AB8500_BATTERY_THERM_ON_BATCTRL
	bool "Thermistor connected on BATCTRL ADC"
	depends on AB8500_BM
	help
	  Say Y to enable battery temperature measurements using
	  thermistor connected on BATCTRL ADC.
endif # POWER_SUPPLY

source "drivers/power/avs/Kconfig"