3
|
1 /* PKCS Header Info */ |
|
2 |
|
3 /* ===> PKCS #1 -- RSA Cryptography <=== */ |
|
4 #ifdef PKCS_1 |
|
5 |
|
6 int pkcs_1_mgf1(const unsigned char *seed, unsigned long seedlen, |
|
7 int hash_idx, |
|
8 unsigned char *mask, unsigned long masklen); |
|
9 |
15
|
10 int pkcs_1_i2osp(mp_int *n, unsigned long modulus_len, unsigned char *out); |
|
11 int pkcs_1_os2ip(mp_int *n, unsigned char *in, unsigned long inlen); |
|
12 |
|
13 /* *** v2.0 padding */ |
3
|
14 int pkcs_1_oaep_encode(const unsigned char *msg, unsigned long msglen, |
|
15 const unsigned char *lparam, unsigned long lparamlen, |
15
|
16 unsigned long modulus_bitlen, prng_state *prng, |
|
17 int prng_idx, int hash_idx, |
3
|
18 unsigned char *out, unsigned long *outlen); |
|
19 |
|
20 int pkcs_1_oaep_decode(const unsigned char *msg, unsigned long msglen, |
|
21 const unsigned char *lparam, unsigned long lparamlen, |
|
22 unsigned long modulus_bitlen, int hash_idx, |
15
|
23 unsigned char *out, unsigned long *outlen, |
|
24 int *res); |
3
|
25 |
|
26 int pkcs_1_pss_encode(const unsigned char *msghash, unsigned long msghashlen, |
15
|
27 unsigned long saltlen, prng_state *prng, |
|
28 int prng_idx, int hash_idx, |
3
|
29 unsigned long modulus_bitlen, |
|
30 unsigned char *out, unsigned long *outlen); |
|
31 |
|
32 int pkcs_1_pss_decode(const unsigned char *msghash, unsigned long msghashlen, |
|
33 const unsigned char *sig, unsigned long siglen, |
|
34 unsigned long saltlen, int hash_idx, |
|
35 unsigned long modulus_bitlen, int *res); |
|
36 |
15
|
37 /* *** v1.5 padding */ |
|
38 /* encryption padding */ |
|
39 int pkcs_1_v15_es_encode(const unsigned char *msg, unsigned long msglen, |
|
40 unsigned long modulus_bitlen, |
|
41 prng_state *prng, int prng_idx, |
|
42 unsigned char *out, unsigned long *outlen); |
|
43 |
|
44 /* note "outlen" is fixed, you have to tell this decoder how big |
|
45 * the original message was. Unlike the OAEP decoder it cannot auto-detect it. |
|
46 */ |
|
47 int pkcs_1_v15_es_decode(const unsigned char *msg, unsigned long msglen, |
|
48 unsigned long modulus_bitlen, |
|
49 unsigned char *out, unsigned long outlen, |
|
50 int *res); |
|
51 |
|
52 /* signature padding */ |
|
53 int pkcs_1_v15_sa_encode(const unsigned char *msghash, unsigned long msghashlen, |
|
54 int hash_idx, unsigned long modulus_bitlen, |
|
55 unsigned char *out, unsigned long *outlen); |
|
56 |
|
57 int pkcs_1_v15_sa_decode(const unsigned char *msghash, unsigned long msghashlen, |
|
58 const unsigned char *sig, unsigned long siglen, |
|
59 int hash_idx, unsigned long modulus_bitlen, |
|
60 int *res); |
3
|
61 |
|
62 |
|
63 #endif /* PKCS_1 */ |
|
64 |
|
65 /* ===> PKCS #5 -- Password Based Cryptography <=== */ |
|
66 #ifdef PKCS_5 |
|
67 |
|
68 /* Algorithm #1 (old) */ |
|
69 int pkcs_5_alg1(const unsigned char *password, unsigned long password_len, |
|
70 const unsigned char *salt, |
|
71 int iteration_count, int hash_idx, |
|
72 unsigned char *out, unsigned long *outlen); |
|
73 |
|
74 /* Algorithm #2 (new) */ |
|
75 int pkcs_5_alg2(const unsigned char *password, unsigned long password_len, |
|
76 const unsigned char *salt, unsigned long salt_len, |
|
77 int iteration_count, int hash_idx, |
|
78 unsigned char *out, unsigned long *outlen); |
|
79 |
|
80 #endif /* PKCS_5 */ |