ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

tomcrypt.h File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include "basetsd.h"

Go to the source code of this file.

Data Structures

struct  rc2_key
struct  des_key
struct  des3_key
struct  aes_key
struct  md2_state
struct  rc4_prng
union  prng_state
struct  mp_int
struct  rsa_key

Defines

#define CONST64(a, b)   ((((ULONG64)(a)) << 32) | (b))
#define STORE32H(x, y)
#define LOAD32H(x, y)
#define ROR(x, y)
#define MIN(x, y)   ( ((x)<(y))?(x):(y) )
#define byte(x, n)   (((x) >> (8 * (n))) & 255)
#define DIGIT_BIT   28
#define MP_DIGIT_BIT   DIGIT_BIT
#define MP_MASK   ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))
#define MP_DIGIT_MAX   MP_MASK
#define MP_LT   -1 /* less than */
#define MP_EQ   0 /* equal to */
#define MP_GT   1 /* greater than */
#define MP_ZPOS   0 /* positive integer */
#define MP_NEG   1 /* negative */
#define MP_OKAY   0 /* ok result */
#define MP_MEM   -2 /* out of mem */
#define MP_VAL   -3 /* invalid input */
#define MP_RANGE   MP_VAL
#define MP_YES   1 /* yes response */
#define MP_NO   0 /* no response */
#define LTM_PRIME_BBS   0x0001 /* BBS style prime */
#define LTM_PRIME_SAFE   0x0002 /* Safe prime (p-1)/2 == prime */
#define LTM_PRIME_2MSB_OFF   0x0004 /* force 2nd MSB to 0 */
#define LTM_PRIME_2MSB_ON   0x0008 /* force 2nd MSB to 1 */
#define MP_PREC   64 /* default digits of precision */
#define MP_WARRAY   (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))
#define DIGIT(m, k)   ((m)->dp[(k)])
#define mp_iszero(a)   (((a)->used == 0) ? MP_YES : MP_NO)
#define mp_iseven(a)   (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
#define mp_isodd(a)   (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
#define PRIME_SIZE   256
#define mp_prime_random(a, t, size, bbs, cb, dat)   mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat)
#define mp_read_raw(mp, str, len)   mp_read_signed_bin((mp), (str), (len))
#define mp_raw_size(mp)   mp_signed_bin_size(mp)
#define mp_toraw(mp, str)   mp_to_signed_bin((mp), (str))
#define mp_read_mag(mp, str, len)   mp_read_unsigned_bin((mp), (str), (len))
#define mp_mag_size(mp)   mp_unsigned_bin_size(mp)
#define mp_tomag(mp, str)   mp_to_unsigned_bin((mp), (str))
#define mp_tobinary(M, S)   mp_toradix((M), (S), 2)
#define mp_tooctal(M, S)   mp_toradix((M), (S), 8)
#define mp_todecimal(M, S)   mp_toradix((M), (S), 10)
#define mp_tohex(M, S)   mp_toradix((M), (S), 16)
#define PK_PRIVATE   0 /* PK private keys */
#define PK_PUBLIC   1 /* PK public keys */
#define MIN_RSA_SIZE   384
#define MAX_RSA_SIZE   16384

Typedefs

typedef ULONG64 ulong64
typedef ULONG32 ulong32
typedef unsigned long mp_digit
typedef ulong64 mp_word
typedef int mp_err
typedef int ltm_prime_callback (unsigned char *dst, int len, void *dat)

Enumerations

enum  {
  CRYPT_OK = 0, CRYPT_ERROR, CRYPT_NOP, CRYPT_INVALID_KEYSIZE,
  CRYPT_INVALID_ROUNDS, CRYPT_FAIL_TESTVECTOR, CRYPT_BUFFER_OVERFLOW, CRYPT_INVALID_PACKET,
  CRYPT_INVALID_PRNGSIZE, CRYPT_ERROR_READPRNG, CRYPT_INVALID_CIPHER, CRYPT_INVALID_HASH,
  CRYPT_INVALID_PRNG, CRYPT_MEM, CRYPT_PK_TYPE_MISMATCH, CRYPT_PK_NOT_PRIVATE,
  CRYPT_INVALID_ARG, CRYPT_FILE_NOTFOUND, CRYPT_PK_INVALID_TYPE, CRYPT_PK_INVALID_SYSTEM,
  CRYPT_PK_DUP, CRYPT_PK_NOT_FOUND, CRYPT_PK_INVALID_SIZE, CRYPT_INVALID_PRIME_SIZE
}

Functions

int rc2_setup (const unsigned char *key, int keylen, int bits, int num_rounds, rc2_key *skey)
void rc2_ecb_encrypt (const unsigned char *pt, unsigned char *ct, rc2_key *key)
void rc2_ecb_decrypt (const unsigned char *ct, unsigned char *pt, rc2_key *key)
int des_setup (const unsigned char *key, int keylen, int num_rounds, des_key *skey)
void des_ecb_encrypt (const unsigned char *pt, unsigned char *ct, const des_key *key)
void des_ecb_decrypt (const unsigned char *ct, unsigned char *pt, const des_key *key)
int des3_setup (const unsigned char *key, int keylen, int num_rounds, des3_key *skey)
void des3_ecb_encrypt (const unsigned char *pt, unsigned char *ct, const des3_key *key)
void des3_ecb_decrypt (const unsigned char *ct, unsigned char *pt, const des3_key *key)
int aes_setup (const unsigned char *key, int keylen, int rounds, aes_key *skey)
void aes_ecb_encrypt (const unsigned char *pt, unsigned char *ct, aes_key *skey)
void aes_ecb_decrypt (const unsigned char *ct, unsigned char *pt, aes_key *skey)
int md2_init (md2_state *md)
int md2_process (md2_state *md, const unsigned char *buf, unsigned long len)
int md2_done (md2_state *md, unsigned char *hash)
int rc4_start (prng_state *prng)
int rc4_add_entropy (const unsigned char *buf, unsigned long len, prng_state *prng)
int rc4_ready (prng_state *prng)
unsigned long rc4_read (unsigned char *buf, unsigned long len, prng_state *prng)
charmp_error_to_string (int code)
int mp_init_multi (mp_int *mp,...)
void mp_clear_multi (mp_int *mp,...)
int mp_shrink (mp_int *a)
int mp_set_int (mp_int *a, unsigned long b)
unsigned long mp_get_int (const mp_int *a)
int mp_init_set (mp_int *a, mp_digit b)
int mp_init_set_int (mp_int *a, unsigned long b)
int mp_copy (const mp_int *a, mp_int *b)
int mp_init_copy (mp_int *a, const mp_int *b)
int mp_rand (mp_int *a, int digits)
int mp_xor (mp_int *a, mp_int *b, mp_int *c)
int mp_or (mp_int *a, mp_int *b, mp_int *c)
int mp_and (mp_int *a, mp_int *b, mp_int *c)
int mp_neg (mp_int *a, mp_int *b)
int mp_cmp (const mp_int *a, const mp_int *b)
int mp_add (mp_int *a, mp_int *b, mp_int *c)
int mp_sub (mp_int *a, mp_int *b, mp_int *c)
int mp_mul (const mp_int *a, const mp_int *b, mp_int *c)
int mp_mod (const mp_int *a, mp_int *b, mp_int *c)
int mp_cmp_d (const mp_int *a, mp_digit b)
int mp_sub_d (mp_int *a, mp_digit b, mp_int *c)
int mp_div_3 (mp_int *a, mp_int *c, mp_digit *d)
int mp_expt_d (mp_int *a, mp_digit b, mp_int *c)
int mp_addmod (mp_int *a, mp_int *b, mp_int *c, mp_int *d)
int mp_submod (mp_int *a, mp_int *b, mp_int *c, mp_int *d)
int mp_mulmod (const mp_int *a, const mp_int *b, mp_int *c, mp_int *d)
int mp_invmod (const mp_int *a, mp_int *b, mp_int *c)
int mp_gcd (const mp_int *a, const mp_int *b, mp_int *c)
int mp_exteuclid (mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3)
int mp_lcm (const mp_int *a, const mp_int *b, mp_int *c)
int mp_n_root (mp_int *a, mp_digit b, mp_int *c)
int mp_sqrt (mp_int *arg, mp_int *ret)
int mp_is_square (mp_int *arg, int *ret)
int mp_jacobi (mp_int *a, mp_int *n, int *c)
int mp_dr_is_modulus (mp_int *a)
int mp_reduce_is_2k (mp_int *a)
int mp_exptmod (const mp_int *a, const mp_int *b, mp_int *c, mp_int *d)
int mp_prime_fermat (mp_int *a, mp_int *b, int *result)
int mp_prime_rabin_miller_trials (int size)
int mp_prime_next_prime (mp_int *a, int t, int bbs_style)
int mp_prime_random_ex (mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat)
int mp_count_bits (const mp_int *a)
int mp_unsigned_bin_size (const mp_int *a)
int mp_read_unsigned_bin (mp_int *a, const unsigned char *b, int c)
int mp_to_unsigned_bin (const mp_int *a, unsigned char *b)
int mp_read_signed_bin (mp_int *a, unsigned char *b, int c)
int mp_to_signed_bin (mp_int *a, unsigned char *b)
int mp_read_radix (mp_int *a, char *str, int radix)
int mp_toradix (mp_int *a, char *str, int radix)
int mp_toradix_n (mp_int *a, char *str, int radix, int maxlen)
int mp_radix_size (mp_int *a, int radix, int *size)
int mp_fread (mp_int *a, int radix, FILE *stream)
int mp_fwrite (mp_int *a, int radix, FILE *stream)
int rsa_make_key (int size, long e, rsa_key *key)
int rsa_exptmod (const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen, int which, rsa_key *key)
void rsa_free (rsa_key *key)

Variables

const charmp_s_rmap

Generated on Mon May 28 2012 05:18:03 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.