summaryrefslogtreecommitdiffstats
path: root/libtomcrypt/pk/dsa/dsa_shared_secret.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-07 10:40:37 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-07 10:41:04 +0200
commit115f165b6e3bb74f45e13a65c5f4f82f28664a2c (patch)
treeec55b63c736b5bef6061202c8bd31b08796fa2dc /libtomcrypt/pk/dsa/dsa_shared_secret.c
parent58a20b797e5a987fc8f7c5bea3be24d754908bf5 (diff)
downloadcryptodev-linux-115f165b6e3bb74f45e13a65c5f4f82f28664a2c.tar.gz
cryptodev-linux-115f165b6e3bb74f45e13a65c5f4f82f28664a2c.tar.xz
cryptodev-linux-115f165b6e3bb74f45e13a65c5f4f82f28664a2c.zip
Added a modified libtomcrypt with DSA and RSA algorithms.
Diffstat (limited to 'libtomcrypt/pk/dsa/dsa_shared_secret.c')
-rw-r--r--libtomcrypt/pk/dsa/dsa_shared_secret.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/libtomcrypt/pk/dsa/dsa_shared_secret.c b/libtomcrypt/pk/dsa/dsa_shared_secret.c
deleted file mode 100644
index ba7170f..0000000
--- a/libtomcrypt/pk/dsa/dsa_shared_secret.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* LibTomCrypt, modular cryptographic library -- Tom St Denis
- *
- * LibTomCrypt is a library that provides various cryptographic
- * algorithms in a highly modular and flexible manner.
- *
- * The library is free for all purposes without any express
- * guarantee it works.
- *
- * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
- */
-#include "tomcrypt.h"
-
-/**
- @file dsa_shared_secret.c
- DSA Crypto, Tom St Denis
-*/
-
-#ifdef LTC_MDSA
-
-/**
- Create a DSA shared secret between two keys
- @param private_key The private DSA key (the exponent)
- @param base The base of the exponentiation (allows this to be used for both encrypt and decrypt)
- @param public_key The public key
- @param out [out] Destination of the shared secret
- @param outlen [in/out] The max size and resulting size of the shared secret
- @return CRYPT_OK if successful
-*/
-int dsa_shared_secret(void *private_key, void *base,
- dsa_key *public_key,
- unsigned char *out, unsigned long *outlen)
-{
- unsigned long x;
- void *res;
- int err;
-
- LTC_ARGCHK(private_key != NULL);
- LTC_ARGCHK(public_key != NULL);
- LTC_ARGCHK(out != NULL);
- LTC_ARGCHK(outlen != NULL);
-
- /* make new point */
- if ((err = mp_init(&res)) != CRYPT_OK) {
- return err;
- }
-
- if ((err = mp_exptmod(base, private_key, public_key->p, res)) != CRYPT_OK) {
- mp_clear(res);
- return err;
- }
-
- x = (unsigned long)mp_unsigned_bin_size(res);
- if (*outlen < x) {
- *outlen = x;
- err = CRYPT_BUFFER_OVERFLOW;
- goto done;
- }
- zeromem(out, x);
- if ((err = mp_to_unsigned_bin(res, out + (x - mp_unsigned_bin_size(res)))) != CRYPT_OK) { goto done; }
-
- err = CRYPT_OK;
- *outlen = x;
-done:
- mp_clear(res);
- return err;
-}
-
-#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_shared_secret.c,v $ */
-/* $Revision: 1.9 $ */
-/* $Date: 2007/05/12 14:32:35 $ */
-