Parcourir la source

[3908] Added a clear() function to SecBuf class

Francis Dupont il y a 9 ans
Parent
commit
277912a7d6
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. 6 1
      src/lib/cryptolink/openssl_common.h

+ 6 - 1
src/lib/cryptolink/openssl_common.h

@@ -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_;