Botan 3.9.0
Crypto and TLS for C&
tls_policy.cpp
Go to the documentation of this file.
1/*
2* Policies for TLS
3* (C) 2004-2010,2012,2015,2016 Jack Lloyd
4* 2016 Christian Mainka
5* 2017 Harry Reimann, Rohde & Schwarz Cybersecurity
6* 2022 René Meusel, Hannes Rantzsch - neXenio GmbH
7*
8* Botan is released under the Simplified BSD License (see license.txt)
9*/
10
11#include <botan/tls_policy.h>
12
13#include <botan/pk_keys.h>
14#include <botan/tls_algos.h>
15#include <botan/tls_ciphersuite.h>
16#include <botan/tls_exceptn.h>
17#include <botan/internal/stl_util.h>
18#include <optional>
19#include <sstream>
20
21namespace Botan::TLS {
22
24 return false;
25}
26
27std::vector<Signature_Scheme> Policy::allowed_signature_schemes() const {
28 std::vector<Signature_Scheme> schemes;
29
31 const bool sig_allowed = allowed_signature_method(scheme.algorithm_name());
32 const bool hash_allowed = allowed_signature_hash(scheme.hash_function_name());
33
34 if(sig_allowed && hash_allowed) {
35 schemes.push_back(scheme);
36 }
37 }
38
39 return schemes;
40}
41
42std::vector<Signature_Scheme> Policy::acceptable_signature_schemes() const {
43 return this->allowed_signature_schemes();
44}
45
46std::optional<std::vector<Signature_Scheme>> Policy::acceptable_certificate_signature_schemes() const {
47 // the restrictions of ::acceptable_signature_schemes() shall apply
48 return std::nullopt;
49}
50
51std::vector<std::string> Policy::allowed_ciphers() const {
52 return {
53 //"AES-256/OCB(12)",
54 "AES-256/GCM",
55 "AES-128/GCM",
56 "ChaCha20Poly1305",
57 //"AES-256/CCM",
58 //"AES-128/CCM",
59 //"AES-256/CCM(8)",
60 //"AES-128/CCM(8)",
61 //"Camellia-256/GCM",
62 //"Camellia-128/GCM",
63 //"ARIA-256/GCM",
64 //"ARIA-128/GCM",
65 //"AES-256",
66 //"AES-128",
67 //"3DES",
68 };
69}
70
71std::vector<std::string> Policy::allowed_signature_hashes() const {
72 return {
73 "SHA-512",
74 "SHA-384",
75 "SHA-256",
76 };
77}
78
79std::vector<std::string> Policy::allowed_macs() const {
80 /*
81 SHA-256 is preferred because the Lucky13 countermeasure works
82 somewhat better for SHA-256 vs SHA-384:
83 https://github.com/randombit/botan/pull/675
84 */
85 return {
86 "AEAD",
87 "SHA-256",
88 "SHA-384",
89 "SHA-1",
90 };
91}
92
93std::vector<std::string> Policy::allowed_key_exchange_methods() const {
94 return {
95 //"ECDHE_PSK",
96 //"PSK",
97 "ECDH",
98 "DH",
99 //"RSA",
100 };
101}
102
103std::vector<std::string> Policy::allowed_signature_methods() const {
104 return {
105 "ECDSA", "RSA",
106 //"IMPLICIT",
107 };
108}
109
110bool Policy::allowed_signature_method(std::string_view sig_method) const {
111 return value_exists(allowed_signature_methods(), sig_method);
112}
113
114bool Policy::allowed_signature_hash(std::string_view sig_hash) const {
115 return value_exists(allowed_signature_hashes(), sig_hash);
116}
117
119 return false;
120}
121
122Group_Params Policy::choose_key_exchange_group(const std::vector<Group_Params>& supported_by_peer,
123 const std::vector<Group_Params>& offered_by_peer) const {
124 if(supported_by_peer.empty()) {
125 return Group_Params::NONE;
126 }
127
128 const auto our_groups = key_exchange_groups();
129
130 // First check if the peer sent a PQ share of a group we also support
131 for(auto share : offered_by_peer) {
132 if(share.is_post_quantum() && value_exists(our_groups, share)) {
133 return share;
134 }
135 }
136
137 // Then check if the peer offered a PQ algo we also support
138 for(auto share : supported_by_peer) {
139 if(share.is_post_quantum() && value_exists(our_groups, share)) {
140 return share;
141 }
142 }
143
144 // Prefer groups that were offered by the peer for the sake of saving
145 // an additional round trip. For TLS 1.2, this won't be used.
146 for(auto g : offered_by_peer) {
147 if(value_exists(our_groups, g)) {
148 return g;
149 }
150 }
151
152 // If no pre-offered groups fit our supported set, we prioritize our
153 // own preference.
154 for(auto g : our_groups) {
155 if(value_exists(supported_by_peer, g)) {
156 return g;
157 }
158 }
159
160 return Group_Params::NONE;
161}
162
164 /*
165 * Return the first listed or just default to 2048
166 */
167 for(auto g : key_exchange_groups()) {
168 if(g.is_dh_named_group()) {
169 return g;
170 }
171 }
172
173 return Group_Params::FFDHE_2048;
174}
175
176std::vector<Group_Params> Policy::key_exchange_groups() const {
177 return {
178 // clang-format off
179#if defined(BOTAN_HAS_X25519)
180 Group_Params::X25519,
181#endif
182
183 Group_Params::SECP256R1,
184
185#if defined(BOTAN_HAS_ML_KEM) && defined(BOTAN_HAS_TLS_13_PQC)
186
187#if defined(BOTAN_HAS_X25519)
189#endif
190
193#endif
194
195#if defined(BOTAN_HAS_X448)
196 Group_Params::X448,
197#endif
198
199 Group_Params::SECP384R1,
200 Group_Params::SECP521R1,
201
202 Group_Params::BRAINPOOL256R1,
203 Group_Params::BRAINPOOL384R1,
204 Group_Params::BRAINPOOL512R1,
205
206 Group_Params::FFDHE_2048,
207 Group_Params::FFDHE_3072,
208
209 // clang-format on
210 };
211}
212
213std::vector<Group_Params> Policy::key_exchange_groups_to_offer() const {
214 std::vector<Group_Params> groups_to_offer;
215
216 const auto supported_groups = key_exchange_groups();
217 BOTAN_ASSERT(!supported_groups.empty(), "Policy allows at least one key exchange group");
218
219 /*
220 * Initially prefer sending a key share only of the first pure-ECC
221 * group, since these shares are small and PQ support is still not
222 * that widespread.
223 */
224 for(auto group : key_exchange_groups()) {
225 if(group.is_pure_ecc_group()) {
226 groups_to_offer.push_back(group);
227 break;
228 }
229 }
230
231 /*
232 * If for some reason no pure ECC groups are enabled then simply
233 * send a share of whatever the policys top preference is.
234 */
235 if(groups_to_offer.empty()) {
236 groups_to_offer.push_back(supported_groups.front());
237 }
238
239 return groups_to_offer;
240}
241
243 return 2048;
244}
245
247 // Here we are at the mercy of whatever the CA signed, but most certs should be 256 bit by now
248 return 256;
249}
250
252 // x25519 is smallest curve currently supported for TLS key exchange
253 return 255;
254}
255
257 return 110;
258}
259
261 return true;
262}
263
265 /* Default assumption is all end-entity certificates should
266 be at least 2048 bits these days.
267
268 If you are connecting to arbitrary servers on the Internet
269 (ie as a web browser or SMTP client) you'll probably have to reduce this
270 to 1024 bits, or perhaps even lower.
271 */
272 return 2048;
273}
274
275void Policy::check_peer_key_acceptable(const Public_Key& public_key) const {
276 const std::string algo_name = public_key.algo_name();
277
278 const size_t keylength = public_key.key_length();
279 size_t expected_keylength = 0;
280
281 if(algo_name == "RSA") {
282 expected_keylength = minimum_rsa_bits();
283 } else if(algo_name == "DH") {
284 expected_keylength = minimum_dh_group_size();
285 } else if(algo_name == "ECDH" || algo_name == "X25519" || algo_name == "X448") {
286 expected_keylength = minimum_ecdh_group_size();
287 } else if(algo_name == "ECDSA") {
288 expected_keylength = minimum_ecdsa_group_size();
289 }
290 // else some other algo, so leave expected_keylength as zero and the check is a no-op
291
292 if(keylength < expected_keylength) {
293 throw TLS_Exception(Alert::InsufficientSecurity,
294 "Peer sent " + std::to_string(keylength) + " bit " + algo_name +
295 " key"
296 ", policy requires at least " +
297 std::to_string(expected_keylength));
298 }
299}
300
302 return 1;
303}
304
305std::chrono::seconds Policy::session_ticket_lifetime() const {
306 return std::chrono::days(1);
307}
308
310 return false;
311}
312
314 return 1;
315}
316
318#if defined(BOTAN_HAS_TLS_13)
319 if(version == Protocol_Version::TLS_V13 && allow_tls13()) {
320 return true;
321 }
322#endif
323
324#if defined(BOTAN_HAS_TLS_12)
325 if(version == Protocol_Version::TLS_V12 && allow_tls12()) {
326 return true;
327 }
328
329 if(version == Protocol_Version::DTLS_V12 && allow_dtls12()) {
330 return true;
331 }
332#endif
333
334 return false;
335}
336
338 if(datagram) {
339 if(acceptable_protocol_version(Protocol_Version::DTLS_V12)) {
340 return Protocol_Version::DTLS_V12;
341 }
342 throw Invalid_State("Policy forbids all available DTLS version");
343 } else {
344#if defined(BOTAN_HAS_TLS_13)
345 if(acceptable_protocol_version(Protocol_Version::TLS_V13)) {
346 return Protocol_Version::TLS_V13;
347 }
348#endif
349 if(acceptable_protocol_version(Protocol_Version::TLS_V12)) {
350 return Protocol_Version::TLS_V12;
351 }
352 throw Invalid_State("Policy forbids all available TLS version");
353 }
354}
355
356bool Policy::acceptable_ciphersuite(const Ciphersuite& ciphersuite) const {
357 return value_exists(allowed_ciphers(), ciphersuite.cipher_algo()) &&
358 value_exists(allowed_macs(), ciphersuite.mac_algo());
359}
360
362 return false;
363}
364
366 return false;
367}
368
370 return false;
371}
372
374#if defined(BOTAN_HAS_TLS_12)
375 return true;
376#else
377 return false;
378#endif
379}
380
382#if defined(BOTAN_HAS_TLS_13)
383 return true;
384#else
385 return false;
386#endif
387}
388
390#if defined(BOTAN_HAS_TLS_12)
391 return true;
392#else
393 return false;
394#endif
395}
396
398 return true;
399}
400
402 return false;
403}
404
406 return true;
407}
408
410 return true;
411}
412
413std::optional<uint16_t> Policy::record_size_limit() const {
414 return std::nullopt;
415}
416
418 return true;
419}
420
422 return true;
423}
424
426 return true;
427}
428
430 return true;
431}
432
434 return true;
435}
436
438 return false;
439}
440
444
446 return false;
447}
448
449std::vector<Certificate_Type> Policy::accepted_client_certificate_types() const {
450 return {Certificate_Type::X509};
451}
452
453std::vector<Certificate_Type> Policy::accepted_server_certificate_types() const {
454 return {Certificate_Type::X509};
455}
456
458 return false;
459}
460
462 return 0;
463}
464
465// 1 second initial timeout, 60 second max - see RFC 6347 sec 4.2.4.1
467 return 1 * 1000;
468}
469
471 return 60 * 1000;
472}
473
475 // default MTU is IPv6 min MTU minus UDP/IP headers
476 return 1280 - 40 - 8;
477}
478
479std::vector<uint16_t> Policy::srtp_profiles() const {
480 return std::vector<uint16_t>();
481}
482
483namespace {
484
485class Ciphersuite_Preference_Ordering final {
486 public:
487 Ciphersuite_Preference_Ordering(const std::vector<std::string>& ciphers,
488 const std::vector<std::string>& macs,
489 const std::vector<std::string>& kex,
490 const std::vector<std::string>& sigs) :
491 m_ciphers(ciphers), m_macs(macs), m_kex(kex), m_sigs(sigs) {}
492
493 bool operator()(const Ciphersuite& a, const Ciphersuite& b) const {
494 if(a.kex_method() != b.kex_method()) {
495 for(const auto& i : m_kex) {
496 if(a.kex_algo() == i) {
497 return true;
498 }
499 if(b.kex_algo() == i) {
500 return false;
501 }
502 }
503 }
504
505 if(a.cipher_algo() != b.cipher_algo()) {
506 for(const auto& m_cipher : m_ciphers) {
507 if(a.cipher_algo() == m_cipher) {
508 return true;
509 }
510 if(b.cipher_algo() == m_cipher) {
511 return false;
512 }
513 }
514 }
515
516 if(a.cipher_keylen() != b.cipher_keylen()) {
517 if(a.cipher_keylen() < b.cipher_keylen()) {
518 return false;
519 }
520 if(a.cipher_keylen() > b.cipher_keylen()) {
521 return true;
522 }
523 }
524
525 if(a.auth_method() != b.auth_method()) {
526 for(const auto& m_sig : m_sigs) {
527 if(a.sig_algo() == m_sig) {
528 return true;
529 }
530 if(b.sig_algo() == m_sig) {
531 return false;
532 }
533 }
534 }
535
536 if(a.mac_algo() != b.mac_algo()) {
537 for(const auto& m_mac : m_macs) {
538 if(a.mac_algo() == m_mac) {
539 return true;
540 }
541 if(b.mac_algo() == m_mac) {
542 return false;
543 }
544 }
545 }
546
547 return false; // equal (?!?)
548 }
549
550 private:
551 std::vector<std::string> m_ciphers, m_macs, m_kex, m_sigs;
552};
553
554} // namespace
555
556std::vector<uint16_t> Policy::ciphersuite_list(Protocol_Version version) const {
557 const std::vector<std::string> ciphers = allowed_ciphers();
558 const std::vector<std::string> macs = allowed_macs();
559 const std::vector<std::string> kex = allowed_key_exchange_methods();
560 const std::vector<std::string> sigs = allowed_signature_methods();
561
562 std::vector<Ciphersuite> ciphersuites;
563
564 for(auto&& suite : Ciphersuite::all_known_ciphersuites()) {
565 // Can we use it?
566 if(!suite.valid()) {
567 continue;
568 }
569
570 // Can we use it in this version?
571 if(!suite.usable_in_version(version)) {
572 continue;
573 }
574
575 // Is it acceptable to the policy?
576 if(!this->acceptable_ciphersuite(suite)) {
577 continue;
578 }
579
580 if(!value_exists(ciphers, suite.cipher_algo())) {
581 continue; // unsupported cipher
582 }
583
584 // these checks are irrelevant for TLS 1.3
585 // TODO: consider making a method for this logic
586 if(version.is_pre_tls_13()) {
587 if(!value_exists(kex, suite.kex_algo())) {
588 continue; // unsupported key exchange
589 }
590
591 if(!value_exists(macs, suite.mac_algo())) {
592 continue; // unsupported MAC algo
593 }
594
595 if(!value_exists(sigs, suite.sig_algo())) {
596 // allow if it's an empty sig algo and we want to use PSK
597 if(suite.auth_method() != Auth_Method::IMPLICIT || !suite.psk_ciphersuite()) {
598 continue;
599 }
600 }
601 }
602
603 // OK, consider it
604 ciphersuites.push_back(suite);
605 }
606
607 if(ciphersuites.empty()) {
608 throw Invalid_State("Policy does not allow any available cipher suite");
609 }
610
611 Ciphersuite_Preference_Ordering order(ciphers, macs, kex, sigs);
612 std::sort(ciphersuites.begin(), ciphersuites.end(), order);
613
614 std::vector<uint16_t> ciphersuite_codes;
615 ciphersuite_codes.reserve(ciphersuites.size());
616 for(auto i : ciphersuites) {
617 ciphersuite_codes.push_back(i.ciphersuite_code());
618 }
619 return ciphersuite_codes;
620}
621
622namespace {
623
624void print_vec(std::ostream& o, const char* key, const std::vector<std::string>& v) {
625 o << key << " = ";
626 for(size_t i = 0; i != v.size(); ++i) {
627 o << v[i];
628 if(i != v.size() - 1) {
629 o << ' ';
630 }
631 }
632 o << '\n';
633}
634
635void print_vec(std::ostream& o, const char* key, const std::vector<Group_Params>& params) {
636 // first filter out any groups we don't have a name for:
637 std::vector<std::string> names;
638 for(auto p : params) {
639 if(auto name = p.to_string()) {
640 names.push_back(name.value());
641 }
642 }
643
644 o << key << " = ";
645
646 for(size_t i = 0; i != names.size(); ++i) {
647 o << names[i];
648 if(i != names.size() - 1) {
649 o << " ";
650 }
651 }
652 o << "\n";
653}
654
655void print_vec(std::ostream& o, const char* key, const std::vector<Certificate_Type>& types) {
656 o << key << " = ";
657 for(size_t i = 0; i != types.size(); ++i) {
658 o << certificate_type_to_string(types[i]);
659 if(i != types.size() - 1) {
660 o << ' ';
661 }
662 }
663 o << '\n';
664}
665
666void print_bool(std::ostream& o, const char* key, bool b) {
667 o << key << " = " << (b ? "true" : "false") << '\n';
668}
669
670} // namespace
671
672void Policy::print(std::ostream& o) const {
673 print_bool(o, "allow_tls12", allow_tls12());
674 print_bool(o, "allow_tls13", allow_tls13());
675 print_bool(o, "allow_dtls12", allow_dtls12());
676 print_bool(o, "allow_ssl_key_log_file", allow_ssl_key_log_file());
677 print_vec(o, "ciphers", allowed_ciphers());
678 print_vec(o, "macs", allowed_macs());
679 print_vec(o, "signature_hashes", allowed_signature_hashes());
680 print_vec(o, "signature_methods", allowed_signature_methods());
681 print_vec(o, "key_exchange_methods", allowed_key_exchange_methods());
682 print_vec(o, "key_exchange_groups", key_exchange_groups());
683 const auto groups_to_offer = key_exchange_groups_to_offer();
684 if(groups_to_offer.empty()) {
685 print_vec(o, "key_exchange_groups_to_offer", {std::string("none")});
686 } else {
687 print_vec(o, "key_exchange_groups_to_offer", groups_to_offer);
688 }
689 print_bool(o, "allow_insecure_renegotiation", allow_insecure_renegotiation());
690 print_bool(o, "include_time_in_hello_random", include_time_in_hello_random());
691 print_bool(o, "allow_server_initiated_renegotiation", allow_server_initiated_renegotiation());
692 print_bool(o, "hide_unknown_users", hide_unknown_users());
693 print_bool(o, "server_uses_own_ciphersuite_preferences", server_uses_own_ciphersuite_preferences());
694 print_bool(o, "negotiate_encrypt_then_mac", negotiate_encrypt_then_mac());
695 print_bool(o, "support_cert_status_message", support_cert_status_message());
696 print_bool(o, "tls_13_middlebox_compatibility_mode", tls_13_middlebox_compatibility_mode());
697 print_vec(o, "accepted_client_certificate_types", accepted_client_certificate_types());
698 print_vec(o, "accepted_server_certificate_types", accepted_server_certificate_types());
699 print_bool(o, "hash_hello_random", hash_hello_random());
700 if(record_size_limit().has_value()) {
701 o << "record_size_limit = " << record_size_limit().value() << '\n';
702 }
703 o << "maximum_session_tickets_per_client_hello = " << maximum_session_tickets_per_client_hello() << '\n';
704 o << "session_ticket_lifetime = " << session_ticket_lifetime().count() << '\n';
705 print_bool(o, "reuse_session_tickets", reuse_session_tickets());
706 o << "new_session_tickets_upon_handshake_success = " << new_session_tickets_upon_handshake_success() << '\n';
707 o << "minimum_dh_group_size = " << minimum_dh_group_size() << '\n';
708 o << "minimum_ecdh_group_size = " << minimum_ecdh_group_size() << '\n';
709 o << "minimum_rsa_bits = " << minimum_rsa_bits() << '\n';
710 o << "minimum_signature_strength = " << minimum_signature_strength() << '\n';
711}
712
713std::string Policy::to_string() const {
714 std::ostringstream oss;
715 this->print(oss);
716 return oss.str();
717}
718
719std::vector<std::string> Strict_Policy::allowed_ciphers() const {
720 return {"AES-256/GCM", "AES-128/GCM", "ChaCha20Poly1305"};
721}
722
723std::vector<std::string> Strict_Policy::allowed_signature_hashes() const {
724 return {"SHA-512", "SHA-384"};
725}
726
727std::vector<std::string> Strict_Policy::allowed_macs() const {
728 return {"AEAD"};
729}
730
731std::vector<std::string> Strict_Policy::allowed_key_exchange_methods() const {
732 return {"ECDH"};
733}
734
735} // namespace Botan::TLS
#define BOTAN_ASSERT(expr, assertion_made)
Definition assert.h:62
virtual std::string algo_name() const =0
virtual size_t key_length() const =0
static const std::vector< Ciphersuite > & all_known_ciphersuites()
std::string mac_algo() const
std::string cipher_algo() const
virtual bool include_time_in_hello_random() const
virtual void check_peer_key_acceptable(const Public_Key &public_key) const
virtual bool abort_connection_on_undesired_renegotiation() const
virtual size_t dtls_maximum_timeout() const
virtual size_t minimum_ecdh_group_size() const
virtual size_t dtls_default_mtu() const
virtual bool allow_tls12() const
virtual std::vector< Signature_Scheme > allowed_signature_schemes() const
std::string to_string() const
virtual bool reuse_session_tickets() const
virtual std::vector< uint16_t > ciphersuite_list(Protocol_Version version) const
virtual std::vector< Certificate_Type > accepted_server_certificate_types() const
virtual std::vector< Certificate_Type > accepted_client_certificate_types() const
bool allowed_signature_method(std::string_view sig_method) const
virtual bool require_client_certificate_authentication() const
virtual std::vector< Group_Params > key_exchange_groups() const
virtual size_t new_session_tickets_upon_handshake_success() const
virtual std::vector< Group_Params > key_exchange_groups_to_offer() const
bool allowed_signature_hash(std::string_view hash) const
virtual size_t minimum_rsa_bits() const
virtual bool tls_13_middlebox_compatibility_mode() const
virtual bool only_resume_with_exact_version() const
virtual bool allow_client_initiated_renegotiation() const
virtual bool allow_ssl_key_log_file() const
virtual bool allow_dtls_epoch0_restart() const
virtual bool request_client_certificate_authentication() const
virtual bool require_cert_revocation_info() const
virtual bool negotiate_encrypt_then_mac() const
virtual bool server_uses_own_ciphersuite_preferences() const
virtual Protocol_Version latest_supported_version(bool datagram) const
virtual bool acceptable_protocol_version(Protocol_Version version) const
virtual std::vector< uint16_t > srtp_profiles() const
virtual bool support_cert_status_message() const
virtual bool acceptable_ciphersuite(const Ciphersuite &suite) const
virtual std::vector< std::string > allowed_macs() const
virtual bool hide_unknown_users() const
virtual std::optional< std::vector< Signature_Scheme > > acceptable_certificate_signature_schemes() const
virtual bool hash_hello_random() const
virtual bool allow_tls13() const
virtual std::vector< std::string > allowed_key_exchange_methods() const
virtual size_t dtls_initial_timeout() const
virtual size_t maximum_session_tickets_per_client_hello() const
virtual std::vector< Signature_Scheme > acceptable_signature_schemes() const
virtual bool use_ecc_point_compression() const
virtual bool allow_dtls12() const
virtual size_t minimum_dh_group_size() const
virtual bool allow_insecure_renegotiation() const
virtual std::optional< uint16_t > record_size_limit() const
virtual std::vector< std::string > allowed_ciphers() const
virtual std::chrono::seconds session_ticket_lifetime() const
virtual size_t minimum_signature_strength() const
virtual Group_Params default_dh_group() const
virtual size_t maximum_certificate_chain_size() const
virtual std::vector< std::string > allowed_signature_methods() const
virtual size_t minimum_ecdsa_group_size() const
virtual Group_Params choose_key_exchange_group(const std::vector< Group_Params > &supported_by_peer, const std::vector< Group_Params > &offered_by_peer) const
virtual bool allow_resumption_for_renegotiation() const
virtual std::vector< std::string > allowed_signature_hashes() const
virtual bool allow_server_initiated_renegotiation() const
virtual void print(std::ostream &o) const
static const std::vector< Signature_Scheme > & all_available_schemes()
std::vector< std::string > allowed_macs() const override
std::vector< std::string > allowed_ciphers() const override
std::vector< std::string > allowed_key_exchange_methods() const override
std::vector< std::string > allowed_signature_hashes() const override
std::string certificate_type_to_string(Certificate_Type type)
bool value_exists(const std::vector< T > &vec, const OT &val)
Definition stl_util.h:52