summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-06 20:55:46 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-06 20:55:46 +0000
commit2fc106d2101edd80a7ba8cdcc9f49522619ba9cf (patch)
tree832842d3b113734e45d8a5391027ceb93299e899 /src/common
parent40a5d6055e0921ec6b9e5000d7b33c4599c6e22c (diff)
downloadtor-2fc106d2101edd80a7ba8cdcc9f49522619ba9cf.tar.gz
tor-2fc106d2101edd80a7ba8cdcc9f49522619ba9cf.zip
Force hybrid encryption on for key negotiation
svn:r1509
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.c6
-rw-r--r--src/common/crypto.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index ebbb5b28c2..c6f5b55205 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -534,11 +534,13 @@ int crypto_pk_private_sign_digest(crypto_pk_env_t *env, const unsigned char *fro
* The beginning of the source data prefixed with a 16-symmetric key,
* padded and encrypted with the public key; followed by the rest of
* the source data encrypted in AES-CTR mode with the symmetric key.
+ *
+ * DOCDOC force.
*/
int crypto_pk_public_hybrid_encrypt(crypto_pk_env_t *env,
const unsigned char *from,
int fromlen, unsigned char *to,
- int padding)
+ int padding, int force)
{
int overhead, pkeylen, outlen, r, symlen;
crypto_cipher_env_t *cipher = NULL;
@@ -552,7 +554,7 @@ int crypto_pk_public_hybrid_encrypt(crypto_pk_env_t *env,
if (padding == PK_NO_PADDING && fromlen < pkeylen)
return -1;
- if (fromlen+overhead <= pkeylen) {
+ if (!force && fromlen+overhead <= pkeylen) {
/* It all fits in a single encrypt. */
return crypto_pk_public_encrypt(env,from,fromlen,to,padding);
}
diff --git a/src/common/crypto.h b/src/common/crypto.h
index 94a18abf2e..d9da82a05f 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -64,7 +64,7 @@ int crypto_pk_public_checksig(crypto_pk_env_t *env, const unsigned char *from, i
int crypto_pk_public_checksig_digest(crypto_pk_env_t *env, const unsigned char *data, int datalen, const unsigned char *sig, int siglen);
int crypto_pk_public_hybrid_encrypt(crypto_pk_env_t *env,
const unsigned char *from, int fromlen,
- unsigned char *to, int padding);
+ unsigned char *to, int padding, int force);
int crypto_pk_private_hybrid_decrypt(crypto_pk_env_t *env,
const unsigned char *from, int fromlen,
unsigned char *to,int padding);