summaryrefslogtreecommitdiff
path: root/beecrypt/dlkp.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-09-18 19:23:46 +0000
committerjbj <devnull@localhost>2001-09-18 19:23:46 +0000
commit78de87f74cc1a9cfffb9a198509f2e6697b8bca8 (patch)
treec2be7e2aeda8290b9108dba15750ee5af72f9d4f /beecrypt/dlkp.c
parent38edc494525ccdf25f11ed2288378ba640928900 (diff)
downloadrpm-78de87f74cc1a9cfffb9a198509f2e6697b8bca8.tar.gz
Initial revision
CVS patchset: 5051 CVS date: 2001/09/18 19:23:46
Diffstat (limited to 'beecrypt/dlkp.c')
-rw-r--r--beecrypt/dlkp.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/beecrypt/dlkp.c b/beecrypt/dlkp.c
new file mode 100644
index 000000000..231e53638
--- /dev/null
+++ b/beecrypt/dlkp.c
@@ -0,0 +1,54 @@
+/*
+ * dlkp.c
+ *
+ * Discrete Logarithm Keypair, code
+ *
+ * <conformance statement for IEEE P1363 needed here>
+ *
+ * Copyright (c) 2000 Virtual Unlimited B.V.
+ *
+ * Author: Bob Deblier <bob@virtualunlimited.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#define BEECRYPT_DLL_EXPORT
+
+#include "dlkp.h"
+
+void dlkp_pPair(dlkp_p* dp, randomGeneratorContext* rc, const dldp_p* param)
+{
+ /* copy the parameters */
+ dldp_pCopy(&dp->param, param);
+
+ dldp_pPair((const dldp_p*) param, rc, &dp->x, &dp->y);
+}
+
+void dlkp_pFree(dlkp_p* dp)
+{
+ dldp_pFree(&dp->param);
+
+ mp32nfree(&dp->y);
+ mp32nfree(&dp->x);
+}
+
+void dlkp_pCopy(dlkp_p* dst, const dlkp_p* src)
+{
+ dldp_pCopy(&dst->param, &src->param);
+
+ mp32nset(&dst->y, src->y.size, src->y.data);
+ mp32nset(&dst->x, src->x.size, src->x.data);
+}