• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 12661312886

07 Jan 2025 11:55PM UTC coverage: 91.251% (-0.02%) from 91.267%
12661312886

push

github

web-flow
Merge pull request #4518 from randombit/jack/ec-point-cleanups

Move EC_Point and related code to deprecated submodule

93407 of 102363 relevant lines covered (91.25%)

11518305.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.04
/src/tests/test_ecies.cpp
1
/*
2
* (C) 2016 Philipp Weber
3
* (C) 2016 Daniel Neus
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7

8
#include "tests.h"
9

10
#if defined(BOTAN_HAS_ECIES)
11
   #include <botan/ecdh.h>
12
   #include <botan/ecies.h>
13
#endif
14

15
namespace Botan_Tests {
16

17
namespace {
18

19
#if defined(BOTAN_HAS_ECIES) && defined(BOTAN_HAS_AES) && defined(BOTAN_HAS_MODE_CBC)
20

21
using Flags = Botan::ECIES_Flags;
22

23
Botan::EC_Point_Format get_compression_type(const std::string& format) {
14✔
24
   if(format == "uncompressed") {
14✔
25
      return Botan::EC_Point_Format::Uncompressed;
26
   } else if(format == "compressed") {
6✔
27
      return Botan::EC_Point_Format::Compressed;
28
   } else if(format == "hybrid") {
×
29
      return Botan::EC_Point_Format::Hybrid;
30
   }
31
   throw Botan::Invalid_Argument("invalid compression format");
×
32
}
33

34
Flags ecies_flags(bool cofactor_mode, bool old_cofactor_mode, bool check_mode, bool single_hash_mode) {
108✔
35
   return (cofactor_mode ? Flags::CofactorMode : Flags::None) |
108✔
36
          (single_hash_mode ? Flags::SingleHashMode : Flags::None) |
37
          (old_cofactor_mode ? Flags::OldCofactorMode : Flags::None) | (check_mode ? Flags::CheckMode : Flags::None);
216✔
38
}
39

40
void check_encrypt_decrypt(Test::Result& result,
61✔
41
                           const Botan::ECDH_PrivateKey& private_key,
42
                           const Botan::ECDH_PrivateKey& other_private_key,
43
                           const Botan::ECIES_System_Params& ecies_params,
44
                           const Botan::InitializationVector& iv,
45
                           const std::string& label,
46
                           const std::vector<uint8_t>& plaintext,
47
                           const std::vector<uint8_t>& ciphertext,
48
                           Botan::RandomNumberGenerator& rng) {
49
   try {
61✔
50
      Botan::ECIES_Encryptor ecies_enc(private_key, ecies_params, rng);
61✔
51
      ecies_enc.set_other_key(
122✔
52
         Botan::EC_AffinePoint(other_private_key.domain(), other_private_key.raw_public_key_bits()));
122✔
53
      Botan::ECIES_Decryptor ecies_dec(other_private_key, ecies_params, rng);
61✔
54
      if(!iv.bits_of().empty()) {
120✔
55
         ecies_enc.set_initialization_vector(iv);
59✔
56
         ecies_dec.set_initialization_vector(iv);
59✔
57
      }
58
      if(!label.empty()) {
61✔
59
         ecies_enc.set_label(label);
11✔
60
         ecies_dec.set_label(label);
11✔
61
      }
62

63
      const std::vector<uint8_t> encrypted = ecies_enc.encrypt(plaintext, rng);
61✔
64
      if(!ciphertext.empty()) {
61✔
65
         result.test_eq("encrypted data", encrypted, ciphertext);
26✔
66
      }
67
      const Botan::secure_vector<uint8_t> decrypted = ecies_dec.decrypt(encrypted);
61✔
68
      result.test_eq("decrypted data equals plaintext", decrypted, plaintext);
61✔
69

70
      std::vector<uint8_t> invalid_encrypted = encrypted;
61✔
71
      uint8_t& last_byte = invalid_encrypted[invalid_encrypted.size() - 1];
61✔
72
      last_byte = ~last_byte;
61✔
73
      result.test_throws("throw on invalid ciphertext",
183✔
74
                         [&ecies_dec, &invalid_encrypted] { ecies_dec.decrypt(invalid_encrypted); });
122✔
75
   } catch(Botan::Lookup_Error& e) {
183✔
76
      result.test_note(std::string("Test not executed: ") + e.what());
×
77
   }
×
78
}
61✔
79

80
void check_encrypt_decrypt(Test::Result& result,
48✔
81
                           const Botan::ECDH_PrivateKey& private_key,
82
                           const Botan::ECDH_PrivateKey& other_private_key,
83
                           const Botan::ECIES_System_Params& ecies_params,
84
                           size_t iv_length,
85
                           Botan::RandomNumberGenerator& rng) {
86
   const std::vector<uint8_t> plaintext{1, 2, 3};
48✔
87
   check_encrypt_decrypt(result,
96✔
88
                         private_key,
89
                         other_private_key,
90
                         ecies_params,
91
                         Botan::InitializationVector(std::vector<uint8_t>(iv_length, 0)),
144✔
92
                         "",
93
                         plaintext,
94
                         std::vector<uint8_t>(),
48✔
95
                         rng);
96
}
48✔
97

98
   #if defined(BOTAN_HAS_KDF1_18033) && defined(BOTAN_HAS_SHA1)
99

100
class ECIES_ISO_Tests final : public Text_Based_Test {
×
101
   public:
102
      ECIES_ISO_Tests() : Text_Based_Test("pubkey/ecies-18033.vec", "format,p,a,b,Order,Gx,Gy,Oid,hx,hy,x,r,C0,K") {}
2✔
103

104
      bool clear_between_callbacks() const override { return false; }
2✔
105

106
      Test::Result run_one_test(const std::string& /*header*/, const VarMap& vars) override {
2✔
107
         Test::Result result("ECIES-ISO");
2✔
108

109
         // get test vectors defined by ISO 18033
110
         const Botan::EC_Point_Format compression_type = get_compression_type(vars.get_req_str("format"));
2✔
111
         const Botan::BigInt p = vars.get_req_bn("p");
2✔
112
         const Botan::BigInt a = vars.get_req_bn("a");
2✔
113
         const Botan::BigInt b = vars.get_req_bn("b");
2✔
114
         const Botan::BigInt order = vars.get_req_bn("Order");  // order
2✔
115
         const Botan::BigInt gx = vars.get_req_bn("Gx");        // base point x
2✔
116
         const Botan::BigInt gy = vars.get_req_bn("Gy");        // base point y
2✔
117
         const Botan::OID oid(vars.get_req_str("Oid"));
4✔
118
         const Botan::BigInt hx = vars.get_req_bn("hx");          // x of public point of bob
2✔
119
         const Botan::BigInt hy = vars.get_req_bn("hy");          // y of public point of bob
2✔
120
         const Botan::BigInt x = vars.get_req_bn("x");            // private key of bob
2✔
121
         const Botan::BigInt r = vars.get_req_bn("r");            // (ephemeral) private key of alice
2✔
122
         const std::vector<uint8_t> c0 = vars.get_req_bin("C0");  // expected encoded (ephemeral) public key
2✔
123
         const std::vector<uint8_t> k = vars.get_req_bin("K");    // expected derived secret
2✔
124

125
         const Botan::EC_Group domain(oid, p, a, b, gx, gy, order);
2✔
126

127
         // keys of bob
128
         const Botan::ECDH_PrivateKey other_private_key(this->rng(), domain, x);
2✔
129
         const auto other_public_key_point = Botan::EC_AffinePoint::from_bigint_xy(domain, hx, hy).value();
4✔
130
         const Botan::ECDH_PublicKey other_public_key(domain, other_public_key_point);
2✔
131

132
         // (ephemeral) keys of alice
133
         const Botan::ECDH_PrivateKey eph_private_key(this->rng(), domain, r);
2✔
134
         const auto eph_public_key_bin = eph_private_key.public_value(compression_type);
2✔
135
         result.test_eq("encoded (ephemeral) public key", eph_public_key_bin, c0);
2✔
136

137
         // test secret derivation: ISO 18033 test vectors use KDF1 from ISO 18033
138
         // no cofactor-/oldcofactor-/singlehash-/check-mode and 128 byte secret length
139
         Botan::ECIES_KA_Params ka_params(
2✔
140
            eph_private_key.domain(), "KDF1-18033(SHA-1)", 128, compression_type, Flags::None);
2✔
141
         const Botan::ECIES_KA_Operation ka(eph_private_key, ka_params, true, this->rng());
2✔
142
         const Botan::SymmetricKey secret_key = ka.derive_secret(eph_public_key_bin, other_public_key_point);
2✔
143
         result.test_eq("derived secret key", secret_key.bits_of(), k);
4✔
144

145
         // test encryption / decryption
146

147
         for(auto comp_type : {Botan::EC_Point_Format::Uncompressed,
6✔
148
                               Botan::EC_Point_Format::Compressed,
149
                               Botan::EC_Point_Format::Hybrid}) {
8✔
150
            for(bool cofactor_mode : {true, false}) {
18✔
151
               for(bool single_hash_mode : {true, false}) {
36✔
152
                  for(bool old_cofactor_mode : {true, false}) {
72✔
153
                     for(bool check_mode : {true, false}) {
144✔
154
                        Flags flags = ecies_flags(cofactor_mode, old_cofactor_mode, check_mode, single_hash_mode);
96✔
155

156
                        if(size_t(cofactor_mode) + size_t(check_mode) + size_t(old_cofactor_mode) > 1) {
96✔
157
                           auto onThrow = [&]() {
96✔
158
                              Botan::ECIES_System_Params(eph_private_key.domain(),
48✔
159
                                                         "KDF2(SHA-1)",
160
                                                         "AES-256/CBC",
161
                                                         32,
162
                                                         "HMAC(SHA-1)",
163
                                                         20,
164
                                                         comp_type,
165
                                                         flags);
166
                           };
48✔
167
                           result.test_throws("throw on invalid ECIES_Flags", onThrow);
96✔
168
                           continue;
48✔
169
                        }
48✔
170

171
                        Botan::ECIES_System_Params ecies_params(eph_private_key.domain(),
48✔
172
                                                                "KDF2(SHA-1)",
173
                                                                "AES-256/CBC",
174
                                                                32,
175
                                                                "HMAC(SHA-1)",
176
                                                                20,
177
                                                                comp_type,
178
                                                                flags);
48✔
179
                        check_encrypt_decrypt(
48✔
180
                           result, eph_private_key, other_private_key, ecies_params, 16, this->rng());
181
                     }
48✔
182
                  }
183
               }
184
            }
185
         }
186

187
         return result;
2✔
188
      }
30✔
189
};
190

191
BOTAN_REGISTER_TEST("pubkey", "ecies_iso", ECIES_ISO_Tests);
192

193
   #endif
194

195
class ECIES_Tests final : public Text_Based_Test {
×
196
   public:
197
      ECIES_Tests() :
1✔
198
            Text_Based_Test("pubkey/ecies.vec",
199
                            "Curve,PrivateKey,OtherPrivateKey,Kdf,Dem,DemKeyLen,Mac,MacKeyLen,Format,"
200
                            "CofactorMode,OldCofactorMode,CheckMode,SingleHashMode,Label,Plaintext,Ciphertext",
201
                            "Iv") {}
2✔
202

203
      Test::Result run_one_test(const std::string& /*header*/, const VarMap& vars) override {
12✔
204
         Test::Result result("ECIES");
12✔
205

206
         const std::string curve = vars.get_req_str("Curve");
12✔
207
         const Botan::BigInt private_key_value = vars.get_req_bn("PrivateKey");
12✔
208
         const Botan::BigInt other_private_key_value = vars.get_req_bn("OtherPrivateKey");
12✔
209
         const std::string kdf = vars.get_req_str("Kdf");
12✔
210
         const std::string dem = vars.get_req_str("Dem");
12✔
211
         const size_t dem_key_len = vars.get_req_sz("DemKeyLen");
12✔
212
         const Botan::InitializationVector iv = Botan::InitializationVector(vars.get_opt_bin("Iv"));
22✔
213
         const std::string mac = vars.get_req_str("Mac");
12✔
214
         const size_t mac_key_len = vars.get_req_sz("MacKeyLen");
12✔
215
         const Botan::EC_Point_Format compression_type = get_compression_type(vars.get_req_str("Format"));
12✔
216
         const bool cofactor_mode = vars.get_req_sz("CofactorMode") != 0;
12✔
217
         const bool old_cofactor_mode = vars.get_req_sz("OldCofactorMode") != 0;
12✔
218
         const bool check_mode = vars.get_req_sz("CheckMode") != 0;
12✔
219
         const bool single_hash_mode = vars.get_req_sz("SingleHashMode") != 0;
12✔
220
         const std::string label = vars.get_req_str("Label");
12✔
221
         const std::vector<uint8_t> plaintext = vars.get_req_bin("Plaintext");
12✔
222
         const std::vector<uint8_t> ciphertext = vars.get_req_bin("Ciphertext");
12✔
223

224
         const Flags flags = ecies_flags(cofactor_mode, old_cofactor_mode, check_mode, single_hash_mode);
12✔
225

226
         // This test uses a mix of named curves plus PEM, so we use the deprecated constructor atm
227
         const Botan::EC_Group domain(curve);
12✔
228
         const Botan::ECDH_PrivateKey private_key(this->rng(), domain, private_key_value);
12✔
229
         const Botan::ECDH_PrivateKey other_private_key(this->rng(), domain, other_private_key_value);
12✔
230

231
         const Botan::ECIES_System_Params ecies_params(
12✔
232
            private_key.domain(), kdf, dem, dem_key_len, mac, mac_key_len, compression_type, flags);
12✔
233
         check_encrypt_decrypt(
12✔
234
            result, private_key, other_private_key, ecies_params, iv, label, plaintext, ciphertext, this->rng());
235

236
         return result;
24✔
237
      }
70✔
238
};
239

240
BOTAN_REGISTER_TEST("pubkey", "ecies", ECIES_Tests);
241

242
   #if defined(BOTAN_HAS_KDF1_18033) && defined(BOTAN_HAS_HMAC) && defined(BOTAN_HAS_AES) && defined(BOTAN_HAS_SHA2_64)
243

244
Test::Result test_other_key_not_set() {
1✔
245
   Test::Result result("ECIES other key not set");
1✔
246

247
   auto rng = Test::new_rng("ecies_other_key_not_set");
1✔
248

249
   const Flags flags = ecies_flags(false, false, false, true);
1✔
250
   const auto domain = Botan::EC_Group::from_name("secp521r1");
1✔
251

252
   const Botan::BigInt private_key_value(
1✔
253
      "405029866705438137604064977397053031159826489755682166267763407"
254
      "5002761777100287880684822948852132235484464537021197213998300006"
255
      "547176718172344447619746779823");
1✔
256

257
   const Botan::ECDH_PrivateKey private_key(*rng, domain, private_key_value);
1✔
258
   const Botan::ECIES_System_Params ecies_params(private_key.domain(),
1✔
259
                                                 "KDF1-18033(SHA-512)",
260
                                                 "AES-256/CBC",
261
                                                 32,
262
                                                 "HMAC(SHA-512)",
263
                                                 20,
264
                                                 Botan::EC_Point_Format::Compressed,
265
                                                 flags);
1✔
266

267
   Botan::ECIES_Encryptor ecies_enc(private_key, ecies_params, *rng);
1✔
268

269
   result.test_throws("encrypt not possible without setting other public key",
2✔
270
                      [&ecies_enc, &rng]() { ecies_enc.encrypt(std::vector<uint8_t>(8), *rng); });
2✔
271

272
   return result;
2✔
273
}
3✔
274

275
Test::Result test_kdf_not_found() {
1✔
276
   Test::Result result("ECIES kdf not found");
1✔
277

278
   auto rng = Test::new_rng("ecies_kdf_not_found");
1✔
279

280
   const Flags flags = ecies_flags(false, false, false, true);
1✔
281
   const auto domain = Botan::EC_Group::from_name("secp521r1");
1✔
282

283
   const Botan::BigInt private_key_value(
1✔
284
      "405029866705438137604064977397053031159826489755682166267763407"
285
      "5002761777100287880684822948852132235484464537021197213998300006"
286
      "547176718172344447619746779823");
1✔
287

288
   const Botan::ECDH_PrivateKey private_key(*rng, domain, private_key_value);
1✔
289
   const Botan::ECIES_System_Params ecies_params(private_key.domain(),
1✔
290
                                                 "KDF-XYZ(SHA-512)",
291
                                                 "AES-256/CBC",
292
                                                 32,
293
                                                 "HMAC(SHA-512)",
294
                                                 20,
295
                                                 Botan::EC_Point_Format::Compressed,
296
                                                 flags);
1✔
297

298
   result.test_throws("kdf not found", [&]() {
2✔
299
      Botan::ECIES_Encryptor ecies_enc(private_key, ecies_params, *rng);
1✔
300
      ecies_enc.encrypt(std::vector<uint8_t>(8), *rng);
2✔
301
   });
1✔
302

303
   return result;
2✔
304
}
3✔
305

306
Test::Result test_mac_not_found() {
1✔
307
   Test::Result result("ECIES mac not found");
1✔
308

309
   auto rng = Test::new_rng("ecies_mac_not_found");
1✔
310

311
   const Flags flags = ecies_flags(false, false, false, true);
1✔
312
   const auto domain = Botan::EC_Group::from_name("secp521r1");
1✔
313

314
   const Botan::BigInt private_key_value(
1✔
315
      "405029866705438137604064977397053031159826489755682166267763407"
316
      "5002761777100287880684822948852132235484464537021197213998300006"
317
      "547176718172344447619746779823");
1✔
318

319
   const Botan::ECDH_PrivateKey private_key(*rng, domain, private_key_value);
1✔
320
   const Botan::ECIES_System_Params ecies_params(private_key.domain(),
1✔
321
                                                 "KDF1-18033(SHA-512)",
322
                                                 "AES-256/CBC",
323
                                                 32,
324
                                                 "XYZMAC(SHA-512)",
325
                                                 20,
326
                                                 Botan::EC_Point_Format::Compressed,
327
                                                 flags);
1✔
328

329
   result.test_throws("mac not found", [&]() {
2✔
330
      Botan::ECIES_Encryptor ecies_enc(private_key, ecies_params, *rng);
1✔
331
      ecies_enc.encrypt(std::vector<uint8_t>(8), *rng);
×
332
   });
×
333

334
   return result;
2✔
335
}
3✔
336

337
Test::Result test_cipher_not_found() {
1✔
338
   Test::Result result("ECIES cipher not found");
1✔
339

340
   auto rng = Test::new_rng("ecies_cipher_not_found");
1✔
341

342
   const Flags flags = ecies_flags(false, false, false, true);
1✔
343
   const auto domain = Botan::EC_Group::from_name("secp521r1");
1✔
344

345
   const Botan::BigInt private_key_value(
1✔
346
      "405029866705438137604064977397053031159826489755682166267763407"
347
      "5002761777100287880684822948852132235484464537021197213998300006"
348
      "547176718172344447619746779823");
1✔
349

350
   const Botan::ECDH_PrivateKey private_key(*rng, domain, private_key_value);
1✔
351
   const Botan::ECIES_System_Params ecies_params(private_key.domain(),
1✔
352
                                                 "KDF1-18033(SHA-512)",
353
                                                 "AES-XYZ-256/CBC",
354
                                                 32,
355
                                                 "HMAC(SHA-512)",
356
                                                 20,
357
                                                 Botan::EC_Point_Format::Compressed,
358
                                                 flags);
1✔
359

360
   result.test_throws("cipher not found", [&]() {
2✔
361
      Botan::ECIES_Encryptor ecies_enc(private_key, ecies_params, *rng);
1✔
362
      ecies_enc.encrypt(std::vector<uint8_t>(8), *rng);
×
363
   });
×
364

365
   return result;
2✔
366
}
3✔
367

368
Test::Result test_system_params_short_ctor() {
1✔
369
   Test::Result result("ECIES short system params ctor");
1✔
370

371
   auto rng = Test::new_rng("ecies_params_short_ctor");
1✔
372

373
   const auto domain = Botan::EC_Group::from_name("secp521r1");
1✔
374
   const Botan::BigInt private_key_value(
1✔
375
      "405029866705438137604064977397053031159826489755682166267763407"
376
      "5002761777100287880684822948852132235484464537021197213998300006"
377
      "547176718172344447619746779823");
1✔
378

379
   const Botan::BigInt other_private_key_value(
1✔
380
      "2294226772740614508941417891614236736606752960073669253551166842"
381
      "5866095315090327914760325168219669828915074071456176066304457448"
382
      "25404691681749451640151380153");
1✔
383

384
   const Botan::ECDH_PrivateKey private_key(*rng, domain, private_key_value);
1✔
385
   const Botan::ECDH_PrivateKey other_private_key(*rng, domain, other_private_key_value);
1✔
386

387
   const Botan::ECIES_System_Params ecies_params(
1✔
388
      private_key.domain(), "KDF1-18033(SHA-512)", "AES-256/CBC", 32, "HMAC(SHA-512)", 16);
1✔
389

390
   const Botan::InitializationVector iv("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
1✔
391
   const std::string label = "Test";
1✔
392

393
   const std::vector<uint8_t> plaintext = Botan::hex_decode("000102030405060708090A0B0C0D0E0F");
1✔
394

395
   // generated with botan
396
   const std::vector<uint8_t> ciphertext = Botan::hex_decode(
1✔
397
      "0401519EAA0489FF9D51E98E4C22349463E2001CD06F8CE47D81D4007A"
398
      "79ACF98E92C814686477CEA666EFC277DC84E15FC95E38AFF8E16D478A"
399
      "44CD5C5F1517F8B1F300000591317F261C3D04A7207F01EAE3EC70F2360"
400
      "0F82C53CC0B85BE7AC9F6CE79EF2AB416E5934D61BA9D346385D7545C57F"
401
      "77C7EA7C58E18C70CBFB0A24AE1B9943EC5A8D0657522CCDF30BA95674D81"
402
      "B397635D215178CD13BD9504AE957A9888F4128FFC0F0D3F1CEC646AEC8CE"
403
      "3F2463D233B22A7A12B679F4C06501F584D4DEFF6D26592A8D873398BD892"
404
      "B477B3468813C053DA43C4F3D49009F7A12D6EF7");
1✔
405

406
   check_encrypt_decrypt(result, private_key, other_private_key, ecies_params, iv, label, plaintext, ciphertext, *rng);
1✔
407

408
   return result;
1✔
409
}
6✔
410

411
Test::Result test_ciphertext_too_short() {
1✔
412
   Test::Result result("ECIES ciphertext too short");
1✔
413

414
   const auto domain = Botan::EC_Group::from_name("secp521r1");
1✔
415
   const Botan::BigInt private_key_value(
1✔
416
      "405029866705438137604064977397053031159826489755682166267763407"
417
      "5002761777100287880684822948852132235484464537021197213998300006"
418
      "547176718172344447619746779823");
1✔
419

420
   const Botan::BigInt other_private_key_value(
1✔
421
      "2294226772740614508941417891614236736606752960073669253551166842"
422
      "5866095315090327914760325168219669828915074071456176066304457448"
423
      "25404691681749451640151380153");
1✔
424

425
   auto rng = Test::new_rng("ecies_ciphertext_too_short");
1✔
426

427
   const Botan::ECDH_PrivateKey private_key(*rng, domain, private_key_value);
1✔
428
   const Botan::ECDH_PrivateKey other_private_key(*rng, domain, other_private_key_value);
1✔
429

430
   const Botan::ECIES_System_Params ecies_params(
1✔
431
      private_key.domain(), "KDF1-18033(SHA-512)", "AES-256/CBC", 32, "HMAC(SHA-512)", 16);
1✔
432

433
   Botan::ECIES_Decryptor ecies_dec(other_private_key, ecies_params, *rng);
1✔
434

435
   result.test_throws("ciphertext too short",
2✔
436
                      [&ecies_dec]() { ecies_dec.decrypt(Botan::hex_decode("0401519EAA0489FF9D51E98E4C22349A")); });
2✔
437

438
   return result;
1✔
439
}
4✔
440

441
class ECIES_Unit_Tests final : public Test {
×
442
   public:
443
      std::vector<Test::Result> run() override {
1✔
444
         std::vector<Test::Result> results;
1✔
445

446
         std::vector<std::function<Test::Result()>> fns = {test_other_key_not_set,
1✔
447
                                                           test_kdf_not_found,
448
                                                           test_mac_not_found,
449
                                                           test_cipher_not_found,
450
                                                           test_system_params_short_ctor,
451
                                                           test_ciphertext_too_short};
7✔
452

453
         for(size_t i = 0; i != fns.size(); ++i) {
7✔
454
            try {
6✔
455
               results.emplace_back(fns[i]());
12✔
456
            } catch(std::exception& e) {
×
457
               results.emplace_back(Test::Result::Failure("ECIES unit tests " + std::to_string(i), e.what()));
×
458
            }
×
459
         }
460

461
         return results;
1✔
462
      }
2✔
463
};
464

465
BOTAN_REGISTER_TEST("pubkey", "ecies_unit", ECIES_Unit_Tests);
466

467
   #endif
468

469
#endif
470

471
}  // namespace
472

473
}  // namespace Botan_Tests
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc