1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
4 typedef unsigned char uint8_t;
5 typedef unsigned int uint32_t;
7 typedef uint32_t u32bit;
8 __extension__ typedef __SIZE_TYPE__ size_t;
10 extern void __warn_memset_zero_len (void) __attribute__((__warning__ ("")));
11 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
12 void * memset (void *__dest, int __ch, size_t __len) throw () {
13 if (__builtin_constant_p (__len) && __len == 0)
14 __warn_memset_zero_len (); /* { dg-warning "" } */
17 inline void clear_mem(void* ptr, u32bit n) {
20 template<typename T> class MemoryRegion {
24 const T* begin() const {
26 void set(const T in[], u32bit n) {
29 void set(const MemoryRegion<T>& in) {
30 set(in.begin(), in.size());
33 clear_mem(buf, allocated);
41 mutable u32bit allocated;
43 template<typename T> void MemoryRegion<T>::create(u32bit n) {
48 template<typename T> class SecureVector : public MemoryRegion<T> {
50 SecureVector<T>& operator=(const MemoryRegion<T>& in) {
51 if(this != &in) set(in);
56 SecureVector<byte> bits_of() const {
58 OctetString& operator^=(const OctetString&);
59 void change(const MemoryRegion<byte>& in) {
62 OctetString(const MemoryRegion<byte>& in) {
65 SecureVector<byte> bits;
67 OctetString& OctetString::operator^=(const OctetString& k) {
72 bool operator==(const OctetString& s1, const OctetString& s2) {
73 return (s1.bits_of() == s2.bits_of());