All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.math.internal.Nat384 Maven / Gradle / Ivy

Go to download

The FIPS 140-3 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms certified to FIPS 140-3 level 1. This jar contains JCE provider and low-level API for the BC-FJA version 2.0.0, FIPS Certificate #4743. Please see certificate for certified platform details.

There is a newer version: 2.0.0
Show newest version
/***************************************************************/
/******    DO NOT EDIT THIS CLASS bc-java SOURCE FILE     ******/
/***************************************************************/
package org.bouncycastle.math.internal;


public abstract class Nat384
{
    public static void mul(int[] x, int[] y, int[] zz)
    {
        Nat192.mul(x, y, zz);
        Nat192.mul(x, 6, y, 6, zz, 12);

        int c18 = Nat192.addToEachOther(zz, 6, zz, 12);
        int c12 = c18 + Nat192.addTo(zz, 0, zz, 6, 0);
        c18 += Nat192.addTo(zz, 18, zz, 12, c12);

        int[] dx = Nat192.create(), dy = Nat192.create();
        boolean neg = Nat192.diff(x, 6, x, 0, dx, 0) != Nat192.diff(y, 6, y, 0, dy, 0);

        int[] tt = Nat192.createExt();
        Nat192.mul(dx, dy, tt);

        c18 += neg ? Nat.addTo(12, tt, 0, zz, 6) : Nat.subFrom(12, tt, 0, zz, 6);
        Nat.addWordAt(24, c18, zz, 18); 
    }

    public static void square(int[] x, int[] zz)
    {
        Nat192.square(x, zz);
        Nat192.square(x, 6, zz, 12);

        int c18 = Nat192.addToEachOther(zz, 6, zz, 12);
        int c12 = c18 + Nat192.addTo(zz, 0, zz, 6, 0);
        c18 += Nat192.addTo(zz, 18, zz, 12, c12);

        int[] dx = Nat192.create();
        Nat192.diff(x, 6, x, 0, dx, 0);

        int[] tt = Nat192.createExt();
        Nat192.square(dx, tt);

        c18 += Nat.subFrom(12, tt, 0, zz, 6);
        Nat.addWordAt(24, c18, zz, 18); 
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy