Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GMSSUtils.java « gmss « crypto « pqc « bouncycastle « org « java « main « src « core - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9d289513a23f42bd20bea444797fed9f02c178d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package org.bouncycastle.pqc.crypto.gmss;

import java.util.Enumeration;
import java.util.Vector;

import org.bouncycastle.util.Arrays;

class GMSSUtils
{
    static GMSSLeaf[] clone(GMSSLeaf[] data)
    {
        if (data == null)
        {
            return null;
        }
        GMSSLeaf[] copy = new GMSSLeaf[data.length];

        System.arraycopy(data, 0, copy, 0, data.length);

        return copy;
    }

    static GMSSRootCalc[] clone(GMSSRootCalc[] data)
    {
        if (data == null)
        {
            return null;
        }
        GMSSRootCalc[] copy = new GMSSRootCalc[data.length];

        System.arraycopy(data, 0, copy, 0, data.length);

        return copy;
    }

    static GMSSRootSig[] clone(GMSSRootSig[] data)
    {
        if (data == null)
        {
            return null;
        }
        GMSSRootSig[] copy = new GMSSRootSig[data.length];

        System.arraycopy(data, 0, copy, 0, data.length);

        return copy;
    }

    static byte[][] clone(byte[][] data)
    {
        if (data == null)
        {
            return null;
        }
        byte[][] copy = new byte[data.length][];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = Arrays.clone(data[i]);
        }

        return copy;
    }

    static byte[][][] clone(byte[][][] data)
    {
        if (data == null)
        {
            return null;
        }
        byte[][][] copy = new byte[data.length][][];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = clone(data[i]);
        }

        return copy;
    }

    static Treehash[] clone(Treehash[] data)
    {
        if (data == null)
        {
            return null;
        }
        Treehash[] copy = new Treehash[data.length];

        System.arraycopy(data, 0, copy, 0, data.length);

        return copy;
    }

    static Treehash[][] clone(Treehash[][] data)
    {
        if (data == null)
        {
            return null;
        }
        Treehash[][] copy = new Treehash[data.length][];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = clone(data[i]);
        }

        return copy;
    }

    static Vector[] clone(Vector[] data)
    {
        if (data == null)
        {
            return null;
        }
        Vector[] copy = new Vector[data.length];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = new Vector();
            for (Enumeration en = data[i].elements(); en.hasMoreElements();)
            {
                copy[i].addElement(en.nextElement());
            }
        }

        return copy;
    }

    static Vector[][] clone(Vector[][] data)
    {
        if (data == null)
        {
            return null;
        }
        Vector[][] copy = new Vector[data.length][];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = clone(data[i]);
        }

        return copy;
    }
}