Mercurial > dropbear
diff libtomcrypt/src/pk/katja/katja_encrypt_key.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 |
line wrap: on
line diff
--- a/libtomcrypt/src/pk/katja/katja_encrypt_key.c Tue Jan 23 23:27:40 2018 +0800 +++ b/libtomcrypt/src/pk/katja/katja_encrypt_key.c Sat Feb 17 19:29:51 2018 +0800 @@ -5,20 +5,18 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, [email protected], http://libtom.org */ #include "tomcrypt.h" /** @file katja_encrypt_key.c - Katja LTC_PKCS-style OAEP encryption, Tom St Denis -*/ + Katja PKCS-style OAEP encryption, Tom St Denis +*/ -#ifdef MKAT +#ifdef LTC_MKAT /** - (LTC_PKCS #1 v2.0) OAEP pad then encrypt + (PKCS #1 v2.0) OAEP pad then encrypt @param in The plaintext @param inlen The length of the plaintext (octets) @param out [out] The ciphertext @@ -30,7 +28,7 @@ @param hash_idx The index of the desired hash @param key The Katja key to encrypt to @return CRYPT_OK if successful -*/ +*/ int katja_encrypt_key(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen, const unsigned char *lparam, unsigned long lparamlen, @@ -38,12 +36,12 @@ { unsigned long modulus_bitlen, modulus_bytelen, x; int err; - + LTC_ARGCHK(in != NULL); LTC_ARGCHK(out != NULL); LTC_ARGCHK(outlen != NULL); LTC_ARGCHK(key != NULL); - + /* valid prng and hash ? */ if ((err = prng_is_valid(prng_idx)) != CRYPT_OK) { return err; @@ -51,7 +49,7 @@ if ((err = hash_is_valid(hash_idx)) != CRYPT_OK) { return err; } - + /* get modulus len in bits */ modulus_bitlen = mp_count_bits((key->N)); @@ -70,11 +68,11 @@ /* OAEP pad the key */ x = *outlen; - if ((err = pkcs_1_oaep_encode(in, inlen, lparam, - lparamlen, modulus_bitlen, prng, prng_idx, hash_idx, + if ((err = pkcs_1_oaep_encode(in, inlen, lparam, + lparamlen, modulus_bitlen, prng, prng_idx, hash_idx, out, &x)) != CRYPT_OK) { return err; - } + } /* Katja exptmod the OAEP pad */ return katja_exptmod(out, x, out, outlen, PK_PUBLIC, key); @@ -82,6 +80,6 @@ #endif /* LTC_MRSA */ -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */