OpenSSL  1.0.1c
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Typedefs | Functions
bn_nist.c File Reference
#include "bn_lcl.h"
#include "cryptlib.h"

Go to the source code of this file.

Macros

#define BN_NIST_192_TOP   (192+BN_BITS2-1)/BN_BITS2
 
#define BN_NIST_224_TOP   (224+BN_BITS2-1)/BN_BITS2
 
#define BN_NIST_256_TOP   (256+BN_BITS2-1)/BN_BITS2
 
#define BN_NIST_384_TOP   (384+BN_BITS2-1)/BN_BITS2
 
#define BN_NIST_521_TOP   (521+BN_BITS2-1)/BN_BITS2
 
#define bn_cp_64(to, n, from, m)
 
#define bn_64_set_0(to, n)
 
#define bn_cp_32(to, n, from, m)   (to)[n] = (m>=0)?((from)[m]):0;
 
#define bn_32_set_0(to, n)   (to)[n] = (BN_ULONG)0;
 
#define nist_set_192(to, from, a1, a2, a3)
 
#define nist_set_224(to, from, a1, a2, a3, a4, a5, a6, a7)
 
#define nist_set_256(to, from, a1, a2, a3, a4, a5, a6, a7, a8)
 
#define nist_set_384(to, from, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
 
#define BN_NIST_521_RSHIFT   (521%BN_BITS2)
 
#define BN_NIST_521_LSHIFT   (BN_BITS2-BN_NIST_521_RSHIFT)
 
#define BN_NIST_521_TOP_MASK   ((BN_ULONG)BN_MASK2>>BN_NIST_521_LSHIFT)
 

Typedefs

typedef BN_ULONG(* bn_addsub_f )(BN_ULONG *, const BN_ULONG *, const BN_ULONG *, int)
 

Functions

const BIGNUMBN_get0_nist_prime_192 (void)
 
const BIGNUMBN_get0_nist_prime_224 (void)
 
const BIGNUMBN_get0_nist_prime_256 (void)
 
const BIGNUMBN_get0_nist_prime_384 (void)
 
const BIGNUMBN_get0_nist_prime_521 (void)
 
int BN_nist_mod_192 (BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
 
int BN_nist_mod_224 (BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
 
int BN_nist_mod_256 (BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
 
int BN_nist_mod_384 (BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
 
int BN_nist_mod_521 (BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
 

Macro Definition Documentation

#define bn_32_set_0 (   to,
 
)    (to)[n] = (BN_ULONG)0;

Definition at line 341 of file bn_nist.c.

#define bn_64_set_0 (   to,
 
)
Value:
{ \
bn_32_set_0(to, (n)*2); \
bn_32_set_0(to, (n)*2+1); \
}

Definition at line 335 of file bn_nist.c.

#define bn_cp_32 (   to,
  n,
  from,
 
)    (to)[n] = (m>=0)?((from)[m]):0;

Definition at line 340 of file bn_nist.c.

#define bn_cp_64 (   to,
  n,
  from,
 
)
Value:
{ \
bn_cp_32(to, (n)*2, from, (m)*2); \
bn_cp_32(to, (n)*2+1, from, (m)*2+1); \
}

Definition at line 330 of file bn_nist.c.

#define BN_NIST_192_TOP   (192+BN_BITS2-1)/BN_BITS2

Definition at line 63 of file bn_nist.c.

#define BN_NIST_224_TOP   (224+BN_BITS2-1)/BN_BITS2

Definition at line 64 of file bn_nist.c.

#define BN_NIST_256_TOP   (256+BN_BITS2-1)/BN_BITS2

Definition at line 65 of file bn_nist.c.

#define BN_NIST_384_TOP   (384+BN_BITS2-1)/BN_BITS2

Definition at line 66 of file bn_nist.c.

#define BN_NIST_521_LSHIFT   (BN_BITS2-BN_NIST_521_RSHIFT)

Definition at line 1039 of file bn_nist.c.

#define BN_NIST_521_RSHIFT   (521%BN_BITS2)

Definition at line 1038 of file bn_nist.c.

#define BN_NIST_521_TOP   (521+BN_BITS2-1)/BN_BITS2

Definition at line 67 of file bn_nist.c.

#define BN_NIST_521_TOP_MASK   ((BN_ULONG)BN_MASK2>>BN_NIST_521_LSHIFT)

Definition at line 1040 of file bn_nist.c.

#define nist_set_192 (   to,
  from,
  a1,
  a2,
  a3 
)
Value:
{ \
bn_cp_64(to, 0, from, (a3) - 3) \
bn_cp_64(to, 1, from, (a2) - 3) \
bn_cp_64(to, 2, from, (a1) - 3) \
}

Definition at line 349 of file bn_nist.c.

#define nist_set_224 (   to,
  from,
  a1,
  a2,
  a3,
  a4,
  a5,
  a6,
  a7 
)
Value:
{ \
bn_cp_32(to, 0, from, (a7) - 7) \
bn_cp_32(to, 1, from, (a6) - 7) \
bn_cp_32(to, 2, from, (a5) - 7) \
bn_cp_32(to, 3, from, (a4) - 7) \
bn_cp_32(to, 4, from, (a3) - 7) \
bn_cp_32(to, 5, from, (a2) - 7) \
bn_cp_32(to, 6, from, (a1) - 7) \
}

Definition at line 465 of file bn_nist.c.

#define nist_set_256 (   to,
  from,
  a1,
  a2,
  a3,
  a4,
  a5,
  a6,
  a7,
  a8 
)
Value:
{ \
bn_cp_32(to, 0, from, (a8) - 8) \
bn_cp_32(to, 1, from, (a7) - 8) \
bn_cp_32(to, 2, from, (a6) - 8) \
bn_cp_32(to, 3, from, (a5) - 8) \
bn_cp_32(to, 4, from, (a4) - 8) \
bn_cp_32(to, 5, from, (a3) - 8) \
bn_cp_32(to, 6, from, (a2) - 8) \
bn_cp_32(to, 7, from, (a1) - 8) \
}

Definition at line 618 of file bn_nist.c.

#define nist_set_384 (   to,
  from,
  a1,
  a2,
  a3,
  a4,
  a5,
  a6,
  a7,
  a8,
  a9,
  a10,
  a11,
  a12 
)
Value:
{ \
bn_cp_32(to, 0, from, (a12) - 12) \
bn_cp_32(to, 1, from, (a11) - 12) \
bn_cp_32(to, 2, from, (a10) - 12) \
bn_cp_32(to, 3, from, (a9) - 12) \
bn_cp_32(to, 4, from, (a8) - 12) \
bn_cp_32(to, 5, from, (a7) - 12) \
bn_cp_32(to, 6, from, (a6) - 12) \
bn_cp_32(to, 7, from, (a5) - 12) \
bn_cp_32(to, 8, from, (a4) - 12) \
bn_cp_32(to, 9, from, (a3) - 12) \
bn_cp_32(to, 10, from, (a2) - 12) \
bn_cp_32(to, 11, from, (a1) - 12) \
}

Definition at line 817 of file bn_nist.c.

Typedef Documentation

typedef BN_ULONG(* bn_addsub_f)(BN_ULONG *, const BN_ULONG *, const BN_ULONG *, int)

Definition at line 463 of file bn_nist.c.

Function Documentation

const BIGNUM* BN_get0_nist_prime_192 ( void  )

Definition at line 263 of file bn_nist.c.

const BIGNUM* BN_get0_nist_prime_224 ( void  )

Definition at line 268 of file bn_nist.c.

const BIGNUM* BN_get0_nist_prime_256 ( void  )

Definition at line 273 of file bn_nist.c.

const BIGNUM* BN_get0_nist_prime_384 ( void  )

Definition at line 278 of file bn_nist.c.

const BIGNUM* BN_get0_nist_prime_521 ( void  )

Definition at line 283 of file bn_nist.c.

int BN_nist_mod_192 ( BIGNUM r,
const BIGNUM a,
const BIGNUM field,
BN_CTX ctx 
)

Definition at line 356 of file bn_nist.c.

int BN_nist_mod_224 ( BIGNUM r,
const BIGNUM a,
const BIGNUM field,
BN_CTX ctx 
)

Definition at line 476 of file bn_nist.c.

int BN_nist_mod_256 ( BIGNUM r,
const BIGNUM a,
const BIGNUM field,
BN_CTX ctx 
)

Definition at line 630 of file bn_nist.c.

int BN_nist_mod_384 ( BIGNUM r,
const BIGNUM a,
const BIGNUM field,
BN_CTX ctx 
)

Definition at line 833 of file bn_nist.c.

int BN_nist_mod_521 ( BIGNUM r,
const BIGNUM a,
const BIGNUM field,
BN_CTX ctx 
)

Definition at line 1042 of file bn_nist.c.