summaryrefslogtreecommitdiff
path: root/sys/src/cmd/unix/drawterm/libsec/egencrypt.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2013-11-23 01:05:33 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2013-11-23 01:05:33 +0100
commit2f9ae0f8ac8610e13ced184847b57b87fe5db580 (patch)
treef9ad2223d518585a2cfe9ea1c73e1e37d07bf637 /sys/src/cmd/unix/drawterm/libsec/egencrypt.c
parentea5797c0731203c09ec5fb7172e77eab2750f1a9 (diff)
removing (outdated) drawterm
drawterm is much better maintained by russ cox, so removing this outdated copy. for a more recent version, go to: http://swtch.com/drawterm/
Diffstat (limited to 'sys/src/cmd/unix/drawterm/libsec/egencrypt.c')
-rw-r--r--sys/src/cmd/unix/drawterm/libsec/egencrypt.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/sys/src/cmd/unix/drawterm/libsec/egencrypt.c b/sys/src/cmd/unix/drawterm/libsec/egencrypt.c
deleted file mode 100644
index 9b6b12c6c..000000000
--- a/sys/src/cmd/unix/drawterm/libsec/egencrypt.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "os.h"
-#include <mp.h>
-#include <libsec.h>
-
-mpint*
-egencrypt(EGpub *pub, mpint *in, mpint *out)
-{
- mpint *m, *k, *gamma, *delta, *pm1;
- mpint *p = pub->p, *alpha = pub->alpha;
- int plen = mpsignif(p);
- int shift = ((plen+Dbits)/Dbits)*Dbits;
- // in libcrypt version, (int)(LENGTH(pub->p)*sizeof(NumType)*CHARBITS);
-
- if(out == nil)
- out = mpnew(0);
- pm1 = mpnew(0);
- m = mpnew(0);
- gamma = mpnew(0);
- delta = mpnew(0);
- mpmod(in, p, m);
- while(1){
- k = mprand(plen, genrandom, nil);
- if((mpcmp(mpone, k) <= 0) && (mpcmp(k, pm1) < 0))
- break;
- }
- mpexp(alpha, k, p, gamma);
- mpexp(pub->key, k, p, delta);
- mpmul(m, delta, delta);
- mpmod(delta, p, delta);
- mpleft(gamma, shift, out);
- mpadd(delta, out, out);
- mpfree(pm1);
- mpfree(m);
- mpfree(k);
- mpfree(gamma);
- mpfree(delta);
- return out;
-}