OpenSSL  1.0.1c
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Macros | Functions
ectest.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "../e_os.h"
#include <string.h>
#include <time.h>
#include <openssl/ec.h>
#include <openssl/engine.h>
#include <openssl/err.h>
#include <openssl/obj_mac.h>
#include <openssl/objects.h>
#include <openssl/rand.h>
#include <openssl/bn.h>
#include <openssl/opensslconf.h>

Go to the source code of this file.

Classes

struct  nistp_test_params
 

Macros

#define ABORT
 
#define TIMING_BASE_PT   0
 
#define TIMING_RAND_PT   1
 
#define TIMING_SIMUL   2
 
#define CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable)
 
#define CHAR2_CURVE_TEST(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable)
 

Functions

void nistp_single_test (const struct nistp_test_params *test)
 
void nistp_tests ()
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

#define ABORT
Value:
do { \
fflush(stdout); \
fprintf(stderr, "%s:%d: ABORT\n", __FILE__, __LINE__); \
ERR_print_errors_fp(stderr); \
EXIT(1); \
} while (0)

Definition at line 104 of file ectest.c.

#define CHAR2_CURVE_TEST (   _name,
  _p,
  _a,
  _b,
  _x,
  _y,
  _y_bit,
  _order,
  _cof,
  _degree,
  _variable 
)
Value:
if (!BN_hex2bn(&p, _p)) ABORT; \
if (!BN_hex2bn(&a, _a)) ABORT; \
if (!BN_hex2bn(&b, _b)) ABORT; \
if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT; \
CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \
fprintf(stdout, "verify degree ..."); \
if (EC_GROUP_get_degree(group) != _degree) ABORT; \
fprintf(stdout, " ok\n"); \
group_order_tests(group); \
if (!(_variable = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; \
if (!EC_GROUP_copy(_variable, group)) ABORT; \

Definition at line 767 of file ectest.c.

#define CHAR2_CURVE_TEST_INTERNAL (   _name,
  _p,
  _a,
  _b,
  _x,
  _y,
  _y_bit,
  _order,
  _cof,
  _degree,
  _variable 
)
Value:
if (!BN_hex2bn(&x, _x)) ABORT; \
if (!BN_hex2bn(&y, _y)) ABORT; \
if (!EC_POINT_set_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \
if (!BN_hex2bn(&z, _order)) ABORT; \
if (!BN_hex2bn(&cof, _cof)) ABORT; \
if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \
fprintf(stdout, "\n%s -- Generator:\n x = 0x", _name); \
BN_print_fp(stdout, x); \
fprintf(stdout, "\n y = 0x"); \
BN_print_fp(stdout, y); \
fprintf(stdout, "\n");

Definition at line 752 of file ectest.c.

#define TIMING_BASE_PT   0

Definition at line 111 of file ectest.c.

#define TIMING_RAND_PT   1

Definition at line 112 of file ectest.c.

#define TIMING_SIMUL   2

Definition at line 113 of file ectest.c.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 1449 of file ectest.c.

void nistp_single_test ( const struct nistp_test_params test)

Definition at line 1333 of file ectest.c.

void nistp_tests ( )

Definition at line 1436 of file ectest.c.