| 1 |
// { dg-do run } |
| 2 |
// Test that binfos aren't erroneously shared between instantiations. |
| 3 |
|
| 4 |
class PK_CryptoSystem |
| 5 |
{ |
| 6 |
}; |
| 7 |
class PK_Encryptor : public virtual PK_CryptoSystem |
| 8 |
{ |
| 9 |
}; |
| 10 |
class PK_FixedLengthCryptoSystem : public virtual PK_CryptoSystem |
| 11 |
{ |
| 12 |
public: |
| 13 |
virtual unsigned int CipherTextLength() const =0; |
| 14 |
}; |
| 15 |
class PK_FixedLengthEncryptor : public virtual PK_Encryptor, public virtual PK_FixedLengthCryptoSystem |
| 16 |
{ |
| 17 |
}; |
| 18 |
class PK_SignatureSystem |
| 19 |
{ |
| 20 |
public: |
| 21 |
virtual ~PK_SignatureSystem() {} |
| 22 |
}; |
| 23 |
class PK_Signer : public virtual PK_SignatureSystem |
| 24 |
{ |
| 25 |
public: |
| 26 |
virtual void Sign() = 0; |
| 27 |
}; |
| 28 |
class PK_Verifier : public virtual PK_SignatureSystem |
| 29 |
{ |
| 30 |
}; |
| 31 |
class PK_Precomputation |
| 32 |
{ |
| 33 |
}; |
| 34 |
template <class T> class |
| 35 |
PK_WithPrecomputation : public T, public virtual PK_Precomputation |
| 36 |
{ |
| 37 |
}; |
| 38 |
typedef PK_WithPrecomputation<PK_FixedLengthEncryptor> PKWPFLE; |
| 39 |
typedef PK_WithPrecomputation<PK_Signer> PKWPS; |
| 40 |
template <class EC> class |
| 41 |
ECPublicKey : public PKWPFLE |
| 42 |
{ |
| 43 |
public: |
| 44 |
unsigned int CipherTextLength() const { return 1; } |
| 45 |
EC ec; |
| 46 |
}; |
| 47 |
template <class EC> |
| 48 |
class ECPrivateKey : public ECPublicKey<EC>, public PKWPS |
| 49 |
{ |
| 50 |
void Sign() {} |
| 51 |
int d; |
| 52 |
}; |
| 53 |
template <class EC> |
| 54 |
class ECKEP : public ECPrivateKey<EC> |
| 55 |
{ |
| 56 |
}; |
| 57 |
class GF2NT : public PK_CryptoSystem |
| 58 |
{ |
| 59 |
int t1; |
| 60 |
}; |
| 61 |
class EC2N : public PK_CryptoSystem |
| 62 |
{ |
| 63 |
GF2NT field; |
| 64 |
int a; |
| 65 |
}; |
| 66 |
template class ECKEP<EC2N>; |
| 67 |
template class ECKEP<int>; |
| 68 |
|
| 69 |
int |
| 70 |
main () |
| 71 |
{ |
| 72 |
ECKEP<EC2N> foo; |
| 73 |
|
| 74 |
return 0; |
| 75 |
} |
| 76 |
|