annotate mycrypt_pk.h @ 164:cd1143579f00 libtomcrypt LTC_DB_0.44

mpi.c isn't needed if we're using libtommath seperately
author Matt Johnston <matt@ucc.asn.au>
date Sun, 02 Jan 2005 17:19:46 +0000
parents c2b93763dac9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 /* ---- NUMBER THEORY ---- */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 #ifdef MPI
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
4 #include "ltc_tommath.h"
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 /* in/out macros */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7 #define OUTPUT_BIGNUM(num, out, y, z) \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 { \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 if ((y + 4) > *outlen) { return CRYPT_BUFFER_OVERFLOW; } \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 z = (unsigned long)mp_unsigned_bin_size(num); \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11 STORE32L(z, out+y); \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 y += 4; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 if ((y + z) > *outlen) { return CRYPT_BUFFER_OVERFLOW; } \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 if ((err = mp_to_unsigned_bin(num, out+y)) != MP_OKAY) { return mpi_to_ltc_error(err); } \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 y += z; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 }
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 #define INPUT_BIGNUM(num, in, x, y, inlen) \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20 { \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 /* load value */ \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 if ((y + 4) > inlen) { \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 err = CRYPT_INVALID_PACKET; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24 goto error; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
25 } \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
26 LOAD32L(x, in+y); \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 y += 4; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 /* sanity check... */ \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30 if ((x+y) > inlen) { \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31 err = CRYPT_INVALID_PACKET; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32 goto error; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33 } \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
34 \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35 /* load it */ \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
36 if ((err = mp_read_unsigned_bin(num, (unsigned char *)in+y, (int)x)) != MP_OKAY) {\
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
37 err = mpi_to_ltc_error(err); \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38 goto error; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39 } \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
40 y += x; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
41 if ((err = mp_shrink(num)) != MP_OKAY) { \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
42 err = mpi_to_ltc_error(err); \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
43 goto error; \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
44 } \
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45 }
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
47 int is_prime(mp_int *, int *);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
48 int rand_prime(mp_int *N, long len, prng_state *prng, int wprng);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50 #else
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51 #ifdef MRSA
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52 #error RSA requires the big int library
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
53 #endif
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
54 #ifdef MECC
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
55 #error ECC requires the big int library
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56 #endif
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
57 #ifdef MDH
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
58 #error DH requires the big int library
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
59 #endif
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60 #ifdef MDSA
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61 #error DSA requires the big int library
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
62 #endif
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
63 #endif /* MPI */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
64
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
65
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
66 /* ---- PUBLIC KEY CRYPTO ---- */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
67
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
68 #define PK_PRIVATE 0 /* PK private keys */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
69 #define PK_PUBLIC 1 /* PK public keys */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
70
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
71 /* ---- PACKET ---- */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
72 #ifdef PACKET
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
73
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
74 void packet_store_header(unsigned char *dst, int section, int subsection);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
75 int packet_valid_header(unsigned char *src, int section, int subsection);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
76
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
77 #endif
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
78
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
79
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
80 /* ---- RSA ---- */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
81 #ifdef MRSA
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
82
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
83 /* Min and Max RSA key sizes (in bits) */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
84 #define MIN_RSA_SIZE 1024
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
85 #define MAX_RSA_SIZE 4096
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
86
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
87 /* Stack required for temps (plus padding) */
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
88 // #define RSA_STACK (8 + (MAX_RSA_SIZE/8))
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
89
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
90 typedef struct Rsa_key {
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
91 int type;
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
92 mp_int e, d, N, p, q, qP, dP, dQ;
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
93 } rsa_key;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
94
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
95 int rsa_make_key(prng_state *prng, int wprng, int size, long e, rsa_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
96
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
97 int rsa_exptmod(const unsigned char *in, unsigned long inlen,
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
98 unsigned char *out, unsigned long *outlen, int which,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
99 prng_state *prng, int prng_idx,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
100 rsa_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
101
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
102 #ifdef RSA_TIMING
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
103
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
104 int tim_exptmod(prng_state *prng, int prng_idx,
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
105 mp_int *c, mp_int *e, mp_int *d, mp_int *n, mp_int *m);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
106
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
107 #else
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
108
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
109 #define tim_exptmod(prng, prng_idx, c, e, d, n, m) mpi_to_ltc_error(mp_exptmod(c, d, n, m))
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
110
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
111 #endif
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
112
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
113 void rsa_free(rsa_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
114
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
115 /* These use PKCS #1 v2.0 padding */
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
116 int rsa_encrypt_key(const unsigned char *inkey, unsigned long inlen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
117 unsigned char *outkey, unsigned long *outlen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
118 const unsigned char *lparam, unsigned long lparamlen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
119 prng_state *prng, int prng_idx, int hash_idx, rsa_key *key);
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
120
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
121 int rsa_decrypt_key(const unsigned char *in, unsigned long inlen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
122 unsigned char *outkey, unsigned long *keylen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
123 const unsigned char *lparam, unsigned long lparamlen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
124 prng_state *prng, int prng_idx,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
125 int hash_idx, int *res,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
126 rsa_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
127
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
128 int rsa_sign_hash(const unsigned char *msghash, unsigned long msghashlen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
129 unsigned char *sig, unsigned long *siglen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
130 prng_state *prng, int prng_idx,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
131 int hash_idx, unsigned long saltlen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
132 rsa_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
133
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
134 int rsa_verify_hash(const unsigned char *sig, unsigned long siglen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
135 const unsigned char *msghash, unsigned long msghashlen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
136 prng_state *prng, int prng_idx,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
137 int hash_idx, unsigned long saltlen,
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
138 int *stat, rsa_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
139
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
140 /* these use PKCS #1 v1.5 padding */
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
141 int rsa_v15_encrypt_key(const unsigned char *inkey, unsigned long inlen,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
142 unsigned char *outkey, unsigned long *outlen,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
143 prng_state *prng, int prng_idx,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
144 rsa_key *key);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
145
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
146 int rsa_v15_decrypt_key(const unsigned char *in, unsigned long inlen,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
147 unsigned char *outkey, unsigned long keylen,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
148 prng_state *prng, int prng_idx,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
149 int *res, rsa_key *key);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
150
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
151 int rsa_v15_sign_hash(const unsigned char *msghash, unsigned long msghashlen,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
152 unsigned char *sig, unsigned long *siglen,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
153 prng_state *prng, int prng_idx,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
154 int hash_idx, rsa_key *key);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
155
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
156 int rsa_v15_verify_hash(const unsigned char *sig, unsigned long siglen,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
157 const unsigned char *msghash, unsigned long msghashlen,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
158 prng_state *prng, int prng_idx,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
159 int hash_idx, int *stat,
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
160 rsa_key *key);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
161
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
162
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
163 /* PKCS #1 import/export */
15
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
164 int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key);
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
165 int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key);
6362d3854bb4 0.96 release of LibTomCrypt
Matt Johnston <matt@ucc.asn.au>
parents: 0
diff changeset
166
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
167 #endif
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
168
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
169 /* ---- DH Routines ---- */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
170 #ifdef MDH
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
171
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
172 typedef struct Dh_key {
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
173 int idx, type;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
174 mp_int x, y;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
175 } dh_key;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
176
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
177 int dh_test(void);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
178 void dh_sizes(int *low, int *high);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
179 int dh_get_size(dh_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
180
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
181 int dh_make_key(prng_state *prng, int wprng, int keysize, dh_key *key);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
182 void dh_free(dh_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
183
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
184 int dh_export(unsigned char *out, unsigned long *outlen, int type, dh_key *key);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
185 int dh_import(const unsigned char *in, unsigned long inlen, dh_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
186
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
187 int dh_shared_secret(dh_key *private_key, dh_key *public_key,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
188 unsigned char *out, unsigned long *outlen);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
189
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
190 int dh_encrypt_key(const unsigned char *inkey, unsigned long keylen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
191 unsigned char *out, unsigned long *len,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
192 prng_state *prng, int wprng, int hash,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
193 dh_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
194
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
195 int dh_decrypt_key(const unsigned char *in, unsigned long inlen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
196 unsigned char *outkey, unsigned long *keylen,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
197 dh_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
198
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
199 int dh_sign_hash(const unsigned char *in, unsigned long inlen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
200 unsigned char *out, unsigned long *outlen,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
201 prng_state *prng, int wprng, dh_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
202
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
203 int dh_verify_hash(const unsigned char *sig, unsigned long siglen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
204 const unsigned char *hash, unsigned long hashlen,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
205 int *stat, dh_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
206
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
207
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
208 #endif
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
209
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
210 /* ---- ECC Routines ---- */
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
211 #ifdef MECC
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
212 typedef struct {
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
213 mp_int x, y;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
214 } ecc_point;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
215
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
216 typedef struct {
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
217 int type, idx;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
218 ecc_point pubkey;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
219 mp_int k;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
220 } ecc_key;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
221
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
222 int ecc_test(void);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
223 void ecc_sizes(int *low, int *high);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
224 int ecc_get_size(ecc_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
225
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
226 int ecc_make_key(prng_state *prng, int wprng, int keysize, ecc_key *key);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
227 void ecc_free(ecc_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
228
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
229 int ecc_export(unsigned char *out, unsigned long *outlen, int type, ecc_key *key);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
230 int ecc_import(const unsigned char *in, unsigned long inlen, ecc_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
231
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
232 int ecc_shared_secret(ecc_key *private_key, ecc_key *public_key,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
233 unsigned char *out, unsigned long *outlen);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
234
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
235 int ecc_encrypt_key(const unsigned char *inkey, unsigned long keylen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
236 unsigned char *out, unsigned long *len,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
237 prng_state *prng, int wprng, int hash,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
238 ecc_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
239
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
240 int ecc_decrypt_key(const unsigned char *in, unsigned long inlen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
241 unsigned char *outkey, unsigned long *keylen,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
242 ecc_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
243
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
244 int ecc_sign_hash(const unsigned char *in, unsigned long inlen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
245 unsigned char *out, unsigned long *outlen,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
246 prng_state *prng, int wprng, ecc_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
247
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
248 int ecc_verify_hash(const unsigned char *sig, unsigned long siglen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
249 const unsigned char *hash, unsigned long hashlen,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
250 int *stat, ecc_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
251 #endif
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
252
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
253 #ifdef MDSA
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
254
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
255 typedef struct {
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
256 int type, qord;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
257 mp_int g, q, p, x, y;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
258 } dsa_key;
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
259
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
260 int dsa_make_key(prng_state *prng, int wprng, int group_size, int modulus_size, dsa_key *key);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
261 void dsa_free(dsa_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
262
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
263 int dsa_sign_hash(const unsigned char *in, unsigned long inlen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
264 unsigned char *out, unsigned long *outlen,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
265 prng_state *prng, int wprng, dsa_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
266
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
267 int dsa_verify_hash(const unsigned char *sig, unsigned long siglen,
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
268 const unsigned char *hash, unsigned long inlen,
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
269 int *stat, dsa_key *key);
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
270
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
271 int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
272
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
273 int dsa_export(unsigned char *out, unsigned long *outlen, int type, dsa_key *key);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
274
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
275 int dsa_verify_key(dsa_key *key, int *stat);
0
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
276
d7da3b1e1540 put back the 0.95 makefile which was inadvertently merged over
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
277 #endif
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
278
147
c2b93763dac9 Fixes for it to compile and work nicely with Dropbear.
Matt Johnston <matt@ucc.asn.au>
parents: 143
diff changeset
279 /* ifdef added by matt - a bit of a hack */
c2b93763dac9 Fixes for it to compile and work nicely with Dropbear.
Matt Johnston <matt@ucc.asn.au>
parents: 143
diff changeset
280 #ifdef MPI
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
281 /* DER handling */
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
282 int der_encode_integer(mp_int *num, unsigned char *out, unsigned long *outlen);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
283 int der_decode_integer(const unsigned char *in, unsigned long *inlen, mp_int *num);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
284 int der_length_integer(mp_int *num, unsigned long *len);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
285 int der_put_multi_integer(unsigned char *dst, unsigned long *outlen, mp_int *num, ...);
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
286 int der_get_multi_integer(const unsigned char *src, unsigned long *inlen, mp_int *num, ...);
147
c2b93763dac9 Fixes for it to compile and work nicely with Dropbear.
Matt Johnston <matt@ucc.asn.au>
parents: 143
diff changeset
287 #endif
143
5d99163f7e32 import of libtomcrypt 0.99
Matt Johnston <matt@ucc.asn.au>
parents: 15
diff changeset
288