ds.ov2.test
Class State

java.lang.Object
  extended by ds.ov2.test.State

public class State
extends Object

Global variables of the host driver for the test applet. Most of them can be set via command-line options.

Static class.

CPP Preprocessing
no cpp preprocessing needed
Execution Environment:
host
Author:
Hendrik Tews
Version:
$Revision: 1.28 $
Last Commit:
$Date: 2010-03-12 15:40:21 $ by $Author: tews $

Field Summary
static Reference<Boolean> apduscript
          Print apdutool lines in addition to the APDU contents.
static Reference<Boolean> check_corner_cases
          Corner case checking.
static Reference<Integer> divisor_length
          Length of the divisor as percentage of the divident length for the division test and measurement.
static short double_bignat_max_size
          Maximal size of double-sized bignats in bytes.
static int double_size
          Size of double-sized bignats in bytes.
static BigInteger_inputs fix_inputs
          Vector of input arguments from the command line.
static Reference<String> fixed_exponent
          Exponent to be used.
static Reference<Boolean> keep_modulus
          Use the same modulus for a number of successive tests to simulate the OV-chip use-case.
static short long_bignat_max_size
          Maximal size of long bignats (bases) in bytes.
static Reference<Integer> long_size
          Size of long (base) bignats in bytes.
static Reference<Boolean> long_size_set
          Changed to true, if long_size is set via an option.
static short max_vector_length
          Maximal number of bases and exponents for Vector.exponent_mod and Vector.mont_rsa_exponent_mod.
static Reference<Integer> pre_computed_base_factors
          Number of bases for which the factors are precomputed, see Vector.exponent_mod.
static Reference<Integer> rounds
          Number of rounds to run for various tests.
static Reference<Boolean> rounds_set
          Changed to true if rounds is set via an option.
static int rsa_year
          Year for the estimation of the exponent length.
static short short_bignat_max_size
          Maximal size of short bignats (exponents).
static Reference<Integer> short_bit_size
          Size of short (exponent) bignats in bits.
static Reference<Boolean> short_bit_size_set
          Changed to true, if short_bit_size is set via options.
static int short_size
          Size of short (exponent) bignats in bytes.
static Reference<Integer> start_size
          Size to start with for those performance measurements that loop over a range of sizes.
static String test_card_applet_file
          File name of the applet cap file.
static String test_card_applet_name
          Applet ID of the test applet.
static String test_card_package_name
          Applet ID of the test applet package.
static Reference<Integer> vector_length
          Actual lenght of base and exponent vectors.
static Reference<Integer> verbosity
          Default verbosity.
 
Constructor Summary
protected State()
          Static class, object creation disabled.
 
Method Summary
static int make_short_bit_size(int long_byte_size)
          (Re-)Compute the short (exponent) bignat size in bits for the given long (base) size.
static int make_short_size(int long_byte_size)
          (Re-)Compute a suitable short (exponent) bignat size in bytes for the given long (base) size.
static void update_short_size()
          Update the short_size after the long_size has been changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

short_bignat_max_size

public static final short short_bignat_max_size
Maximal size of short bignats (exponents). Must be identical to the configured size of the short bignats in the applet. For this, this number must be passed as first applet-installation argument, see Test_applet.install and Test_host.make_installation_arguments(java.lang.String). The current value (244) is identical to the maximal RSA key size of my cards.

See Also:
Constant Field Values

long_bignat_max_size

public static final short long_bignat_max_size
Maximal size of long bignats (bases) in bytes. Must be identical to the configured size of the long bignats in the applet. For this, this number must be passed as second applet-installation argument, see Test_applet.install and Test_host.make_installation_arguments(java.lang.String). The current value is 256 + 2 Montgomery digits (= 258) to enable measurments up to 256 byte numbers.

See Also:
Constant Field Values

double_bignat_max_size

public static final short double_bignat_max_size
Maximal size of double-sized bignats in bytes. Must be identical to the configured size of the double-sized bignats in the applet. For this, this number must be passed as third applet-installation argument, see Test_applet.install and Test_host.make_installation_arguments(java.lang.String). The current value is 128.

See Also:
Constant Field Values

max_vector_length

public static final short max_vector_length
Maximal number of bases and exponents for Vector.exponent_mod and Vector.mont_rsa_exponent_mod. Must be identical to the configured size of the vector objects in the applet. For this, this number must be passed as fourth applet-installation argument, see Test_applet.install and Test_host.make_installation_arguments(java.lang.String). The current value is 5.

See Also:
Constant Field Values

rsa_year

public static final int rsa_year
Year for the estimation of the exponent length. Various performance tests run in a loop over a range of base or RSA key-length sizes. If an exponent size is needed and non has been explicitely set it is estimated with Security_parameter.exponent_length_for_modulus_length. This is the year up to which this estimation is valid. Higher numbers result in smaller exponent sizes.

Current value is 2009.

See Also:
Constant Field Values

verbosity

public static Reference<Integer> verbosity
Default verbosity. Changed with the options -d, -dd, -ddd. Controls the amount of data printed to the terminal. Value 0 prints almost only performance data. Value 5 (-d) prints some progress messages. Value 10 (-dd) additionally prints all parameters of the tests. Value 15 (-ddd) additionally prints the APDU's exchanged with the card.


apduscript

public static Reference<Boolean> apduscript
Print apdutool lines in addition to the APDU contents. Useful if an apdutool script file must be created.

Default value is false, enabled with option -apdutool.


rounds_set

public static Reference<Boolean> rounds_set
Changed to true if rounds is set via an option. Then some automatic round number changes are disabled.


rounds

public static Reference<Integer> rounds
Number of rounds to run for various tests.

The default value is 1, set with option -rounds.


short_size

public static int short_size
Size of short (exponent) bignats in bytes. Used in many tests.

The default value is short_bignat_max_size, indirectly set via option -exp-size.


long_size

public static Reference<Integer> long_size
Size of long (base) bignats in bytes. Used in many tests.

The default value is long_bignat_max_size, set with option -size.


double_size

public static int double_size
Size of double-sized bignats in bytes.

The default value is long_bignat_max_size.


short_bit_size

public static Reference<Integer> short_bit_size
Size of short (exponent) bignats in bits. Used in many tests.

The default value is short_bignat_max_size* 8, set via option -exp-size.


long_size_set

public static Reference<Boolean> long_size_set
Changed to true, if long_size is set via an option. Then some automatic size changes are disabled.


short_bit_size_set

public static Reference<Boolean> short_bit_size_set
Changed to true, if short_bit_size is set via options. Then some automatic size changes are diabled.


vector_length

public static Reference<Integer> vector_length
Actual lenght of base and exponent vectors. Used in the vector tests and measurements.

The default value is max_vector_length, set with command-line option -vec-len.


pre_computed_base_factors

public static Reference<Integer> pre_computed_base_factors
Number of bases for which the factors are precomputed, see Vector.exponent_mod. Used for the (non-RSA) vector exponent checks and measurements.

The default value is max_vector_length, set via option -pre-base-fac.


keep_modulus

public static Reference<Boolean> keep_modulus
Use the same modulus for a number of successive tests to simulate the OV-chip use-case. Used in vector exponent measurements (both RSA and non-RSA, although for non-RSA it is irrelevant).

The default value is false, set via option -keep-mod.


start_size

public static Reference<Integer> start_size
Size to start with for those performance measurements that loop over a range of sizes. If left at the default value 0, those measurements select the smallest sensible value.

Set via option -start-size.


divisor_length

public static Reference<Integer> divisor_length
Length of the divisor as percentage of the divident length for the division test and measurement. For instance, set to 50 to measure the division with the divident twice as long as the divisor.

The default value is 100 (divident and divisor have the same length), set via option -div-length.


check_corner_cases

public static Reference<Boolean> check_corner_cases
Corner case checking. Check programmed corner cases if set. Enabled with option -check-corner-cases. Currently most checks do not support corner cases, the only exceptions being squared multiplication and short squared multiplication.


fixed_exponent

public static Reference<String> fixed_exponent
Exponent to be used. Set with option -fixed-exponent. Currently only supported by the RSA power checks started with -rsa-exp-check and -rsa-exp-perf.


test_card_applet_file

public static String test_card_applet_file
File name of the applet cap file. Used for applet installation. Currently a path relative to the sources directory.


test_card_applet_name

public static String test_card_applet_name
Applet ID of the test applet. Used for applet installation.


test_card_package_name

public static String test_card_package_name
Applet ID of the test applet package. Used for applet installation.


fix_inputs

public static BigInteger_inputs fix_inputs
Vector of input arguments from the command line. Normally tests and measurements use randomly created parameters. To repeat a test with some given numbers those numbers can be passed with the options -i and -hex. They are then stored in order in this vector. Many tests take their numbers from this vector, if there are enough numbers available.

Constructor Detail

State

protected State()
Static class, object creation disabled.

Method Detail

make_short_bit_size

public static int make_short_bit_size(int long_byte_size)
                               throws IllegalArgumentException
(Re-)Compute the short (exponent) bignat size in bits for the given long (base) size. Relies on Security_parameter for the estimation if short_bit_size has not explicitely set.

Parameters:
long_byte_size - effective long (base) size in bytes, without any potential Montgomery digits
Returns:
short (exponent) size in bits
Throws:
IllegalArgumentException - if long_byte_size is less than or equal to 0

make_short_size

public static int make_short_size(int long_byte_size)
(Re-)Compute a suitable short (exponent) bignat size in bytes for the given long (base) size. This method divides the result of make_short_bit_size(int) by 8 and changes the result such that the various side conditions are fulfiled.

Parameters:
long_byte_size - effective long (base) size in bytes, without any potential Montgomery digits
Returns:
short (exponent) size in bytes.

update_short_size

public static void update_short_size()
Update the short_size after the long_size has been changed. The new value of short_size will only depend on long_size if short_bit_size has not explicitely been set.