| @@ -70,7 +70,7 @@ private: | |||||
| template<class T, Prehashed Ph> friend class Signing; | template<class T, Prehashed Ph> friend class Signing; | ||||
| template<class T, Prehashed Ph> friend class Verification; | template<class T, Prehashed Ph> friend class Verification; | ||||
| void init() throw(LengthException) { | |||||
| void init() /*throw(LengthException)*/ { | |||||
| Super::reset(); | Super::reset(); | ||||
| if (context_.size() > 255) { | if (context_.size() > 255) { | ||||
| @@ -85,7 +85,7 @@ public: | |||||
| static const size_t OUTPUT_BYTES = Super::DEFAULT_OUTPUT_BYTES; | static const size_t OUTPUT_BYTES = Super::DEFAULT_OUTPUT_BYTES; | ||||
| /** Create the prehash */ | /** Create the prehash */ | ||||
| Prehash(const Block &context = NO_CONTEXT()) throw(LengthException) { | |||||
| Prehash(const Block &context = NO_CONTEXT()) /*throw(LengthException)*/ { | |||||
| context_ = context; | context_ = context; | ||||
| init(); | init(); | ||||
| } | } | ||||
| @@ -94,14 +94,14 @@ public: | |||||
| void reset() DECAF_NOEXCEPT { init(); } | void reset() DECAF_NOEXCEPT { init(); } | ||||
| /** Output from this hash */ | /** Output from this hash */ | ||||
| SecureBuffer final() throw(std::bad_alloc) { | |||||
| SecureBuffer final() /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer ret = Super::final(OUTPUT_BYTES); | SecureBuffer ret = Super::final(OUTPUT_BYTES); | ||||
| reset(); | reset(); | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| /** Output from this hash */ | /** Output from this hash */ | ||||
| void final(Buffer &b) throw(LengthException) { | |||||
| void final(Buffer &b) /*throw(LengthException)*/ { | |||||
| if (b.size() != OUTPUT_BYTES) throw LengthException(); | if (b.size() != OUTPUT_BYTES) throw LengthException(); | ||||
| Super::final(b); | Super::final(b); | ||||
| reset(); | reset(); | ||||
| @@ -70,7 +70,7 @@ private: | |||||
| template<class T, Prehashed Ph> friend class Signing; | template<class T, Prehashed Ph> friend class Signing; | ||||
| template<class T, Prehashed Ph> friend class Verification; | template<class T, Prehashed Ph> friend class Verification; | ||||
| void init() throw(LengthException) { | |||||
| void init() /*throw(LengthException)*/ { | |||||
| Super::reset(); | Super::reset(); | ||||
| if (context_.size() > 255) { | if (context_.size() > 255) { | ||||
| @@ -85,7 +85,7 @@ public: | |||||
| static const size_t OUTPUT_BYTES = Super::DEFAULT_OUTPUT_BYTES; | static const size_t OUTPUT_BYTES = Super::DEFAULT_OUTPUT_BYTES; | ||||
| /** Create the prehash */ | /** Create the prehash */ | ||||
| Prehash(const Block &context = NO_CONTEXT()) throw(LengthException) { | |||||
| Prehash(const Block &context = NO_CONTEXT()) /*throw(LengthException)*/ { | |||||
| context_ = context; | context_ = context; | ||||
| init(); | init(); | ||||
| } | } | ||||
| @@ -94,14 +94,14 @@ public: | |||||
| void reset() DECAF_NOEXCEPT { init(); } | void reset() DECAF_NOEXCEPT { init(); } | ||||
| /** Output from this hash */ | /** Output from this hash */ | ||||
| SecureBuffer final() throw(std::bad_alloc) { | |||||
| SecureBuffer final() /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer ret = Super::final(OUTPUT_BYTES); | SecureBuffer ret = Super::final(OUTPUT_BYTES); | ||||
| reset(); | reset(); | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| /** Output from this hash */ | /** Output from this hash */ | ||||
| void final(Buffer &b) throw(LengthException) { | |||||
| void final(Buffer &b) /*throw(LengthException)*/ { | |||||
| if (b.size() != OUTPUT_BYTES) throw LengthException(); | if (b.size() != OUTPUT_BYTES) throw LengthException(); | ||||
| Super::final(b); | Super::final(b); | ||||
| reset(); | reset(); | ||||
| @@ -186,7 +186,7 @@ public: | |||||
| /** Invert with Fermat's Little Theorem (slow!). If *this == 0, | /** Invert with Fermat's Little Theorem (slow!). If *this == 0, | ||||
| * throw CryptoException. */ | * throw CryptoException. */ | ||||
| inline Scalar inverse() const throw(CryptoException) { | |||||
| inline Scalar inverse() const /*throw(CryptoException)*/ { | |||||
| Scalar r; | Scalar r; | ||||
| if (DECAF_SUCCESS != decaf_255_scalar_invert(r.s,s)) { | if (DECAF_SUCCESS != decaf_255_scalar_invert(r.s,s)) { | ||||
| throw CryptoException(); | throw CryptoException(); | ||||
| @@ -202,10 +202,10 @@ public: | |||||
| } | } | ||||
| /** Divide by inverting q. If q == 0, return 0. */ | /** Divide by inverting q. If q == 0, return 0. */ | ||||
| inline Scalar operator/ (const Scalar &q) const throw(CryptoException) { return *this * q.inverse(); } | |||||
| inline Scalar operator/ (const Scalar &q) const /*throw(CryptoException)*/ { return *this * q.inverse(); } | |||||
| /** Divide by inverting q. If q == 0, return 0. */ | /** Divide by inverting q. If q == 0, return 0. */ | ||||
| inline Scalar &operator/=(const Scalar &q) throw(CryptoException) { return *this *= q.inverse(); } | |||||
| inline Scalar &operator/=(const Scalar &q) /*throw(CryptoException)*/ { return *this *= q.inverse(); } | |||||
| /** Return half this scalar. Much faster than /2. */ | /** Return half this scalar. Much faster than /2. */ | ||||
| inline Scalar half() const { Scalar out; decaf_255_scalar_halve(out.s,s); return out; } | inline Scalar half() const { Scalar out; decaf_255_scalar_halve(out.s,s); return out; } | ||||
| @@ -227,7 +227,7 @@ public: | |||||
| const Block &in, | const Block &in, | ||||
| decaf_bool_t allow_identity=DECAF_FALSE, | decaf_bool_t allow_identity=DECAF_FALSE, | ||||
| decaf_bool_t short_circuit=DECAF_TRUE | decaf_bool_t short_circuit=DECAF_TRUE | ||||
| ) const throw(CryptoException); | |||||
| ) const /*throw(CryptoException)*/; | |||||
| }; | }; | ||||
| /** | /** | ||||
| @@ -300,7 +300,7 @@ public: | |||||
| * or was the identity and allow_identity was DECAF_FALSE. | * or was the identity and allow_identity was DECAF_FALSE. | ||||
| */ | */ | ||||
| inline explicit Point(const FixedBlock<SER_BYTES> &buffer, decaf_bool_t allow_identity=DECAF_TRUE) | inline explicit Point(const FixedBlock<SER_BYTES> &buffer, decaf_bool_t allow_identity=DECAF_TRUE) | ||||
| throw(CryptoException) { | |||||
| /*throw(CryptoException)*/ { | |||||
| if (DECAF_SUCCESS != decode(buffer,allow_identity)) { | if (DECAF_SUCCESS != decode(buffer,allow_identity)) { | ||||
| throw CryptoException(); | throw CryptoException(); | ||||
| } | } | ||||
| @@ -336,7 +336,7 @@ public: | |||||
| inline void decode_like_eddsa_and_ignore_cofactor ( | inline void decode_like_eddsa_and_ignore_cofactor ( | ||||
| const FixedBlock<DECAF_EDDSA_25519_PUBLIC_BYTES> &buffer | const FixedBlock<DECAF_EDDSA_25519_PUBLIC_BYTES> &buffer | ||||
| ) throw(CryptoException) { | |||||
| ) /*throw(CryptoException)*/ { | |||||
| if (DECAF_SUCCESS != decode_like_eddsa_and_ignore_cofactor_noexcept(buffer)) throw(CryptoException()); | if (DECAF_SUCCESS != decode_like_eddsa_and_ignore_cofactor_noexcept(buffer)) throw(CryptoException()); | ||||
| } | } | ||||
| @@ -430,10 +430,10 @@ public: | |||||
| inline Point &operator*=(const Scalar &s) DECAF_NOEXCEPT { decaf_255_point_scalarmul(p,p,s.s); return *this; } | inline Point &operator*=(const Scalar &s) DECAF_NOEXCEPT { decaf_255_point_scalarmul(p,p,s.s); return *this; } | ||||
| /** Multiply by s.inverse(). If s=0, maps to the identity. */ | /** Multiply by s.inverse(). If s=0, maps to the identity. */ | ||||
| inline Point operator/ (const Scalar &s) const throw(CryptoException) { return (*this) * s.inverse(); } | |||||
| inline Point operator/ (const Scalar &s) const /*throw(CryptoException)*/ { return (*this) * s.inverse(); } | |||||
| /** Multiply by s.inverse(). If s=0, maps to the identity. */ | /** Multiply by s.inverse(). If s=0, maps to the identity. */ | ||||
| inline Point &operator/=(const Scalar &s) throw(CryptoException) { return (*this) *= s.inverse(); } | |||||
| inline Point &operator/=(const Scalar &s) /*throw(CryptoException)*/ { return (*this) *= s.inverse(); } | |||||
| /** Validate / sanity check */ | /** Validate / sanity check */ | ||||
| inline bool validate() const DECAF_NOEXCEPT { return decaf_255_point_valid(p); } | inline bool validate() const DECAF_NOEXCEPT { return decaf_255_point_valid(p); } | ||||
| @@ -518,7 +518,7 @@ public: | |||||
| } | } | ||||
| /** Steganographically encode this */ | /** Steganographically encode this */ | ||||
| inline SecureBuffer steg_encode(Rng &rng, size_t size=STEG_BYTES) const throw(std::bad_alloc, LengthException) { | |||||
| inline SecureBuffer steg_encode(Rng &rng, size_t size=STEG_BYTES) const /*throw(std::bad_alloc, LengthException)*/ { | |||||
| if (size <= HASH_BYTES + 4 || size > 2*HASH_BYTES) throw LengthException(); | if (size <= HASH_BYTES + 4 || size > 2*HASH_BYTES) throw LengthException(); | ||||
| SecureBuffer out(STEG_BYTES); | SecureBuffer out(STEG_BYTES); | ||||
| decaf_error_t done; | decaf_error_t done; | ||||
| @@ -596,7 +596,7 @@ public: | |||||
| /** | /** | ||||
| * Initilaize from point. Must allocate memory, and may throw. | * Initilaize from point. Must allocate memory, and may throw. | ||||
| */ | */ | ||||
| inline Precomputed &operator=(const Point &it) throw(std::bad_alloc) { | |||||
| inline Precomputed &operator=(const Point &it) /*throw(std::bad_alloc)*/ { | |||||
| alloc(); | alloc(); | ||||
| decaf_255_precompute(ours.mine,it.p); | decaf_255_precompute(ours.mine,it.p); | ||||
| return *this; | return *this; | ||||
| @@ -605,20 +605,20 @@ public: | |||||
| /** | /** | ||||
| * Copy constructor. | * Copy constructor. | ||||
| */ | */ | ||||
| inline Precomputed(const Precomputed &it) throw(std::bad_alloc) | |||||
| inline Precomputed(const Precomputed &it) /*throw(std::bad_alloc)*/ | |||||
| : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | ||||
| /** | /** | ||||
| * Constructor which initializes from point. | * Constructor which initializes from point. | ||||
| */ | */ | ||||
| inline explicit Precomputed(const Point &it) throw(std::bad_alloc) | |||||
| inline explicit Precomputed(const Point &it) /*throw(std::bad_alloc)*/ | |||||
| : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | ||||
| /** Fixed base scalarmul. */ | /** Fixed base scalarmul. */ | ||||
| inline Point operator* (const Scalar &s) const DECAF_NOEXCEPT { Point r; decaf_255_precomputed_scalarmul(r.p,get(),s.s); return r; } | inline Point operator* (const Scalar &s) const DECAF_NOEXCEPT { Point r; decaf_255_precomputed_scalarmul(r.p,get(),s.s); return r; } | ||||
| /** Multiply by s.inverse(). If s=0, maps to the identity. */ | /** Multiply by s.inverse(). If s=0, maps to the identity. */ | ||||
| inline Point operator/ (const Scalar &s) const throw(CryptoException) { return (*this) * s.inverse(); } | |||||
| inline Point operator/ (const Scalar &s) const /*throw(CryptoException)*/ { return (*this) * s.inverse(); } | |||||
| /** Return the table for the base point. */ | /** Return the table for the base point. */ | ||||
| static inline const Precomputed base() DECAF_NOEXCEPT { return Precomputed(); } | static inline const Precomputed base() DECAF_NOEXCEPT { return Precomputed(); } | ||||
| @@ -649,7 +649,7 @@ public: | |||||
| static inline SecureBuffer shared_secret( | static inline SecureBuffer shared_secret( | ||||
| const FixedBlock<PUBLIC_BYTES> &pk, | const FixedBlock<PUBLIC_BYTES> &pk, | ||||
| const FixedBlock<PRIVATE_BYTES> &scalar | const FixedBlock<PRIVATE_BYTES> &scalar | ||||
| ) throw(std::bad_alloc,CryptoException) { | |||||
| ) /*throw(std::bad_alloc,CryptoException)*/ { | |||||
| SecureBuffer out(PUBLIC_BYTES); | SecureBuffer out(PUBLIC_BYTES); | ||||
| if (DECAF_SUCCESS != decaf_x25519(out.data(), pk.data(), scalar.data())) { | if (DECAF_SUCCESS != decaf_x25519(out.data(), pk.data(), scalar.data())) { | ||||
| throw CryptoException(); | throw CryptoException(); | ||||
| @@ -674,7 +674,7 @@ public: | |||||
| static inline SecureBuffer DECAF_DEPRECATED("Renamed to derive_public_key") | static inline SecureBuffer DECAF_DEPRECATED("Renamed to derive_public_key") | ||||
| generate_key( | generate_key( | ||||
| const FixedBlock<PRIVATE_BYTES> &scalar | const FixedBlock<PRIVATE_BYTES> &scalar | ||||
| ) throw(std::bad_alloc) { | |||||
| ) /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(PUBLIC_BYTES); | SecureBuffer out(PUBLIC_BYTES); | ||||
| decaf_x25519_derive_public_key(out.data(), scalar.data()); | decaf_x25519_derive_public_key(out.data(), scalar.data()); | ||||
| return out; | return out; | ||||
| @@ -685,7 +685,7 @@ public: | |||||
| */ | */ | ||||
| static inline SecureBuffer derive_public_key( | static inline SecureBuffer derive_public_key( | ||||
| const FixedBlock<PRIVATE_BYTES> &scalar | const FixedBlock<PRIVATE_BYTES> &scalar | ||||
| ) throw(std::bad_alloc) { | |||||
| ) /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(PUBLIC_BYTES); | SecureBuffer out(PUBLIC_BYTES); | ||||
| decaf_x25519_derive_public_key(out.data(), scalar.data()); | decaf_x25519_derive_public_key(out.data(), scalar.data()); | ||||
| return out; | return out; | ||||
| @@ -722,7 +722,7 @@ inline SecureBuffer IsoEd25519::Scalar::direct_scalarmul ( | |||||
| const Block &in, | const Block &in, | ||||
| decaf_bool_t allow_identity, | decaf_bool_t allow_identity, | ||||
| decaf_bool_t short_circuit | decaf_bool_t short_circuit | ||||
| ) const throw(CryptoException) { | |||||
| ) const /*throw(CryptoException)*/ { | |||||
| SecureBuffer out(IsoEd25519::Point::SER_BYTES); | SecureBuffer out(IsoEd25519::Point::SER_BYTES); | ||||
| if (DECAF_SUCCESS != | if (DECAF_SUCCESS != | ||||
| decaf_255_direct_scalarmul(out.data(), in.data(), s, allow_identity, short_circuit) | decaf_255_direct_scalarmul(out.data(), in.data(), s, allow_identity, short_circuit) | ||||
| @@ -186,7 +186,7 @@ public: | |||||
| /** Invert with Fermat's Little Theorem (slow!). If *this == 0, | /** Invert with Fermat's Little Theorem (slow!). If *this == 0, | ||||
| * throw CryptoException. */ | * throw CryptoException. */ | ||||
| inline Scalar inverse() const throw(CryptoException) { | |||||
| inline Scalar inverse() const /*throw(CryptoException)*/ { | |||||
| Scalar r; | Scalar r; | ||||
| if (DECAF_SUCCESS != decaf_448_scalar_invert(r.s,s)) { | if (DECAF_SUCCESS != decaf_448_scalar_invert(r.s,s)) { | ||||
| throw CryptoException(); | throw CryptoException(); | ||||
| @@ -202,10 +202,10 @@ public: | |||||
| } | } | ||||
| /** Divide by inverting q. If q == 0, return 0. */ | /** Divide by inverting q. If q == 0, return 0. */ | ||||
| inline Scalar operator/ (const Scalar &q) const throw(CryptoException) { return *this * q.inverse(); } | |||||
| inline Scalar operator/ (const Scalar &q) const /*throw(CryptoException)*/ { return *this * q.inverse(); } | |||||
| /** Divide by inverting q. If q == 0, return 0. */ | /** Divide by inverting q. If q == 0, return 0. */ | ||||
| inline Scalar &operator/=(const Scalar &q) throw(CryptoException) { return *this *= q.inverse(); } | |||||
| inline Scalar &operator/=(const Scalar &q) /*throw(CryptoException)*/ { return *this *= q.inverse(); } | |||||
| /** Return half this scalar. Much faster than /2. */ | /** Return half this scalar. Much faster than /2. */ | ||||
| inline Scalar half() const { Scalar out; decaf_448_scalar_halve(out.s,s); return out; } | inline Scalar half() const { Scalar out; decaf_448_scalar_halve(out.s,s); return out; } | ||||
| @@ -227,7 +227,7 @@ public: | |||||
| const Block &in, | const Block &in, | ||||
| decaf_bool_t allow_identity=DECAF_FALSE, | decaf_bool_t allow_identity=DECAF_FALSE, | ||||
| decaf_bool_t short_circuit=DECAF_TRUE | decaf_bool_t short_circuit=DECAF_TRUE | ||||
| ) const throw(CryptoException); | |||||
| ) const /*throw(CryptoException)*/; | |||||
| }; | }; | ||||
| /** | /** | ||||
| @@ -300,7 +300,7 @@ public: | |||||
| * or was the identity and allow_identity was DECAF_FALSE. | * or was the identity and allow_identity was DECAF_FALSE. | ||||
| */ | */ | ||||
| inline explicit Point(const FixedBlock<SER_BYTES> &buffer, decaf_bool_t allow_identity=DECAF_TRUE) | inline explicit Point(const FixedBlock<SER_BYTES> &buffer, decaf_bool_t allow_identity=DECAF_TRUE) | ||||
| throw(CryptoException) { | |||||
| /*throw(CryptoException)*/ { | |||||
| if (DECAF_SUCCESS != decode(buffer,allow_identity)) { | if (DECAF_SUCCESS != decode(buffer,allow_identity)) { | ||||
| throw CryptoException(); | throw CryptoException(); | ||||
| } | } | ||||
| @@ -336,7 +336,7 @@ public: | |||||
| inline void decode_like_eddsa_and_ignore_cofactor ( | inline void decode_like_eddsa_and_ignore_cofactor ( | ||||
| const FixedBlock<DECAF_EDDSA_448_PUBLIC_BYTES> &buffer | const FixedBlock<DECAF_EDDSA_448_PUBLIC_BYTES> &buffer | ||||
| ) throw(CryptoException) { | |||||
| ) /*throw(CryptoException)*/ { | |||||
| if (DECAF_SUCCESS != decode_like_eddsa_and_ignore_cofactor_noexcept(buffer)) throw(CryptoException()); | if (DECAF_SUCCESS != decode_like_eddsa_and_ignore_cofactor_noexcept(buffer)) throw(CryptoException()); | ||||
| } | } | ||||
| @@ -430,10 +430,10 @@ public: | |||||
| inline Point &operator*=(const Scalar &s) DECAF_NOEXCEPT { decaf_448_point_scalarmul(p,p,s.s); return *this; } | inline Point &operator*=(const Scalar &s) DECAF_NOEXCEPT { decaf_448_point_scalarmul(p,p,s.s); return *this; } | ||||
| /** Multiply by s.inverse(). If s=0, maps to the identity. */ | /** Multiply by s.inverse(). If s=0, maps to the identity. */ | ||||
| inline Point operator/ (const Scalar &s) const throw(CryptoException) { return (*this) * s.inverse(); } | |||||
| inline Point operator/ (const Scalar &s) const /*throw(CryptoException)*/ { return (*this) * s.inverse(); } | |||||
| /** Multiply by s.inverse(). If s=0, maps to the identity. */ | /** Multiply by s.inverse(). If s=0, maps to the identity. */ | ||||
| inline Point &operator/=(const Scalar &s) throw(CryptoException) { return (*this) *= s.inverse(); } | |||||
| inline Point &operator/=(const Scalar &s) /*throw(CryptoException)*/ { return (*this) *= s.inverse(); } | |||||
| /** Validate / sanity check */ | /** Validate / sanity check */ | ||||
| inline bool validate() const DECAF_NOEXCEPT { return decaf_448_point_valid(p); } | inline bool validate() const DECAF_NOEXCEPT { return decaf_448_point_valid(p); } | ||||
| @@ -518,7 +518,7 @@ public: | |||||
| } | } | ||||
| /** Steganographically encode this */ | /** Steganographically encode this */ | ||||
| inline SecureBuffer steg_encode(Rng &rng, size_t size=STEG_BYTES) const throw(std::bad_alloc, LengthException) { | |||||
| inline SecureBuffer steg_encode(Rng &rng, size_t size=STEG_BYTES) const /*throw(std::bad_alloc, LengthException)*/ { | |||||
| if (size <= HASH_BYTES + 4 || size > 2*HASH_BYTES) throw LengthException(); | if (size <= HASH_BYTES + 4 || size > 2*HASH_BYTES) throw LengthException(); | ||||
| SecureBuffer out(STEG_BYTES); | SecureBuffer out(STEG_BYTES); | ||||
| decaf_error_t done; | decaf_error_t done; | ||||
| @@ -596,7 +596,7 @@ public: | |||||
| /** | /** | ||||
| * Initilaize from point. Must allocate memory, and may throw. | * Initilaize from point. Must allocate memory, and may throw. | ||||
| */ | */ | ||||
| inline Precomputed &operator=(const Point &it) throw(std::bad_alloc) { | |||||
| inline Precomputed &operator=(const Point &it) /*throw(std::bad_alloc)*/ { | |||||
| alloc(); | alloc(); | ||||
| decaf_448_precompute(ours.mine,it.p); | decaf_448_precompute(ours.mine,it.p); | ||||
| return *this; | return *this; | ||||
| @@ -605,20 +605,20 @@ public: | |||||
| /** | /** | ||||
| * Copy constructor. | * Copy constructor. | ||||
| */ | */ | ||||
| inline Precomputed(const Precomputed &it) throw(std::bad_alloc) | |||||
| inline Precomputed(const Precomputed &it) /*throw(std::bad_alloc)*/ | |||||
| : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | ||||
| /** | /** | ||||
| * Constructor which initializes from point. | * Constructor which initializes from point. | ||||
| */ | */ | ||||
| inline explicit Precomputed(const Point &it) throw(std::bad_alloc) | |||||
| inline explicit Precomputed(const Point &it) /*throw(std::bad_alloc)*/ | |||||
| : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | ||||
| /** Fixed base scalarmul. */ | /** Fixed base scalarmul. */ | ||||
| inline Point operator* (const Scalar &s) const DECAF_NOEXCEPT { Point r; decaf_448_precomputed_scalarmul(r.p,get(),s.s); return r; } | inline Point operator* (const Scalar &s) const DECAF_NOEXCEPT { Point r; decaf_448_precomputed_scalarmul(r.p,get(),s.s); return r; } | ||||
| /** Multiply by s.inverse(). If s=0, maps to the identity. */ | /** Multiply by s.inverse(). If s=0, maps to the identity. */ | ||||
| inline Point operator/ (const Scalar &s) const throw(CryptoException) { return (*this) * s.inverse(); } | |||||
| inline Point operator/ (const Scalar &s) const /*throw(CryptoException)*/ { return (*this) * s.inverse(); } | |||||
| /** Return the table for the base point. */ | /** Return the table for the base point. */ | ||||
| static inline const Precomputed base() DECAF_NOEXCEPT { return Precomputed(); } | static inline const Precomputed base() DECAF_NOEXCEPT { return Precomputed(); } | ||||
| @@ -649,7 +649,7 @@ public: | |||||
| static inline SecureBuffer shared_secret( | static inline SecureBuffer shared_secret( | ||||
| const FixedBlock<PUBLIC_BYTES> &pk, | const FixedBlock<PUBLIC_BYTES> &pk, | ||||
| const FixedBlock<PRIVATE_BYTES> &scalar | const FixedBlock<PRIVATE_BYTES> &scalar | ||||
| ) throw(std::bad_alloc,CryptoException) { | |||||
| ) /*throw(std::bad_alloc,CryptoException)*/ { | |||||
| SecureBuffer out(PUBLIC_BYTES); | SecureBuffer out(PUBLIC_BYTES); | ||||
| if (DECAF_SUCCESS != decaf_x448(out.data(), pk.data(), scalar.data())) { | if (DECAF_SUCCESS != decaf_x448(out.data(), pk.data(), scalar.data())) { | ||||
| throw CryptoException(); | throw CryptoException(); | ||||
| @@ -674,7 +674,7 @@ public: | |||||
| static inline SecureBuffer DECAF_DEPRECATED("Renamed to derive_public_key") | static inline SecureBuffer DECAF_DEPRECATED("Renamed to derive_public_key") | ||||
| generate_key( | generate_key( | ||||
| const FixedBlock<PRIVATE_BYTES> &scalar | const FixedBlock<PRIVATE_BYTES> &scalar | ||||
| ) throw(std::bad_alloc) { | |||||
| ) /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(PUBLIC_BYTES); | SecureBuffer out(PUBLIC_BYTES); | ||||
| decaf_x448_derive_public_key(out.data(), scalar.data()); | decaf_x448_derive_public_key(out.data(), scalar.data()); | ||||
| return out; | return out; | ||||
| @@ -685,7 +685,7 @@ public: | |||||
| */ | */ | ||||
| static inline SecureBuffer derive_public_key( | static inline SecureBuffer derive_public_key( | ||||
| const FixedBlock<PRIVATE_BYTES> &scalar | const FixedBlock<PRIVATE_BYTES> &scalar | ||||
| ) throw(std::bad_alloc) { | |||||
| ) /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(PUBLIC_BYTES); | SecureBuffer out(PUBLIC_BYTES); | ||||
| decaf_x448_derive_public_key(out.data(), scalar.data()); | decaf_x448_derive_public_key(out.data(), scalar.data()); | ||||
| return out; | return out; | ||||
| @@ -722,7 +722,7 @@ inline SecureBuffer Ed448Goldilocks::Scalar::direct_scalarmul ( | |||||
| const Block &in, | const Block &in, | ||||
| decaf_bool_t allow_identity, | decaf_bool_t allow_identity, | ||||
| decaf_bool_t short_circuit | decaf_bool_t short_circuit | ||||
| ) const throw(CryptoException) { | |||||
| ) const /*throw(CryptoException)*/ { | |||||
| SecureBuffer out(Ed448Goldilocks::Point::SER_BYTES); | SecureBuffer out(Ed448Goldilocks::Point::SER_BYTES); | ||||
| if (DECAF_SUCCESS != | if (DECAF_SUCCESS != | ||||
| decaf_448_direct_scalarmul(out.data(), in.data(), s, allow_identity, short_circuit) | decaf_448_direct_scalarmul(out.data(), in.data(), s, allow_identity, short_circuit) | ||||
| @@ -60,7 +60,7 @@ public: | |||||
| inline T* allocate ( | inline T* allocate ( | ||||
| size_type cnt, | size_type cnt, | ||||
| typename std::allocator<void>::const_pointer = 0 | typename std::allocator<void>::const_pointer = 0 | ||||
| ) throw(std::bad_alloc); | |||||
| ) /*throw(std::bad_alloc)*/; | |||||
| inline void deallocate(T* p, size_t size) DECAF_NOEXCEPT; | inline void deallocate(T* p, size_t size) DECAF_NOEXCEPT; | ||||
| inline size_t max_size() const DECAF_NOEXCEPT { return std::numeric_limits<size_t>::max() / sizeof(T); } | inline size_t max_size() const DECAF_NOEXCEPT { return std::numeric_limits<size_t>::max() / sizeof(T); } | ||||
| inline void construct(T* p, const T& t) { new(p) T(t); } | inline void construct(T* p, const T& t) { new(p) T(t); } | ||||
| @@ -93,7 +93,7 @@ public: | |||||
| } | } | ||||
| /** @brief Serialize this object into a SecureBuffer and return it */ | /** @brief Serialize this object into a SecureBuffer and return it */ | ||||
| inline SecureBuffer serialize() const throw(std::bad_alloc) { | |||||
| inline SecureBuffer serialize() const /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(ser_size()); | SecureBuffer out(ser_size()); | ||||
| serialize_into(out.data()); | serialize_into(out.data()); | ||||
| return out; | return out; | ||||
| @@ -101,7 +101,7 @@ public: | |||||
| /** Cast operator */ | /** Cast operator */ | ||||
| #if __cplusplus >= 201103L | #if __cplusplus >= 201103L | ||||
| explicit inline operator SecureBuffer() const throw(std::bad_alloc) { | |||||
| explicit inline operator SecureBuffer() const /*throw(std::bad_alloc)*/ { | |||||
| return serialize(); | return serialize(); | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -147,7 +147,7 @@ public: | |||||
| virtual void read(Buffer buffer) DECAF_NOEXCEPT = 0; | virtual void read(Buffer buffer) DECAF_NOEXCEPT = 0; | ||||
| /** @brief Read into a SecureBuffer. */ | /** @brief Read into a SecureBuffer. */ | ||||
| inline SecureBuffer read(size_t length) throw(std::bad_alloc); | |||||
| inline SecureBuffer read(size_t length) /*throw(std::bad_alloc)*/; | |||||
| }; | }; | ||||
| @@ -189,7 +189,7 @@ public: | |||||
| inline const unsigned char *data() const DECAF_NOEXCEPT { return data_; } | inline const unsigned char *data() const DECAF_NOEXCEPT { return data_; } | ||||
| /** Subscript */ | /** Subscript */ | ||||
| inline const unsigned char &operator[](size_t off) const throw(std::out_of_range) { | |||||
| inline const unsigned char &operator[](size_t off) const /*throw(std::out_of_range)*/ { | |||||
| if (off >= size()) throw(std::out_of_range("decaf::Block")); | if (off >= size()) throw(std::out_of_range("decaf::Block")); | ||||
| return data_[off]; | return data_[off]; | ||||
| } | } | ||||
| @@ -203,7 +203,7 @@ public: | |||||
| } | } | ||||
| /** Slice the buffer*/ | /** Slice the buffer*/ | ||||
| inline Block slice(size_t off, size_t length) const throw(LengthException) { | |||||
| inline Block slice(size_t off, size_t length) const /*throw(LengthException)*/ { | |||||
| if (off > size() || length > size() - off) throw LengthException(); | if (off > size() || length > size() - off) throw LengthException(); | ||||
| return Block(data()+off, length); | return Block(data()+off, length); | ||||
| } | } | ||||
| @@ -215,7 +215,7 @@ public: | |||||
| } | } | ||||
| /** Create new block from this */ | /** Create new block from this */ | ||||
| inline operator SecureBuffer() const throw(std::bad_alloc) { | |||||
| inline operator SecureBuffer() const /*throw(std::bad_alloc)*/ { | |||||
| return SecureBuffer(data_,data_+size_); | return SecureBuffer(data_,data_+size_); | ||||
| } | } | ||||
| @@ -243,7 +243,7 @@ private: | |||||
| template<size_t Size> class FixedBlock : public Block { | template<size_t Size> class FixedBlock : public Block { | ||||
| public: | public: | ||||
| /** Check a block's length. */ | /** Check a block's length. */ | ||||
| inline FixedBlock(const Block &b) throw(LengthException) : Block(b.data(),Size) { | |||||
| inline FixedBlock(const Block &b) /*throw(LengthException)*/ : Block(b.data(),Size) { | |||||
| if (Size != b.size()) throw LengthException(); | if (Size != b.size()) throw LengthException(); | ||||
| } | } | ||||
| @@ -275,16 +275,16 @@ public: | |||||
| inline unsigned char* data() DECAF_NOEXCEPT { return data_; } | inline unsigned char* data() DECAF_NOEXCEPT { return data_; } | ||||
| /** Slice the buffer*/ | /** Slice the buffer*/ | ||||
| inline Buffer slice(size_t off, size_t length) throw(LengthException); | |||||
| inline Buffer slice(size_t off, size_t length) /*throw(LengthException)*/; | |||||
| /** Subscript */ | /** Subscript */ | ||||
| inline unsigned char &operator[](size_t off) throw(std::out_of_range) { | |||||
| inline unsigned char &operator[](size_t off) /*throw(std::out_of_range)*/ { | |||||
| if (off >= size()) throw(std::out_of_range("decaf::Buffer")); | if (off >= size()) throw(std::out_of_range("decaf::Buffer")); | ||||
| return data_[off]; | return data_[off]; | ||||
| } | } | ||||
| /** Copy from another block */ | /** Copy from another block */ | ||||
| inline void assign(const Block b) throw(LengthException) { | |||||
| inline void assign(const Block b) /*throw(LengthException)*/ { | |||||
| if (b.size() != size()) throw LengthException(); | if (b.size() != size()) throw LengthException(); | ||||
| memmove(data(),b.data(),size()); | memmove(data(),b.data(),size()); | ||||
| } | } | ||||
| @@ -300,12 +300,12 @@ private: | |||||
| template<size_t Size> class FixedBuffer : public Buffer { | template<size_t Size> class FixedBuffer : public Buffer { | ||||
| public: | public: | ||||
| /** Check a block's length. */ | /** Check a block's length. */ | ||||
| inline FixedBuffer(Buffer b) throw(LengthException) : Buffer(b) { | |||||
| inline FixedBuffer(Buffer b) /*throw(LengthException)*/ : Buffer(b) { | |||||
| if (Size != b.size()) throw LengthException(); | if (Size != b.size()) throw LengthException(); | ||||
| } | } | ||||
| /** Check a block's length. */ | /** Check a block's length. */ | ||||
| inline FixedBuffer(SecureBuffer &b) throw(LengthException) : Buffer(b) { | |||||
| inline FixedBuffer(SecureBuffer &b) /*throw(LengthException)*/ : Buffer(b) { | |||||
| if (Size != b.size()) throw LengthException(); | if (Size != b.size()) throw LengthException(); | ||||
| } | } | ||||
| @@ -355,12 +355,12 @@ public: | |||||
| } | } | ||||
| /** Copy operator */ | /** Copy operator */ | ||||
| inline FixedArrayBuffer& operator=(const Block &b) throw(LengthException) { | |||||
| inline FixedArrayBuffer& operator=(const Block &b) /*throw(LengthException)*/ { | |||||
| *this = FixedBlock<Size>(b); | *this = FixedBlock<Size>(b); | ||||
| } | } | ||||
| /** Copy constructor */ | /** Copy constructor */ | ||||
| inline explicit FixedArrayBuffer(const Block &b) throw(LengthException) : FixedBuffer<Size>(storage,true) { | |||||
| inline explicit FixedArrayBuffer(const Block &b) /*throw(LengthException)*/ : FixedBuffer<Size>(storage,true) { | |||||
| if (b.size() != Size) throw LengthException(); | if (b.size() != Size) throw LengthException(); | ||||
| memcpy(storage,b.data(),Size); | memcpy(storage,b.data(),Size); | ||||
| } | } | ||||
| @@ -375,12 +375,12 @@ public: | |||||
| }; | }; | ||||
| /** @cond internal */ | /** @cond internal */ | ||||
| Buffer Buffer::slice(size_t off, size_t length) throw(LengthException) { | |||||
| Buffer Buffer::slice(size_t off, size_t length) /*throw(LengthException)*/ { | |||||
| if (off > size() || length > size() - off) throw LengthException(); | if (off > size() || length > size() - off) throw LengthException(); | ||||
| return Buffer(data()+off, length); | return Buffer(data()+off, length); | ||||
| } | } | ||||
| inline SecureBuffer Rng::read(size_t length) throw(std::bad_alloc) { | |||||
| inline SecureBuffer Rng::read(size_t length) /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(length); read(out); return out; | SecureBuffer out(length); read(out); return out; | ||||
| } | } | ||||
| /** @endcond */ | /** @endcond */ | ||||
| @@ -406,7 +406,7 @@ protected: | |||||
| is_mine = false; | is_mine = false; | ||||
| } | } | ||||
| } | } | ||||
| inline void alloc() throw(std::bad_alloc) { | |||||
| inline void alloc() /*throw(std::bad_alloc)*/ { | |||||
| if (is_mine) return; | if (is_mine) return; | ||||
| int ret = posix_memalign((void**)&ours.mine, T::alignment(), T::size()); | int ret = posix_memalign((void**)&ours.mine, T::alignment(), T::size()); | ||||
| if (ret || !ours.mine) { | if (ret || !ours.mine) { | ||||
| @@ -427,7 +427,7 @@ protected: | |||||
| /** | /** | ||||
| * @brief Assign. This may require an allocation and memcpy. | * @brief Assign. This may require an allocation and memcpy. | ||||
| */ | */ | ||||
| inline T &operator=(const OwnedOrUnowned &it) throw(std::bad_alloc) { | |||||
| inline T &operator=(const OwnedOrUnowned &it) /*throw(std::bad_alloc)*/ { | |||||
| if (this == &it) return *(T*)this; | if (this == &it) return *(T*)this; | ||||
| if (it.is_mine) { | if (it.is_mine) { | ||||
| alloc(); | alloc(); | ||||
| @@ -463,7 +463,7 @@ template<typename T, size_t alignment> | |||||
| T* SanitizingAllocator<T,alignment>::allocate ( | T* SanitizingAllocator<T,alignment>::allocate ( | ||||
| size_type cnt, | size_type cnt, | ||||
| typename std::allocator<void>::const_pointer | typename std::allocator<void>::const_pointer | ||||
| ) throw(std::bad_alloc) { | |||||
| ) /*throw(std::bad_alloc)*/ { | |||||
| void *v; | void *v; | ||||
| int ret = 0; | int ret = 0; | ||||
| @@ -59,7 +59,7 @@ public: | |||||
| inline SHA512 &operator+=(const Block &s) { return *this << s; } | inline SHA512 &operator+=(const Block &s) { return *this << s; } | ||||
| /** @brief Output bytes from the SHA context, and resets it. */ | /** @brief Output bytes from the SHA context, and resets it. */ | ||||
| inline void final(Buffer b) throw(LengthException) { | |||||
| inline void final(Buffer b) /*throw(LengthException)*/ { | |||||
| if (b.size() > OUTPUT_BYTES) throw LengthException(); | if (b.size() > OUTPUT_BYTES) throw LengthException(); | ||||
| decaf_sha512_final(wrapped,b.data(),b.size()); | decaf_sha512_final(wrapped,b.data(),b.size()); | ||||
| } | } | ||||
| @@ -68,7 +68,7 @@ public: | |||||
| inline void reset() DECAF_NOEXCEPT { decaf_sha512_init(wrapped); } | inline void reset() DECAF_NOEXCEPT { decaf_sha512_init(wrapped); } | ||||
| /** @brief Output bytes from the sponge. */ | /** @brief Output bytes from the sponge. */ | ||||
| inline SecureBuffer final(size_t len = OUTPUT_BYTES) throw(LengthException) { | |||||
| inline SecureBuffer final(size_t len = OUTPUT_BYTES) /*throw(LengthException)*/ { | |||||
| if (len > OUTPUT_BYTES) throw LengthException(); | if (len > OUTPUT_BYTES) throw LengthException(); | ||||
| SecureBuffer buffer(len); | SecureBuffer buffer(len); | ||||
| decaf_sha512_final(wrapped,buffer.data(),len); | decaf_sha512_final(wrapped,buffer.data(),len); | ||||
| @@ -85,7 +85,7 @@ public: | |||||
| static inline SecureBuffer hash ( | static inline SecureBuffer hash ( | ||||
| const Block &message, | const Block &message, | ||||
| size_t outlen = OUTPUT_BYTES | size_t outlen = OUTPUT_BYTES | ||||
| ) throw(LengthException, std::bad_alloc) { | |||||
| ) /*throw(LengthException, std::bad_alloc)*/ { | |||||
| if (outlen > OUTPUT_BYTES) throw LengthException(); | if (outlen > OUTPUT_BYTES) throw LengthException(); | ||||
| SecureBuffer buffer(outlen); | SecureBuffer buffer(outlen); | ||||
| decaf_sha512_hash(buffer.data(),outlen,message.data(),message.size()); | decaf_sha512_hash(buffer.data(),outlen,message.data(),message.size()); | ||||
| @@ -55,7 +55,7 @@ public: | |||||
| inline KeccakHash &operator+=(const Block &s) DECAF_NOEXCEPT { return *this << s; } | inline KeccakHash &operator+=(const Block &s) DECAF_NOEXCEPT { return *this << s; } | ||||
| /** @brief Output bytes from the sponge. */ | /** @brief Output bytes from the sponge. */ | ||||
| inline SecureBuffer output(size_t len) throw(std::bad_alloc, LengthException) { | |||||
| inline SecureBuffer output(size_t len) /*throw(std::bad_alloc, LengthException)*/ { | |||||
| if (len > max_output_size()) throw LengthException(); | if (len > max_output_size()) throw LengthException(); | ||||
| SecureBuffer buffer(len); | SecureBuffer buffer(len); | ||||
| if (DECAF_SUCCESS != decaf_sha3_output(wrapped,buffer.data(),len)) { | if (DECAF_SUCCESS != decaf_sha3_output(wrapped,buffer.data(),len)) { | ||||
| @@ -65,7 +65,7 @@ public: | |||||
| } | } | ||||
| /** @brief Output bytes from the sponge. */ | /** @brief Output bytes from the sponge. */ | ||||
| inline SecureBuffer final(size_t len) throw(std::bad_alloc, LengthException) { | |||||
| inline SecureBuffer final(size_t len) /*throw(std::bad_alloc, LengthException)*/ { | |||||
| if (len > max_output_size()) throw LengthException(); | if (len > max_output_size()) throw LengthException(); | ||||
| SecureBuffer buffer(len); | SecureBuffer buffer(len); | ||||
| if (DECAF_SUCCESS != decaf_sha3_final(wrapped,buffer.data(),len)) { | if (DECAF_SUCCESS != decaf_sha3_final(wrapped,buffer.data(),len)) { | ||||
| @@ -77,7 +77,7 @@ public: | |||||
| /** @brief Output bytes from the sponge. Throw LengthException if you've | /** @brief Output bytes from the sponge. Throw LengthException if you've | ||||
| * output too many bytes from a SHA-3 instance. | * output too many bytes from a SHA-3 instance. | ||||
| */ | */ | ||||
| inline void output(Buffer b) throw(LengthException) { | |||||
| inline void output(Buffer b) /*throw(LengthException)*/ { | |||||
| if (DECAF_SUCCESS != decaf_sha3_output(wrapped,b.data(),b.size())) { | if (DECAF_SUCCESS != decaf_sha3_output(wrapped,b.data(),b.size())) { | ||||
| throw LengthException(); | throw LengthException(); | ||||
| } | } | ||||
| @@ -86,7 +86,7 @@ public: | |||||
| /** @brief Output bytes from the sponge and reinitialize it. Throw | /** @brief Output bytes from the sponge and reinitialize it. Throw | ||||
| * LengthException if you've output too many bytes from a SHA3 instance. | * LengthException if you've output too many bytes from a SHA3 instance. | ||||
| */ | */ | ||||
| inline void final(Buffer b) throw(LengthException) { | |||||
| inline void final(Buffer b) /*throw(LengthException)*/ { | |||||
| if (DECAF_SUCCESS != decaf_sha3_final(wrapped,b.data(),b.size())) { | if (DECAF_SUCCESS != decaf_sha3_final(wrapped,b.data(),b.size())) { | ||||
| throw LengthException(); | throw LengthException(); | ||||
| } | } | ||||
| @@ -103,12 +103,12 @@ public: | |||||
| } | } | ||||
| /** Output the default number of bytes. */ | /** Output the default number of bytes. */ | ||||
| inline SecureBuffer output() throw(std::bad_alloc,LengthException) { | |||||
| inline SecureBuffer output() /*throw(std::bad_alloc,LengthException)*/ { | |||||
| return output(default_output_size()); | return output(default_output_size()); | ||||
| } | } | ||||
| /** Output the default number of bytes, and reset hash. */ | /** Output the default number of bytes, and reset hash. */ | ||||
| inline SecureBuffer final() throw(std::bad_alloc,LengthException) { | |||||
| inline SecureBuffer final() /*throw(std::bad_alloc,LengthException)*/ { | |||||
| return final(default_output_size()); | return final(default_output_size()); | ||||
| } | } | ||||
| @@ -138,7 +138,7 @@ public: | |||||
| /** Hash bytes with this SHA3 instance. | /** Hash bytes with this SHA3 instance. | ||||
| * @throw LengthException if nbytes > MAX_OUTPUT_BYTES | * @throw LengthException if nbytes > MAX_OUTPUT_BYTES | ||||
| */ | */ | ||||
| static inline SecureBuffer hash(const Block &b, size_t nbytes = MAX_OUTPUT_BYTES) throw(std::bad_alloc, LengthException) { | |||||
| static inline SecureBuffer hash(const Block &b, size_t nbytes = MAX_OUTPUT_BYTES) /*throw(std::bad_alloc, LengthException)*/ { | |||||
| if (nbytes > MAX_OUTPUT_BYTES) { | if (nbytes > MAX_OUTPUT_BYTES) { | ||||
| throw LengthException(); | throw LengthException(); | ||||
| } | } | ||||
| @@ -168,7 +168,7 @@ public: | |||||
| inline SHAKE() DECAF_NOEXCEPT : KeccakHash(get_params()) {} | inline SHAKE() DECAF_NOEXCEPT : KeccakHash(get_params()) {} | ||||
| /** Hash bytes with this SHAKE instance */ | /** Hash bytes with this SHAKE instance */ | ||||
| static inline SecureBuffer hash(const Block &b, size_t outlen) throw(std::bad_alloc) { | |||||
| static inline SecureBuffer hash(const Block &b, size_t outlen) /*throw(std::bad_alloc)*/ { | |||||
| SHAKE s; s += b; return s.output(outlen); | SHAKE s; s += b; return s.output(outlen); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -66,7 +66,7 @@ public: | |||||
| /** Initialize, non-deterministically by default, from C/C++ filename */ | /** Initialize, non-deterministically by default, from C/C++ filename */ | ||||
| inline SpongeRng( const std::string &in = "/dev/urandom", size_t len = 32, Deterministic det = RANDOM ) | inline SpongeRng( const std::string &in = "/dev/urandom", size_t len = 32, Deterministic det = RANDOM ) | ||||
| throw(RngException) { | |||||
| /*throw(RngException)*/ { | |||||
| decaf_error_t ret = decaf_spongerng_init_from_file(sp,in.c_str(),len,det); | decaf_error_t ret = decaf_spongerng_init_from_file(sp,in.c_str(),len,det); | ||||
| if (!decaf_successful(ret)) { | if (!decaf_successful(ret)) { | ||||
| throw RngException(errno, "Couldn't load from file"); | throw RngException(errno, "Couldn't load from file"); | ||||
| @@ -54,7 +54,7 @@ private: | |||||
| template<class T, Prehashed Ph> friend class Signing; | template<class T, Prehashed Ph> friend class Signing; | ||||
| template<class T, Prehashed Ph> friend class Verification; | template<class T, Prehashed Ph> friend class Verification; | ||||
| void init() throw(LengthException) { | |||||
| void init() /*throw(LengthException)*/ { | |||||
| Super::reset(); | Super::reset(); | ||||
| if (context_.size() > 255) { | if (context_.size() > 255) { | ||||
| @@ -69,7 +69,7 @@ public: | |||||
| static const size_t OUTPUT_BYTES = Super::DEFAULT_OUTPUT_BYTES; | static const size_t OUTPUT_BYTES = Super::DEFAULT_OUTPUT_BYTES; | ||||
| /** Create the prehash */ | /** Create the prehash */ | ||||
| Prehash(const Block &context = NO_CONTEXT()) throw(LengthException) { | |||||
| Prehash(const Block &context = NO_CONTEXT()) /*throw(LengthException)*/ { | |||||
| context_ = context; | context_ = context; | ||||
| init(); | init(); | ||||
| } | } | ||||
| @@ -78,14 +78,14 @@ public: | |||||
| void reset() DECAF_NOEXCEPT { init(); } | void reset() DECAF_NOEXCEPT { init(); } | ||||
| /** Output from this hash */ | /** Output from this hash */ | ||||
| SecureBuffer final() throw(std::bad_alloc) { | |||||
| SecureBuffer final() /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer ret = Super::final(OUTPUT_BYTES); | SecureBuffer ret = Super::final(OUTPUT_BYTES); | ||||
| reset(); | reset(); | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| /** Output from this hash */ | /** Output from this hash */ | ||||
| void final(Buffer &b) throw(LengthException) { | |||||
| void final(Buffer &b) /*throw(LengthException)*/ { | |||||
| if (b.size() != OUTPUT_BYTES) throw LengthException(); | if (b.size() != OUTPUT_BYTES) throw LengthException(); | ||||
| Super::final(b); | Super::final(b); | ||||
| reset(); | reset(); | ||||
| @@ -173,7 +173,7 @@ public: | |||||
| /** Invert with Fermat's Little Theorem (slow!). If *this == 0, | /** Invert with Fermat's Little Theorem (slow!). If *this == 0, | ||||
| * throw CryptoException. */ | * throw CryptoException. */ | ||||
| inline Scalar inverse() const throw(CryptoException) { | |||||
| inline Scalar inverse() const /*throw(CryptoException)*/ { | |||||
| Scalar r; | Scalar r; | ||||
| if (DECAF_SUCCESS != $(c_ns)_scalar_invert(r.s,s)) { | if (DECAF_SUCCESS != $(c_ns)_scalar_invert(r.s,s)) { | ||||
| throw CryptoException(); | throw CryptoException(); | ||||
| @@ -189,10 +189,10 @@ public: | |||||
| } | } | ||||
| /** Divide by inverting q. If q == 0, return 0. */ | /** Divide by inverting q. If q == 0, return 0. */ | ||||
| inline Scalar operator/ (const Scalar &q) const throw(CryptoException) { return *this * q.inverse(); } | |||||
| inline Scalar operator/ (const Scalar &q) const /*throw(CryptoException)*/ { return *this * q.inverse(); } | |||||
| /** Divide by inverting q. If q == 0, return 0. */ | /** Divide by inverting q. If q == 0, return 0. */ | ||||
| inline Scalar &operator/=(const Scalar &q) throw(CryptoException) { return *this *= q.inverse(); } | |||||
| inline Scalar &operator/=(const Scalar &q) /*throw(CryptoException)*/ { return *this *= q.inverse(); } | |||||
| /** Return half this scalar. Much faster than /2. */ | /** Return half this scalar. Much faster than /2. */ | ||||
| inline Scalar half() const { Scalar out; $(c_ns)_scalar_halve(out.s,s); return out; } | inline Scalar half() const { Scalar out; $(c_ns)_scalar_halve(out.s,s); return out; } | ||||
| @@ -214,7 +214,7 @@ public: | |||||
| const Block &in, | const Block &in, | ||||
| decaf_bool_t allow_identity=DECAF_FALSE, | decaf_bool_t allow_identity=DECAF_FALSE, | ||||
| decaf_bool_t short_circuit=DECAF_TRUE | decaf_bool_t short_circuit=DECAF_TRUE | ||||
| ) const throw(CryptoException); | |||||
| ) const /*throw(CryptoException)*/; | |||||
| }; | }; | ||||
| /** | /** | ||||
| @@ -287,7 +287,7 @@ public: | |||||
| * or was the identity and allow_identity was DECAF_FALSE. | * or was the identity and allow_identity was DECAF_FALSE. | ||||
| */ | */ | ||||
| inline explicit Point(const FixedBlock<SER_BYTES> &buffer, decaf_bool_t allow_identity=DECAF_TRUE) | inline explicit Point(const FixedBlock<SER_BYTES> &buffer, decaf_bool_t allow_identity=DECAF_TRUE) | ||||
| throw(CryptoException) { | |||||
| /*throw(CryptoException)*/ { | |||||
| if (DECAF_SUCCESS != decode(buffer,allow_identity)) { | if (DECAF_SUCCESS != decode(buffer,allow_identity)) { | ||||
| throw CryptoException(); | throw CryptoException(); | ||||
| } | } | ||||
| @@ -323,7 +323,7 @@ public: | |||||
| inline void decode_like_eddsa_and_ignore_cofactor ( | inline void decode_like_eddsa_and_ignore_cofactor ( | ||||
| const FixedBlock<DECAF_EDDSA_$(gf_shortname)_PUBLIC_BYTES> &buffer | const FixedBlock<DECAF_EDDSA_$(gf_shortname)_PUBLIC_BYTES> &buffer | ||||
| ) throw(CryptoException) { | |||||
| ) /*throw(CryptoException)*/ { | |||||
| if (DECAF_SUCCESS != decode_like_eddsa_and_ignore_cofactor_noexcept(buffer)) throw(CryptoException()); | if (DECAF_SUCCESS != decode_like_eddsa_and_ignore_cofactor_noexcept(buffer)) throw(CryptoException()); | ||||
| } | } | ||||
| @@ -417,10 +417,10 @@ public: | |||||
| inline Point &operator*=(const Scalar &s) DECAF_NOEXCEPT { $(c_ns)_point_scalarmul(p,p,s.s); return *this; } | inline Point &operator*=(const Scalar &s) DECAF_NOEXCEPT { $(c_ns)_point_scalarmul(p,p,s.s); return *this; } | ||||
| /** Multiply by s.inverse(). If s=0, maps to the identity. */ | /** Multiply by s.inverse(). If s=0, maps to the identity. */ | ||||
| inline Point operator/ (const Scalar &s) const throw(CryptoException) { return (*this) * s.inverse(); } | |||||
| inline Point operator/ (const Scalar &s) const /*throw(CryptoException)*/ { return (*this) * s.inverse(); } | |||||
| /** Multiply by s.inverse(). If s=0, maps to the identity. */ | /** Multiply by s.inverse(). If s=0, maps to the identity. */ | ||||
| inline Point &operator/=(const Scalar &s) throw(CryptoException) { return (*this) *= s.inverse(); } | |||||
| inline Point &operator/=(const Scalar &s) /*throw(CryptoException)*/ { return (*this) *= s.inverse(); } | |||||
| /** Validate / sanity check */ | /** Validate / sanity check */ | ||||
| inline bool validate() const DECAF_NOEXCEPT { return $(c_ns)_point_valid(p); } | inline bool validate() const DECAF_NOEXCEPT { return $(c_ns)_point_valid(p); } | ||||
| @@ -505,7 +505,7 @@ public: | |||||
| } | } | ||||
| /** Steganographically encode this */ | /** Steganographically encode this */ | ||||
| inline SecureBuffer steg_encode(Rng &rng, size_t size=STEG_BYTES) const throw(std::bad_alloc, LengthException) { | |||||
| inline SecureBuffer steg_encode(Rng &rng, size_t size=STEG_BYTES) const /*throw(std::bad_alloc, LengthException)*/ { | |||||
| if (size <= HASH_BYTES + 4 || size > 2*HASH_BYTES) throw LengthException(); | if (size <= HASH_BYTES + 4 || size > 2*HASH_BYTES) throw LengthException(); | ||||
| SecureBuffer out(STEG_BYTES); | SecureBuffer out(STEG_BYTES); | ||||
| decaf_error_t done; | decaf_error_t done; | ||||
| @@ -583,7 +583,7 @@ public: | |||||
| /** | /** | ||||
| * Initilaize from point. Must allocate memory, and may throw. | * Initilaize from point. Must allocate memory, and may throw. | ||||
| */ | */ | ||||
| inline Precomputed &operator=(const Point &it) throw(std::bad_alloc) { | |||||
| inline Precomputed &operator=(const Point &it) /*throw(std::bad_alloc)*/ { | |||||
| alloc(); | alloc(); | ||||
| $(c_ns)_precompute(ours.mine,it.p); | $(c_ns)_precompute(ours.mine,it.p); | ||||
| return *this; | return *this; | ||||
| @@ -592,20 +592,20 @@ public: | |||||
| /** | /** | ||||
| * Copy constructor. | * Copy constructor. | ||||
| */ | */ | ||||
| inline Precomputed(const Precomputed &it) throw(std::bad_alloc) | |||||
| inline Precomputed(const Precomputed &it) /*throw(std::bad_alloc)*/ | |||||
| : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | ||||
| /** | /** | ||||
| * Constructor which initializes from point. | * Constructor which initializes from point. | ||||
| */ | */ | ||||
| inline explicit Precomputed(const Point &it) throw(std::bad_alloc) | |||||
| inline explicit Precomputed(const Point &it) /*throw(std::bad_alloc)*/ | |||||
| : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | : OwnedOrUnowned<Precomputed,Precomputed_U>() { *this = it; } | ||||
| /** Fixed base scalarmul. */ | /** Fixed base scalarmul. */ | ||||
| inline Point operator* (const Scalar &s) const DECAF_NOEXCEPT { Point r; $(c_ns)_precomputed_scalarmul(r.p,get(),s.s); return r; } | inline Point operator* (const Scalar &s) const DECAF_NOEXCEPT { Point r; $(c_ns)_precomputed_scalarmul(r.p,get(),s.s); return r; } | ||||
| /** Multiply by s.inverse(). If s=0, maps to the identity. */ | /** Multiply by s.inverse(). If s=0, maps to the identity. */ | ||||
| inline Point operator/ (const Scalar &s) const throw(CryptoException) { return (*this) * s.inverse(); } | |||||
| inline Point operator/ (const Scalar &s) const /*throw(CryptoException)*/ { return (*this) * s.inverse(); } | |||||
| /** Return the table for the base point. */ | /** Return the table for the base point. */ | ||||
| static inline const Precomputed base() DECAF_NOEXCEPT { return Precomputed(); } | static inline const Precomputed base() DECAF_NOEXCEPT { return Precomputed(); } | ||||
| @@ -636,7 +636,7 @@ public: | |||||
| static inline SecureBuffer shared_secret( | static inline SecureBuffer shared_secret( | ||||
| const FixedBlock<PUBLIC_BYTES> &pk, | const FixedBlock<PUBLIC_BYTES> &pk, | ||||
| const FixedBlock<PRIVATE_BYTES> &scalar | const FixedBlock<PRIVATE_BYTES> &scalar | ||||
| ) throw(std::bad_alloc,CryptoException) { | |||||
| ) /*throw(std::bad_alloc,CryptoException)*/ { | |||||
| SecureBuffer out(PUBLIC_BYTES); | SecureBuffer out(PUBLIC_BYTES); | ||||
| if (DECAF_SUCCESS != decaf_x$(gf_shortname)(out.data(), pk.data(), scalar.data())) { | if (DECAF_SUCCESS != decaf_x$(gf_shortname)(out.data(), pk.data(), scalar.data())) { | ||||
| throw CryptoException(); | throw CryptoException(); | ||||
| @@ -661,7 +661,7 @@ public: | |||||
| static inline SecureBuffer DECAF_DEPRECATED("Renamed to derive_public_key") | static inline SecureBuffer DECAF_DEPRECATED("Renamed to derive_public_key") | ||||
| generate_key( | generate_key( | ||||
| const FixedBlock<PRIVATE_BYTES> &scalar | const FixedBlock<PRIVATE_BYTES> &scalar | ||||
| ) throw(std::bad_alloc) { | |||||
| ) /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(PUBLIC_BYTES); | SecureBuffer out(PUBLIC_BYTES); | ||||
| decaf_x$(gf_shortname)_derive_public_key(out.data(), scalar.data()); | decaf_x$(gf_shortname)_derive_public_key(out.data(), scalar.data()); | ||||
| return out; | return out; | ||||
| @@ -672,7 +672,7 @@ public: | |||||
| */ | */ | ||||
| static inline SecureBuffer derive_public_key( | static inline SecureBuffer derive_public_key( | ||||
| const FixedBlock<PRIVATE_BYTES> &scalar | const FixedBlock<PRIVATE_BYTES> &scalar | ||||
| ) throw(std::bad_alloc) { | |||||
| ) /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(PUBLIC_BYTES); | SecureBuffer out(PUBLIC_BYTES); | ||||
| decaf_x$(gf_shortname)_derive_public_key(out.data(), scalar.data()); | decaf_x$(gf_shortname)_derive_public_key(out.data(), scalar.data()); | ||||
| return out; | return out; | ||||
| @@ -709,7 +709,7 @@ inline SecureBuffer $(cxx_ns)::Scalar::direct_scalarmul ( | |||||
| const Block &in, | const Block &in, | ||||
| decaf_bool_t allow_identity, | decaf_bool_t allow_identity, | ||||
| decaf_bool_t short_circuit | decaf_bool_t short_circuit | ||||
| ) const throw(CryptoException) { | |||||
| ) const /*throw(CryptoException)*/ { | |||||
| SecureBuffer out($(cxx_ns)::Point::SER_BYTES); | SecureBuffer out($(cxx_ns)::Point::SER_BYTES); | ||||
| if (DECAF_SUCCESS != | if (DECAF_SUCCESS != | ||||
| $(c_ns)_direct_scalarmul(out.data(), in.data(), s, allow_identity, short_circuit) | $(c_ns)_direct_scalarmul(out.data(), in.data(), s, allow_identity, short_circuit) | ||||
| @@ -60,7 +60,7 @@ public: | |||||
| inline T* allocate ( | inline T* allocate ( | ||||
| size_type cnt, | size_type cnt, | ||||
| typename std::allocator<void>::const_pointer = 0 | typename std::allocator<void>::const_pointer = 0 | ||||
| ) throw(std::bad_alloc); | |||||
| ) /*throw(std::bad_alloc)*/; | |||||
| inline void deallocate(T* p, size_t size) DECAF_NOEXCEPT; | inline void deallocate(T* p, size_t size) DECAF_NOEXCEPT; | ||||
| inline size_t max_size() const DECAF_NOEXCEPT { return std::numeric_limits<size_t>::max() / sizeof(T); } | inline size_t max_size() const DECAF_NOEXCEPT { return std::numeric_limits<size_t>::max() / sizeof(T); } | ||||
| inline void construct(T* p, const T& t) { new(p) T(t); } | inline void construct(T* p, const T& t) { new(p) T(t); } | ||||
| @@ -93,7 +93,7 @@ public: | |||||
| } | } | ||||
| /** @brief Serialize this object into a SecureBuffer and return it */ | /** @brief Serialize this object into a SecureBuffer and return it */ | ||||
| inline SecureBuffer serialize() const throw(std::bad_alloc) { | |||||
| inline SecureBuffer serialize() const /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(ser_size()); | SecureBuffer out(ser_size()); | ||||
| serialize_into(out.data()); | serialize_into(out.data()); | ||||
| return out; | return out; | ||||
| @@ -101,7 +101,7 @@ public: | |||||
| /** Cast operator */ | /** Cast operator */ | ||||
| #if __cplusplus >= 201103L | #if __cplusplus >= 201103L | ||||
| explicit inline operator SecureBuffer() const throw(std::bad_alloc) { | |||||
| explicit inline operator SecureBuffer() const /*throw(std::bad_alloc)*/ { | |||||
| return serialize(); | return serialize(); | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -147,7 +147,7 @@ public: | |||||
| virtual void read(Buffer buffer) DECAF_NOEXCEPT = 0; | virtual void read(Buffer buffer) DECAF_NOEXCEPT = 0; | ||||
| /** @brief Read into a SecureBuffer. */ | /** @brief Read into a SecureBuffer. */ | ||||
| inline SecureBuffer read(size_t length) throw(std::bad_alloc); | |||||
| inline SecureBuffer read(size_t length) /*throw(std::bad_alloc)*/; | |||||
| }; | }; | ||||
| @@ -189,7 +189,7 @@ public: | |||||
| inline const unsigned char *data() const DECAF_NOEXCEPT { return data_; } | inline const unsigned char *data() const DECAF_NOEXCEPT { return data_; } | ||||
| /** Subscript */ | /** Subscript */ | ||||
| inline const unsigned char &operator[](size_t off) const throw(std::out_of_range) { | |||||
| inline const unsigned char &operator[](size_t off) const /*throw(std::out_of_range)*/ { | |||||
| if (off >= size()) throw(std::out_of_range("decaf::Block")); | if (off >= size()) throw(std::out_of_range("decaf::Block")); | ||||
| return data_[off]; | return data_[off]; | ||||
| } | } | ||||
| @@ -203,7 +203,7 @@ public: | |||||
| } | } | ||||
| /** Slice the buffer*/ | /** Slice the buffer*/ | ||||
| inline Block slice(size_t off, size_t length) const throw(LengthException) { | |||||
| inline Block slice(size_t off, size_t length) const /*throw(LengthException)*/ { | |||||
| if (off > size() || length > size() - off) throw LengthException(); | if (off > size() || length > size() - off) throw LengthException(); | ||||
| return Block(data()+off, length); | return Block(data()+off, length); | ||||
| } | } | ||||
| @@ -215,7 +215,7 @@ public: | |||||
| } | } | ||||
| /** Create new block from this */ | /** Create new block from this */ | ||||
| inline operator SecureBuffer() const throw(std::bad_alloc) { | |||||
| inline operator SecureBuffer() const /*throw(std::bad_alloc)*/ { | |||||
| return SecureBuffer(data_,data_+size_); | return SecureBuffer(data_,data_+size_); | ||||
| } | } | ||||
| @@ -243,7 +243,7 @@ private: | |||||
| template<size_t Size> class FixedBlock : public Block { | template<size_t Size> class FixedBlock : public Block { | ||||
| public: | public: | ||||
| /** Check a block's length. */ | /** Check a block's length. */ | ||||
| inline FixedBlock(const Block &b) throw(LengthException) : Block(b.data(),Size) { | |||||
| inline FixedBlock(const Block &b) /*throw(LengthException)*/ : Block(b.data(),Size) { | |||||
| if (Size != b.size()) throw LengthException(); | if (Size != b.size()) throw LengthException(); | ||||
| } | } | ||||
| @@ -275,16 +275,16 @@ public: | |||||
| inline unsigned char* data() DECAF_NOEXCEPT { return data_; } | inline unsigned char* data() DECAF_NOEXCEPT { return data_; } | ||||
| /** Slice the buffer*/ | /** Slice the buffer*/ | ||||
| inline Buffer slice(size_t off, size_t length) throw(LengthException); | |||||
| inline Buffer slice(size_t off, size_t length) /*throw(LengthException)*/; | |||||
| /** Subscript */ | /** Subscript */ | ||||
| inline unsigned char &operator[](size_t off) throw(std::out_of_range) { | |||||
| inline unsigned char &operator[](size_t off) /*throw(std::out_of_range)*/ { | |||||
| if (off >= size()) throw(std::out_of_range("decaf::Buffer")); | if (off >= size()) throw(std::out_of_range("decaf::Buffer")); | ||||
| return data_[off]; | return data_[off]; | ||||
| } | } | ||||
| /** Copy from another block */ | /** Copy from another block */ | ||||
| inline void assign(const Block b) throw(LengthException) { | |||||
| inline void assign(const Block b) /*throw(LengthException)*/ { | |||||
| if (b.size() != size()) throw LengthException(); | if (b.size() != size()) throw LengthException(); | ||||
| memmove(data(),b.data(),size()); | memmove(data(),b.data(),size()); | ||||
| } | } | ||||
| @@ -300,12 +300,12 @@ private: | |||||
| template<size_t Size> class FixedBuffer : public Buffer { | template<size_t Size> class FixedBuffer : public Buffer { | ||||
| public: | public: | ||||
| /** Check a block's length. */ | /** Check a block's length. */ | ||||
| inline FixedBuffer(Buffer b) throw(LengthException) : Buffer(b) { | |||||
| inline FixedBuffer(Buffer b) /*throw(LengthException)*/ : Buffer(b) { | |||||
| if (Size != b.size()) throw LengthException(); | if (Size != b.size()) throw LengthException(); | ||||
| } | } | ||||
| /** Check a block's length. */ | /** Check a block's length. */ | ||||
| inline FixedBuffer(SecureBuffer &b) throw(LengthException) : Buffer(b) { | |||||
| inline FixedBuffer(SecureBuffer &b) /*throw(LengthException)*/ : Buffer(b) { | |||||
| if (Size != b.size()) throw LengthException(); | if (Size != b.size()) throw LengthException(); | ||||
| } | } | ||||
| @@ -355,12 +355,12 @@ public: | |||||
| } | } | ||||
| /** Copy operator */ | /** Copy operator */ | ||||
| inline FixedArrayBuffer& operator=(const Block &b) throw(LengthException) { | |||||
| inline FixedArrayBuffer& operator=(const Block &b) /*throw(LengthException)*/ { | |||||
| *this = FixedBlock<Size>(b); | *this = FixedBlock<Size>(b); | ||||
| } | } | ||||
| /** Copy constructor */ | /** Copy constructor */ | ||||
| inline explicit FixedArrayBuffer(const Block &b) throw(LengthException) : FixedBuffer<Size>(storage,true) { | |||||
| inline explicit FixedArrayBuffer(const Block &b) /*throw(LengthException)*/ : FixedBuffer<Size>(storage,true) { | |||||
| if (b.size() != Size) throw LengthException(); | if (b.size() != Size) throw LengthException(); | ||||
| memcpy(storage,b.data(),Size); | memcpy(storage,b.data(),Size); | ||||
| } | } | ||||
| @@ -375,12 +375,12 @@ public: | |||||
| }; | }; | ||||
| /** @cond internal */ | /** @cond internal */ | ||||
| Buffer Buffer::slice(size_t off, size_t length) throw(LengthException) { | |||||
| Buffer Buffer::slice(size_t off, size_t length) /*throw(LengthException)*/ { | |||||
| if (off > size() || length > size() - off) throw LengthException(); | if (off > size() || length > size() - off) throw LengthException(); | ||||
| return Buffer(data()+off, length); | return Buffer(data()+off, length); | ||||
| } | } | ||||
| inline SecureBuffer Rng::read(size_t length) throw(std::bad_alloc) { | |||||
| inline SecureBuffer Rng::read(size_t length) /*throw(std::bad_alloc)*/ { | |||||
| SecureBuffer out(length); read(out); return out; | SecureBuffer out(length); read(out); return out; | ||||
| } | } | ||||
| /** @endcond */ | /** @endcond */ | ||||
| @@ -406,7 +406,7 @@ protected: | |||||
| is_mine = false; | is_mine = false; | ||||
| } | } | ||||
| } | } | ||||
| inline void alloc() throw(std::bad_alloc) { | |||||
| inline void alloc() /*throw(std::bad_alloc)*/ { | |||||
| if (is_mine) return; | if (is_mine) return; | ||||
| int ret = posix_memalign((void**)&ours.mine, T::alignment(), T::size()); | int ret = posix_memalign((void**)&ours.mine, T::alignment(), T::size()); | ||||
| if (ret || !ours.mine) { | if (ret || !ours.mine) { | ||||
| @@ -427,7 +427,7 @@ protected: | |||||
| /** | /** | ||||
| * @brief Assign. This may require an allocation and memcpy. | * @brief Assign. This may require an allocation and memcpy. | ||||
| */ | */ | ||||
| inline T &operator=(const OwnedOrUnowned &it) throw(std::bad_alloc) { | |||||
| inline T &operator=(const OwnedOrUnowned &it) /*throw(std::bad_alloc)*/ { | |||||
| if (this == &it) return *(T*)this; | if (this == &it) return *(T*)this; | ||||
| if (it.is_mine) { | if (it.is_mine) { | ||||
| alloc(); | alloc(); | ||||
| @@ -463,7 +463,7 @@ template<typename T, size_t alignment> | |||||
| T* SanitizingAllocator<T,alignment>::allocate ( | T* SanitizingAllocator<T,alignment>::allocate ( | ||||
| size_type cnt, | size_type cnt, | ||||
| typename std::allocator<void>::const_pointer | typename std::allocator<void>::const_pointer | ||||
| ) throw(std::bad_alloc) { | |||||
| ) /*throw(std::bad_alloc)*/ { | |||||
| void *v; | void *v; | ||||
| int ret = 0; | int ret = 0; | ||||
| @@ -59,7 +59,7 @@ public: | |||||
| inline SHA512 &operator+=(const Block &s) { return *this << s; } | inline SHA512 &operator+=(const Block &s) { return *this << s; } | ||||
| /** @brief Output bytes from the SHA context, and resets it. */ | /** @brief Output bytes from the SHA context, and resets it. */ | ||||
| inline void final(Buffer b) throw(LengthException) { | |||||
| inline void final(Buffer b) /*throw(LengthException)*/ { | |||||
| if (b.size() > OUTPUT_BYTES) throw LengthException(); | if (b.size() > OUTPUT_BYTES) throw LengthException(); | ||||
| decaf_sha512_final(wrapped,b.data(),b.size()); | decaf_sha512_final(wrapped,b.data(),b.size()); | ||||
| } | } | ||||
| @@ -68,7 +68,7 @@ public: | |||||
| inline void reset() DECAF_NOEXCEPT { decaf_sha512_init(wrapped); } | inline void reset() DECAF_NOEXCEPT { decaf_sha512_init(wrapped); } | ||||
| /** @brief Output bytes from the sponge. */ | /** @brief Output bytes from the sponge. */ | ||||
| inline SecureBuffer final(size_t len = OUTPUT_BYTES) throw(LengthException) { | |||||
| inline SecureBuffer final(size_t len = OUTPUT_BYTES) /*throw(LengthException)*/ { | |||||
| if (len > OUTPUT_BYTES) throw LengthException(); | if (len > OUTPUT_BYTES) throw LengthException(); | ||||
| SecureBuffer buffer(len); | SecureBuffer buffer(len); | ||||
| decaf_sha512_final(wrapped,buffer.data(),len); | decaf_sha512_final(wrapped,buffer.data(),len); | ||||
| @@ -85,7 +85,7 @@ public: | |||||
| static inline SecureBuffer hash ( | static inline SecureBuffer hash ( | ||||
| const Block &message, | const Block &message, | ||||
| size_t outlen = OUTPUT_BYTES | size_t outlen = OUTPUT_BYTES | ||||
| ) throw(LengthException, std::bad_alloc) { | |||||
| ) /*throw(LengthException, std::bad_alloc)*/ { | |||||
| if (outlen > OUTPUT_BYTES) throw LengthException(); | if (outlen > OUTPUT_BYTES) throw LengthException(); | ||||
| SecureBuffer buffer(outlen); | SecureBuffer buffer(outlen); | ||||
| decaf_sha512_hash(buffer.data(),outlen,message.data(),message.size()); | decaf_sha512_hash(buffer.data(),outlen,message.data(),message.size()); | ||||
| @@ -55,7 +55,7 @@ public: | |||||
| inline KeccakHash &operator+=(const Block &s) DECAF_NOEXCEPT { return *this << s; } | inline KeccakHash &operator+=(const Block &s) DECAF_NOEXCEPT { return *this << s; } | ||||
| /** @brief Output bytes from the sponge. */ | /** @brief Output bytes from the sponge. */ | ||||
| inline SecureBuffer output(size_t len) throw(std::bad_alloc, LengthException) { | |||||
| inline SecureBuffer output(size_t len) /*throw(std::bad_alloc, LengthException)*/ { | |||||
| if (len > max_output_size()) throw LengthException(); | if (len > max_output_size()) throw LengthException(); | ||||
| SecureBuffer buffer(len); | SecureBuffer buffer(len); | ||||
| if (DECAF_SUCCESS != decaf_sha3_output(wrapped,buffer.data(),len)) { | if (DECAF_SUCCESS != decaf_sha3_output(wrapped,buffer.data(),len)) { | ||||
| @@ -65,7 +65,7 @@ public: | |||||
| } | } | ||||
| /** @brief Output bytes from the sponge. */ | /** @brief Output bytes from the sponge. */ | ||||
| inline SecureBuffer final(size_t len) throw(std::bad_alloc, LengthException) { | |||||
| inline SecureBuffer final(size_t len) /*throw(std::bad_alloc, LengthException)*/ { | |||||
| if (len > max_output_size()) throw LengthException(); | if (len > max_output_size()) throw LengthException(); | ||||
| SecureBuffer buffer(len); | SecureBuffer buffer(len); | ||||
| if (DECAF_SUCCESS != decaf_sha3_final(wrapped,buffer.data(),len)) { | if (DECAF_SUCCESS != decaf_sha3_final(wrapped,buffer.data(),len)) { | ||||
| @@ -77,7 +77,7 @@ public: | |||||
| /** @brief Output bytes from the sponge. Throw LengthException if you've | /** @brief Output bytes from the sponge. Throw LengthException if you've | ||||
| * output too many bytes from a SHA-3 instance. | * output too many bytes from a SHA-3 instance. | ||||
| */ | */ | ||||
| inline void output(Buffer b) throw(LengthException) { | |||||
| inline void output(Buffer b) /*throw(LengthException)*/ { | |||||
| if (DECAF_SUCCESS != decaf_sha3_output(wrapped,b.data(),b.size())) { | if (DECAF_SUCCESS != decaf_sha3_output(wrapped,b.data(),b.size())) { | ||||
| throw LengthException(); | throw LengthException(); | ||||
| } | } | ||||
| @@ -86,7 +86,7 @@ public: | |||||
| /** @brief Output bytes from the sponge and reinitialize it. Throw | /** @brief Output bytes from the sponge and reinitialize it. Throw | ||||
| * LengthException if you've output too many bytes from a SHA3 instance. | * LengthException if you've output too many bytes from a SHA3 instance. | ||||
| */ | */ | ||||
| inline void final(Buffer b) throw(LengthException) { | |||||
| inline void final(Buffer b) /*throw(LengthException)*/ { | |||||
| if (DECAF_SUCCESS != decaf_sha3_final(wrapped,b.data(),b.size())) { | if (DECAF_SUCCESS != decaf_sha3_final(wrapped,b.data(),b.size())) { | ||||
| throw LengthException(); | throw LengthException(); | ||||
| } | } | ||||
| @@ -103,12 +103,12 @@ public: | |||||
| } | } | ||||
| /** Output the default number of bytes. */ | /** Output the default number of bytes. */ | ||||
| inline SecureBuffer output() throw(std::bad_alloc,LengthException) { | |||||
| inline SecureBuffer output() /*throw(std::bad_alloc,LengthException)*/ { | |||||
| return output(default_output_size()); | return output(default_output_size()); | ||||
| } | } | ||||
| /** Output the default number of bytes, and reset hash. */ | /** Output the default number of bytes, and reset hash. */ | ||||
| inline SecureBuffer final() throw(std::bad_alloc,LengthException) { | |||||
| inline SecureBuffer final() /*throw(std::bad_alloc,LengthException)*/ { | |||||
| return final(default_output_size()); | return final(default_output_size()); | ||||
| } | } | ||||
| @@ -138,7 +138,7 @@ public: | |||||
| /** Hash bytes with this SHA3 instance. | /** Hash bytes with this SHA3 instance. | ||||
| * @throw LengthException if nbytes > MAX_OUTPUT_BYTES | * @throw LengthException if nbytes > MAX_OUTPUT_BYTES | ||||
| */ | */ | ||||
| static inline SecureBuffer hash(const Block &b, size_t nbytes = MAX_OUTPUT_BYTES) throw(std::bad_alloc, LengthException) { | |||||
| static inline SecureBuffer hash(const Block &b, size_t nbytes = MAX_OUTPUT_BYTES) /*throw(std::bad_alloc, LengthException)*/ { | |||||
| if (nbytes > MAX_OUTPUT_BYTES) { | if (nbytes > MAX_OUTPUT_BYTES) { | ||||
| throw LengthException(); | throw LengthException(); | ||||
| } | } | ||||
| @@ -168,7 +168,7 @@ public: | |||||
| inline SHAKE() DECAF_NOEXCEPT : KeccakHash(get_params()) {} | inline SHAKE() DECAF_NOEXCEPT : KeccakHash(get_params()) {} | ||||
| /** Hash bytes with this SHAKE instance */ | /** Hash bytes with this SHAKE instance */ | ||||
| static inline SecureBuffer hash(const Block &b, size_t outlen) throw(std::bad_alloc) { | |||||
| static inline SecureBuffer hash(const Block &b, size_t outlen) /*throw(std::bad_alloc)*/ { | |||||
| SHAKE s; s += b; return s.output(outlen); | SHAKE s; s += b; return s.output(outlen); | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -66,7 +66,7 @@ public: | |||||
| /** Initialize, non-deterministically by default, from C/C++ filename */ | /** Initialize, non-deterministically by default, from C/C++ filename */ | ||||
| inline SpongeRng( const std::string &in = "/dev/urandom", size_t len = 32, Deterministic det = RANDOM ) | inline SpongeRng( const std::string &in = "/dev/urandom", size_t len = 32, Deterministic det = RANDOM ) | ||||
| throw(RngException) { | |||||
| /*throw(RngException)*/ { | |||||
| decaf_error_t ret = decaf_spongerng_init_from_file(sp,in.c_str(),len,det); | decaf_error_t ret = decaf_spongerng_init_from_file(sp,in.c_str(),len,det); | ||||
| if (!decaf_successful(ret)) { | if (!decaf_successful(ret)) { | ||||
| throw RngException(errno, "Couldn't load from file"); | throw RngException(errno, "Couldn't load from file"); | ||||