/src/cryptofuzz/modules/wolfcrypt/bn_ops.h
Line  | Count  | Source  | 
1  |  | #pragma once  | 
2  |  |  | 
3  |  | #include <cryptofuzz/operations.h>  | 
4  |  | #include <cryptofuzz/util.h>  | 
5  |  |  | 
6  |  | #include "bn_helper.h"  | 
7  |  |  | 
8  |  | namespace cryptofuzz { | 
9  |  | namespace module { | 
10  |  | namespace wolfCrypt_bignum { | 
11  |  |  | 
12  |  | class Operation { | 
13  |  |     public:  | 
14  |  |         virtual bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const = 0;  | 
15  | 3.33k  |         virtual ~Operation() { } | 
16  |  | };  | 
17  |  |  | 
18  |  | class Add : public Operation { | 
19  |  |     public:  | 
20  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
21  |  | };  | 
22  |  |  | 
23  |  | class Sub : public Operation { | 
24  |  |     public:  | 
25  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
26  |  | };  | 
27  |  |  | 
28  |  | class Mul : public Operation { | 
29  |  |     public:  | 
30  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
31  |  | };  | 
32  |  |  | 
33  |  | class Div : public Operation { | 
34  |  |     public:  | 
35  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
36  |  | };  | 
37  |  |  | 
38  |  | class ExpMod : public Operation { | 
39  |  |     public:  | 
40  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
41  |  | };  | 
42  |  |  | 
43  |  | class Sqr : public Operation { | 
44  |  |     public:  | 
45  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
46  |  | };  | 
47  |  |  | 
48  |  | class GCD : public Operation { | 
49  |  |     public:  | 
50  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
51  |  | };  | 
52  |  |  | 
53  |  | class InvMod : public Operation { | 
54  |  |     public:  | 
55  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
56  |  | };  | 
57  |  |  | 
58  |  | class Cmp : public Operation { | 
59  |  |     public:  | 
60  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
61  |  | };  | 
62  |  |  | 
63  |  | class Abs : public Operation { | 
64  |  |     public:  | 
65  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
66  |  | };  | 
67  |  |  | 
68  |  | class Neg : public Operation { | 
69  |  |     public:  | 
70  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
71  |  | };  | 
72  |  |  | 
73  |  | class RShift : public Operation { | 
74  |  |     public:  | 
75  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
76  |  | };  | 
77  |  |  | 
78  |  | class LShift1 : public Operation { | 
79  |  |     public:  | 
80  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
81  |  | };  | 
82  |  |  | 
83  |  | class IsNeg : public Operation { | 
84  |  |     public:  | 
85  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
86  |  | };  | 
87  |  |  | 
88  |  | class IsEq : public Operation { | 
89  |  |     public:  | 
90  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
91  |  | };  | 
92  |  |  | 
93  |  | class IsZero : public Operation { | 
94  |  |     public:  | 
95  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
96  |  | };  | 
97  |  |  | 
98  |  | class IsOne : public Operation { | 
99  |  |     public:  | 
100  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
101  |  | };  | 
102  |  |  | 
103  |  | class MulMod : public Operation { | 
104  |  |     public:  | 
105  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
106  |  | };  | 
107  |  |  | 
108  |  | class AddMod : public Operation { | 
109  |  |     public:  | 
110  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
111  |  | };  | 
112  |  |  | 
113  |  | class SubMod : public Operation { | 
114  |  |     public:  | 
115  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
116  |  | };  | 
117  |  |  | 
118  |  | class SqrMod : public Operation { | 
119  |  |     public:  | 
120  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
121  |  | };  | 
122  |  |  | 
123  |  | class Bit : public Operation { | 
124  |  |     public:  | 
125  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
126  |  | };  | 
127  |  |  | 
128  |  | class CmpAbs : public Operation { | 
129  |  |     public:  | 
130  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
131  |  | };  | 
132  |  |  | 
133  |  | class SetBit : public Operation { | 
134  |  |     public:  | 
135  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
136  |  | };  | 
137  |  |  | 
138  |  | class LCM : public Operation { | 
139  |  |     public:  | 
140  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
141  |  | };  | 
142  |  |  | 
143  |  | class Mod : public Operation { | 
144  |  |     public:  | 
145  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
146  |  | };  | 
147  |  |  | 
148  |  | class IsEven : public Operation { | 
149  |  |     public:  | 
150  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
151  |  | };  | 
152  |  |  | 
153  |  | class IsOdd : public Operation { | 
154  |  |     public:  | 
155  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
156  |  | };  | 
157  |  |  | 
158  |  | class MSB : public Operation { | 
159  |  |     public:  | 
160  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
161  |  | };  | 
162  |  |  | 
163  |  | class NumBits : public Operation { | 
164  |  |     public:  | 
165  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
166  |  | };  | 
167  |  |  | 
168  |  | class Set : public Operation { | 
169  |  |     public:  | 
170  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
171  |  | };  | 
172  |  |  | 
173  |  | class Jacobi : public Operation { | 
174  |  |     public:  | 
175  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
176  |  | };  | 
177  |  |  | 
178  |  | class Exp2 : public Operation { | 
179  |  |     public:  | 
180  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
181  |  | };  | 
182  |  |  | 
183  |  | class NumLSZeroBits : public Operation { | 
184  |  |     public:  | 
185  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
186  |  | };  | 
187  |  |  | 
188  |  | class MulAdd : public Operation { | 
189  |  |     public:  | 
190  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
191  |  | };  | 
192  |  |  | 
193  |  | class CondSet : public Operation { | 
194  |  |     public:  | 
195  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
196  |  | };  | 
197  |  |  | 
198  |  | class Rand : public Operation { | 
199  |  |     public:  | 
200  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
201  |  | };  | 
202  |  |  | 
203  |  | class Zero : public Operation { | 
204  |  |     public:  | 
205  |  |         bool Run(Datasource& ds, Bignum& res, BignumCluster& bn) const override;  | 
206  |  | };  | 
207  |  |  | 
208  |  | } /* namespace wolfCrypt_bignum */  | 
209  |  | } /* namespace module */  | 
210  |  | } /* namespace cryptofuzz */  |