Mercurial > dropbear
comparison libtomcrypt/src/pk/katja/katja_exptmod.c @ 1511:5916af64acd4 fuzz
merge from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 17 Feb 2018 19:29:51 +0800 |
parents | 6dba84798cd5 |
children |
comparison
equal
deleted
inserted
replaced
1457:32f990cc96b1 | 1511:5916af64acd4 |
---|---|
3 * LibTomCrypt is a library that provides various cryptographic | 3 * LibTomCrypt is a library that provides various cryptographic |
4 * algorithms in a highly modular and flexible manner. | 4 * algorithms in a highly modular and flexible manner. |
5 * | 5 * |
6 * The library is free for all purposes without any express | 6 * The library is free for all purposes without any express |
7 * guarantee it works. | 7 * guarantee it works. |
8 * | |
9 * Tom St Denis, [email protected], http://libtom.org | |
10 */ | 8 */ |
11 #include "tomcrypt.h" | 9 #include "tomcrypt.h" |
12 | 10 |
13 /** | 11 /** |
14 @file katja_exptmod.c | 12 @file katja_exptmod.c |
15 Katja LTC_PKCS-style exptmod, Tom St Denis | 13 Katja PKCS-style exptmod, Tom St Denis |
16 */ | 14 */ |
17 | 15 |
18 #ifdef MKAT | 16 #ifdef LTC_MKAT |
19 | 17 |
20 /** | 18 /** |
21 Compute an RSA modular exponentiation | 19 Compute an RSA modular exponentiation |
22 @param in The input data to send into RSA | 20 @param in The input data to send into RSA |
23 @param inlen The length of the input (octets) | 21 @param inlen The length of the input (octets) |
24 @param out [out] The destination | 22 @param out [out] The destination |
25 @param outlen [in/out] The max size and resulting size of the output | 23 @param outlen [in/out] The max size and resulting size of the output |
26 @param which Which exponent to use, e.g. PK_PRIVATE or PK_PUBLIC | 24 @param which Which exponent to use, e.g. PK_PRIVATE or PK_PUBLIC |
27 @param key The RSA key to use | 25 @param key The RSA key to use |
28 @return CRYPT_OK if successful | 26 @return CRYPT_OK if successful |
29 */ | 27 */ |
30 int katja_exptmod(const unsigned char *in, unsigned long inlen, | 28 int katja_exptmod(const unsigned char *in, unsigned long inlen, |
31 unsigned char *out, unsigned long *outlen, int which, | 29 unsigned char *out, unsigned long *outlen, int which, |
32 katja_key *key) | 30 katja_key *key) |
33 { | 31 { |
34 void *tmp, *tmpa, *tmpb; | 32 void *tmp, *tmpa, *tmpb; |
37 | 35 |
38 LTC_ARGCHK(in != NULL); | 36 LTC_ARGCHK(in != NULL); |
39 LTC_ARGCHK(out != NULL); | 37 LTC_ARGCHK(out != NULL); |
40 LTC_ARGCHK(outlen != NULL); | 38 LTC_ARGCHK(outlen != NULL); |
41 LTC_ARGCHK(key != NULL); | 39 LTC_ARGCHK(key != NULL); |
42 | 40 |
43 /* is the key of the right type for the operation? */ | 41 /* is the key of the right type for the operation? */ |
44 if (which == PK_PRIVATE && (key->type != PK_PRIVATE)) { | 42 if (which == PK_PRIVATE && (key->type != PK_PRIVATE)) { |
45 return CRYPT_PK_NOT_PRIVATE; | 43 return CRYPT_PK_NOT_PRIVATE; |
46 } | 44 } |
47 | 45 |
108 return err; | 106 return err; |
109 } | 107 } |
110 | 108 |
111 #endif | 109 #endif |
112 | 110 |
113 /* $Source$ */ | 111 /* ref: $Format:%D$ */ |
114 /* $Revision$ */ | 112 /* git commit: $Format:%H$ */ |
115 /* $Date$ */ | 113 /* commit time: $Format:%ai$ */ |