Skip to content

Commit 4fa0930

Browse files
authored
version 6.0.0 (#14)
Version 6.0.0
1 parent 8d2daf8 commit 4fa0930

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1623
-630
lines changed

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# files related to build
2-
build/
32
.cache/
3+
.clangd
4+
build/
5+
compile_commands.json
46

57
# do not track compiled documentation files
68
doc/html
7-
8-
# misc IDE stuff
9-
secure-computation-library.*
10-
compile_commands.json

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
cmake_minimum_required( VERSION 3.14 )
1818

19-
project( scl VERSION 5.3.0 DESCRIPTION "Secure Computation Library" )
19+
project( scl VERSION 6.0.0 DESCRIPTION "Secure Computation Library" )
2020

2121
if(NOT CMAKE_BUILD_TYPE)
2222
set(CMAKE_BUILD_TYPE Release)
@@ -44,6 +44,7 @@ set(SCL_SOURCE_FILES
4444
src/scl/math/mersenne127.cc
4545

4646
src/scl/net/config.cc
47+
src/scl/net/channel.cc
4748
src/scl/net/mem_channel.cc
4849
src/scl/net/threaded_sender.cc
4950
src/scl/net/network.cc
@@ -98,7 +99,6 @@ if(CMAKE_BUILD_TYPE MATCHES "Debug")
9899
test/scl/util/test_prg.cc
99100
test/scl/util/test_sha3.cc
100101
test/scl/util/test_sha256.cc
101-
test/scl/util/test_traits.cc
102102
test/scl/util/test_ecdsa.cc
103103

104104
test/scl/gf7.cc
@@ -124,6 +124,7 @@ if(CMAKE_BUILD_TYPE MATCHES "Debug")
124124
test/scl/net/test_network.cc
125125
test/scl/net/test_shared_deque.cc
126126
test/scl/net/test_channel.cc
127+
test/scl/net/test_packet.cc
127128

128129
test/scl/protocol/test_protocol.cc
129130

@@ -134,7 +135,9 @@ if(CMAKE_BUILD_TYPE MATCHES "Debug")
134135
test/scl/simulation/test_result.cc
135136
test/scl/simulation/test_measurement.cc
136137
test/scl/simulation/test_mem_channel_buffer.cc
137-
test/scl/simulation/test_env.cc)
138+
test/scl/simulation/test_env.cc
139+
140+
test/scl/serialization/test_serializer.cc)
138141

139142
if(WITH_EC MATCHES ON)
140143
set(SCL_TEST_SOURCE_FILES ${SCL_TEST_SOURCE_FILES}

RELEASE.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
6.0.0: Improvements to serialization and Channels.
2+
- Added a Serializer type that can be specialized in order to specify how
3+
various objects are converted to bytes.
4+
- Added a Packet type that allows reading and writing almost arbitrary objects,
5+
but stores them internally in a serialized format.
6+
- Modified the net::Channel interface to allow sending and receving
7+
Packets. Remove old Send/Recv overloads.
8+
- Remove proto::ProtocolEnvironment.
9+
110
5.3.0: ECDSA
211
- Added functionality for creating ECDSA signatures.
312

doc/DoxyConf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ INPUT = doc/mainpage.md \
1616
include/scl/ss \
1717
include/scl/net \
1818
include/scl/simulation \
19-
include/scl/protocol
19+
include/scl/protocol \
20+
include/scl/serialization
2021
FILE_PATTERNS = *.h
2122
EXCLUDE_SYMBOLS = SCL_*
2223

include/scl/math/ec.h

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ class EC {
5454
*/
5555
constexpr static std::size_t ByteSize(bool compressed = true) {
5656
return 1 + (compressed ? 0 : Field::ByteSize()) + Field::ByteSize();
57-
};
57+
}
5858

5959
/**
6060
* @brief The size of a curve point in bits.
6161
*/
6262
constexpr static std::size_t BitSize(bool compressed = true) {
6363
return ByteSize(compressed) * 8;
64-
};
64+
}
6565

6666
/**
6767
* @brief A string indicating which curve this is.
6868
*/
6969
constexpr static const char* Name() {
7070
return Curve::NAME;
71-
};
71+
}
7272

7373
/**
7474
* @brief Get the generator of this curve.
@@ -77,7 +77,7 @@ class EC {
7777
EC g;
7878
CurveSetGenerator<Curve>(g.m_value);
7979
return g;
80-
};
80+
} // LCOV_EXCL_LINE
8181

8282
/**
8383
* @brief Read an elliptic curve point from bytes.
@@ -88,7 +88,7 @@ class EC {
8888
EC e;
8989
CurveFromBytes<Curve>(e.m_value, src);
9090
return e;
91-
};
91+
} // LCOV_EXCL_LINE
9292

9393
/**
9494
* @brief Create a point from an pair of affine coordinates.
@@ -97,14 +97,19 @@ class EC {
9797
EC e;
9898
CurveSetAffine<Curve>(e.m_value, x, y);
9999
return e;
100-
};
100+
}
101101

102102
/**
103103
* @brief Create a new point equal to the point at infinity.
104104
*/
105105
explicit constexpr EC() {
106106
CurveSetPointAtInfinity<Curve>(m_value);
107-
};
107+
}
108+
109+
/**
110+
* @brief Destructor. Does nothing.
111+
*/
112+
~EC() {}
108113

109114
/**
110115
* @brief Add another EC point to this.
@@ -114,7 +119,7 @@ class EC {
114119
EC& operator+=(const EC& other) {
115120
CurveAdd<Curve>(m_value, other.m_value);
116121
return *this;
117-
};
122+
}
118123

119124
/**
120125
* @brief Add two points.
@@ -125,7 +130,7 @@ class EC {
125130
friend EC operator+(const EC& lhs, const EC& rhs) {
126131
EC copy(lhs);
127132
return copy += rhs;
128-
};
133+
}
129134

130135
/**
131136
* @brief Double this point.
@@ -134,7 +139,7 @@ class EC {
134139
EC& DoubleInPlace() {
135140
CurveDouble<Curve>(m_value);
136141
return *this;
137-
};
142+
}
138143

139144
/**
140145
* @brief Double this point.
@@ -143,7 +148,7 @@ class EC {
143148
EC Double() const {
144149
EC copy(*this);
145150
return copy.DoubleInPlace();
146-
};
151+
}
147152

148153
/**
149154
* @brief Subtract another point from this.
@@ -153,7 +158,7 @@ class EC {
153158
EC& operator-=(const EC& other) {
154159
CurveSubtract<Curve>(m_value, other.m_value);
155160
return *this;
156-
};
161+
}
157162

158163
/**
159164
* @brief Subtract two EC points.
@@ -164,7 +169,7 @@ class EC {
164169
friend EC operator-(const EC& lhs, const EC& rhs) {
165170
EC copy(lhs);
166171
return copy -= rhs;
167-
};
172+
}
168173

169174
/**
170175
* @brief Perform a scalar multiplication.
@@ -174,7 +179,7 @@ class EC {
174179
EC& operator*=(const Number& scalar) {
175180
CurveScalarMultiply<Curve>(m_value, scalar);
176181
return *this;
177-
};
182+
}
178183

179184
/**
180185
* @brief Perform a scalar multiplication.
@@ -184,7 +189,7 @@ class EC {
184189
EC& operator*=(const Order& scalar) {
185190
CurveScalarMultiply<Curve>(m_value, scalar);
186191
return *this;
187-
};
192+
}
188193

189194
/**
190195
* @brief Multiply a point with a scalar from the right.
@@ -195,7 +200,7 @@ class EC {
195200
friend EC operator*(const EC& point, const Number& scalar) {
196201
EC copy(point);
197202
return copy *= scalar;
198-
};
203+
}
199204

200205
/**
201206
* @brief Multiply a point with a scalar from the right.
@@ -206,7 +211,7 @@ class EC {
206211
friend EC operator*(const EC& point, const Order& scalar) {
207212
EC copy(point);
208213
return copy *= scalar;
209-
};
214+
}
210215

211216
/**
212217
* @brief Multiply a point with a scalar from the left.
@@ -216,7 +221,7 @@ class EC {
216221
*/
217222
friend EC operator*(const Number& scalar, const EC& point) {
218223
return point * scalar;
219-
};
224+
}
220225

221226
/**
222227
* @brief Multiply a point with a scalar from the left.
@@ -227,7 +232,7 @@ class EC {
227232
friend EC operator*(const FF<typename Curve::Order>& scalar,
228233
const EC& point) {
229234
return point * scalar;
230-
};
235+
}
231236

232237
/**
233238
* @brief Negate this point.
@@ -245,7 +250,7 @@ class EC {
245250
EC operator-() {
246251
EC copy(*this);
247252
return copy.Negate();
248-
};
253+
}
249254

250255
/**
251256
* @brief Check if this EC point is equal to another EC point.
@@ -254,52 +259,52 @@ class EC {
254259
*/
255260
bool Equal(const EC& other) const {
256261
return CurveEqual<Curve>(m_value, other.m_value);
257-
};
262+
}
258263

259264
/**
260265
* @brief Equality operator for EC points.
261266
*/
262267
friend bool operator==(const EC& lhs, const EC& rhs) {
263268
return lhs.Equal(rhs);
264-
};
269+
}
265270

266271
/**
267272
* @brief In-equality operator for EC points.
268273
*/
269274
friend bool operator!=(const EC& lhs, const EC& rhs) {
270275
return !(lhs == rhs);
271-
};
276+
}
272277

273278
/**
274279
* @brief Check if this point is equal to the point at inifity.
275280
* @return true if this point is equal to the point at inifity.
276281
*/
277282
bool PointAtInfinity() const {
278283
return CurveIsPointAtInfinity<Curve>(m_value);
279-
};
284+
}
280285

281286
/**
282287
* @brief Return this point as a pair of affine coordinates.
283288
* @return this point as a pair of affine coordinates.
284289
*/
285290
std::array<Field, 2> ToAffine() const {
286291
return CurveToAffine<Curve>(m_value);
287-
};
292+
}
288293

289294
/**
290295
* @brief Output this point as a string.
291296
*/
292297
std::string ToString() const {
293298
return CurveToString<Curve>(m_value);
294-
};
299+
}
295300

296301
/**
297302
* @brief Write the curve point to a STL output stream.
298303
* @see EC::ToString.
299304
*/
300305
friend std::ostream& operator<<(std::ostream& os, const EC& point) {
301306
return os << point.ToString();
302-
};
307+
}
303308

304309
/**
305310
* @brief Write this point to a buffer.
@@ -308,7 +313,7 @@ class EC {
308313
*/
309314
void Write(unsigned char* dest, bool compress = true) const {
310315
CurveToBytes<Curve>(dest, m_value, compress);
311-
};
316+
}
312317

313318
private:
314319
typename Curve::ValueType m_value;

0 commit comments

Comments
 (0)