]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3908] Added a clear() function to SecBuf class
authorFrancis Dupont <fdupont@isc.org>
Mon, 22 Jun 2015 12:19:49 +0000 (14:19 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 22 Jun 2015 12:19:49 +0000 (14:19 +0200)
src/lib/cryptolink/openssl_common.h

index 065203724772138608bb7468619e9c5233b1d3af..fb19c9f2d66be8789760b9a6fd2581c0f7c02d75 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -78,6 +78,11 @@ public:
         vec_.resize(sz);
     };
 
+    void clear() {
+        std::memset(&vec_[0], 0, vec_.capacity() * sizeof(T));
+        vec_.clear();
+    }
+
     SecBuf& operator=(const SecBuf& x) {
         if (&x != *this) {
             vec_ = x.vec_;