[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Force hybrid encryption on for key negotiation



Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv31210/src/common

Modified Files:
	crypto.c crypto.h 
Log Message:
Force hybrid encryption on for key negotiation

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- crypto.c	6 Apr 2004 20:16:11 -0000	1.72
+++ crypto.c	6 Apr 2004 20:55:46 -0000	1.73
@@ -534,11 +534,13 @@
  *   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 @@
   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);
   }

Index: crypto.h
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- crypto.h	6 Apr 2004 03:44:35 -0000	1.38
+++ crypto.h	6 Apr 2004 20:55:46 -0000	1.39
@@ -64,7 +64,7 @@
 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);