summaryrefslogtreecommitdiff
path: root/lib/dns/sec/dnssafe/bigsmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/sec/dnssafe/bigsmod.c')
-rw-r--r--lib/dns/sec/dnssafe/bigsmod.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/dns/sec/dnssafe/bigsmod.c b/lib/dns/sec/dnssafe/bigsmod.c
new file mode 100644
index 00000000..b4ae68eb
--- /dev/null
+++ b/lib/dns/sec/dnssafe/bigsmod.c
@@ -0,0 +1,28 @@
+/* Copyright (C) RSA Data Security, Inc. created 1987, 1996. This is an
+ unpublished work protected as such under copyright law. This work
+ contains proprietary, confidential, and trade secret information of
+ RSA Data Security, Inc. Use, disclosure or reproduction without the
+ express written authorization of RSA Data Security, Inc. is
+ prohibited.
+ */
+
+#include "global.h"
+#include "bigmath.h"
+
+UINT2 BigSmod (a, v, n)
+UINT2 *a;
+unsigned int v;
+unsigned int n;
+{
+ UINT4 r = (UINT4)0;
+ register int i;
+ unsigned int scale;
+
+ scale = (unsigned int)((UINT4)65536 % (UINT4)v);
+
+ for (i = n-1; i >= 0; i--) {
+ r = (r*scale) + (UINT4)a[i];
+ r = r % (UINT4)v;
+ }
+ return ((UINT2)r);
+}