Browse Source

deprecated macros, thanks Olivier Chéron and Tomi Ollila

master
Michael Hamburg 7 years ago
parent
commit
beba37006a
8 changed files with 32 additions and 37 deletions
  1. +10
    -2
      src/GENERATED/include/decaf/common.h
  2. +1
    -4
      src/GENERATED/include/decaf/point_255.h
  3. +3
    -7
      src/GENERATED/include/decaf/point_255.hxx
  4. +1
    -4
      src/GENERATED/include/decaf/point_448.h
  5. +3
    -7
      src/GENERATED/include/decaf/point_448.hxx
  6. +1
    -4
      src/per_curve/point.tmpl.h
  7. +3
    -7
      src/per_curve/point.tmpl.hxx
  8. +10
    -2
      src/public_include/decaf/common.h

+ 10
- 2
src/GENERATED/include/decaf/common.h View File

@@ -30,6 +30,14 @@ extern "C" {
#define NONNULL __attribute__((nonnull))
#define INLINE inline __attribute__((always_inline))
#define UNUSED __attribute__((unused))
// Cribbed from libnotmuch
#if defined (__clang_major__) && __clang_major__ >= 3 \
|| defined (__GNUC__) && __GNUC__ >= 5 \
|| defined (__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 5
#define DEPRECATED(msg) __attribute__ ((deprecated(msg)))
#else
#define DEPRECATED(msg) __attribute__ ((deprecated))
#endif
/** @endcond */

/* Internal word types.
@@ -77,14 +85,14 @@ typedef enum {


/** Return success if x is true */
static __inline__ __attribute__((unused,always_inline))
static UNUSED INLINE
decaf_error_t
decaf_succeed_if(decaf_bool_t x) {
return (decaf_error_t)x;
}

/** Return DECAF_TRUE iff x == DECAF_SUCCESS */
static __inline__ __attribute__((unused,always_inline))
static UNUSED INLINE
decaf_bool_t
decaf_successful(decaf_error_t e) {
decaf_dword_t w = ((decaf_word_t)e) ^ ((decaf_word_t)DECAF_SUCCESS);


+ 1
- 4
src/GENERATED/include/decaf/point_255.h View File

@@ -413,10 +413,7 @@ extern const uint8_t decaf_x25519_base_point[DECAF_X25519_PUBLIC_BYTES] API_VIS;
void decaf_x25519_generate_key (
uint8_t out[DECAF_X25519_PUBLIC_BYTES],
const uint8_t scalar[DECAF_X25519_PRIVATE_BYTES]
) API_VIS NONNULL NOINLINE
__attribute__((deprecated(
"Renamed to decaf_x25519_derive_public_key"
)));
) API_VIS NONNULL NOINLINE DEPRECATED("Renamed to decaf_x25519_derive_public_key");
/**
* @brief RFC 7748 Diffie-Hellman base point scalarmul. This function uses


+ 3
- 7
src/GENERATED/include/decaf/point_255.hxx View File

@@ -671,9 +671,8 @@ public:
* but possibly faster.
* @deprecated Renamed to derive_public_key.
*/
static inline SecureBuffer __attribute__((deprecated(
"Renamed to derive_public_key"
))) generate_key(
static inline SecureBuffer DEPRECATED("Renamed to derive_public_key")
generate_key(
const FixedBlock<PRIVATE_BYTES> &scalar
) throw(std::bad_alloc) {
SecureBuffer out(PUBLIC_BYTES);
@@ -707,10 +706,7 @@ public:
* equivalent to shared_secret(base_point(),scalar) but possibly faster.
* @deprecated Renamed to derive_public_key_noexcept.
*/
static inline void
__attribute__((deprecated(
"Renamed to derive_public_key_noexcept"
)))
static inline void DEPRECATED("Renamed to derive_public_key_noexcept")
generate_key_noexcept (
FixedBuffer<PUBLIC_BYTES> &out,
const FixedBlock<PRIVATE_BYTES> &scalar


+ 1
- 4
src/GENERATED/include/decaf/point_448.h View File

@@ -413,10 +413,7 @@ extern const uint8_t decaf_x448_base_point[DECAF_X448_PUBLIC_BYTES] API_VIS;
void decaf_x448_generate_key (
uint8_t out[DECAF_X448_PUBLIC_BYTES],
const uint8_t scalar[DECAF_X448_PRIVATE_BYTES]
) API_VIS NONNULL NOINLINE
__attribute__((deprecated(
"Renamed to decaf_x448_derive_public_key"
)));
) API_VIS NONNULL NOINLINE DEPRECATED("Renamed to decaf_x448_derive_public_key");
/**
* @brief RFC 7748 Diffie-Hellman base point scalarmul. This function uses


+ 3
- 7
src/GENERATED/include/decaf/point_448.hxx View File

@@ -671,9 +671,8 @@ public:
* but possibly faster.
* @deprecated Renamed to derive_public_key.
*/
static inline SecureBuffer __attribute__((deprecated(
"Renamed to derive_public_key"
))) generate_key(
static inline SecureBuffer DEPRECATED("Renamed to derive_public_key")
generate_key(
const FixedBlock<PRIVATE_BYTES> &scalar
) throw(std::bad_alloc) {
SecureBuffer out(PUBLIC_BYTES);
@@ -707,10 +706,7 @@ public:
* equivalent to shared_secret(base_point(),scalar) but possibly faster.
* @deprecated Renamed to derive_public_key_noexcept.
*/
static inline void
__attribute__((deprecated(
"Renamed to derive_public_key_noexcept"
)))
static inline void DEPRECATED("Renamed to derive_public_key_noexcept")
generate_key_noexcept (
FixedBuffer<PUBLIC_BYTES> &out,
const FixedBlock<PRIVATE_BYTES> &scalar


+ 1
- 4
src/per_curve/point.tmpl.h View File

@@ -398,10 +398,7 @@ extern const uint8_t decaf_x$(gf_shortname)_base_point[DECAF_X$(gf_shortname)_PU
void decaf_x$(gf_shortname)_generate_key (
uint8_t out[DECAF_X$(gf_shortname)_PUBLIC_BYTES],
const uint8_t scalar[DECAF_X$(gf_shortname)_PRIVATE_BYTES]
) API_VIS NONNULL NOINLINE
__attribute__((deprecated(
"Renamed to decaf_x$(gf_shortname)_derive_public_key"
)));
) API_VIS NONNULL NOINLINE DEPRECATED("Renamed to decaf_x$(gf_shortname)_derive_public_key");
/**
* @brief RFC 7748 Diffie-Hellman base point scalarmul. This function uses


+ 3
- 7
src/per_curve/point.tmpl.hxx View File

@@ -658,9 +658,8 @@ public:
* but possibly faster.
* @deprecated Renamed to derive_public_key.
*/
static inline SecureBuffer __attribute__((deprecated(
"Renamed to derive_public_key"
))) generate_key(
static inline SecureBuffer DEPRECATED("Renamed to derive_public_key")
generate_key(
const FixedBlock<PRIVATE_BYTES> &scalar
) throw(std::bad_alloc) {
SecureBuffer out(PUBLIC_BYTES);
@@ -694,10 +693,7 @@ public:
* equivalent to shared_secret(base_point(),scalar) but possibly faster.
* @deprecated Renamed to derive_public_key_noexcept.
*/
static inline void
__attribute__((deprecated(
"Renamed to derive_public_key_noexcept"
)))
static inline void DEPRECATED("Renamed to derive_public_key_noexcept")
generate_key_noexcept (
FixedBuffer<PUBLIC_BYTES> &out,
const FixedBlock<PRIVATE_BYTES> &scalar


+ 10
- 2
src/public_include/decaf/common.h View File

@@ -30,6 +30,14 @@ extern "C" {
#define NONNULL __attribute__((nonnull))
#define INLINE inline __attribute__((always_inline))
#define UNUSED __attribute__((unused))
// Cribbed from libnotmuch
#if defined (__clang_major__) && __clang_major__ >= 3 \
|| defined (__GNUC__) && __GNUC__ >= 5 \
|| defined (__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 5
#define DEPRECATED(msg) __attribute__ ((deprecated(msg)))
#else
#define DEPRECATED(msg) __attribute__ ((deprecated))
#endif
/** @endcond */

/* Internal word types.
@@ -77,14 +85,14 @@ typedef enum {


/** Return success if x is true */
static __inline__ __attribute__((unused,always_inline))
static UNUSED INLINE
decaf_error_t
decaf_succeed_if(decaf_bool_t x) {
return (decaf_error_t)x;
}

/** Return DECAF_TRUE iff x == DECAF_SUCCESS */
static __inline__ __attribute__((unused,always_inline))
static UNUSED INLINE
decaf_bool_t
decaf_successful(decaf_error_t e) {
decaf_dword_t w = ((decaf_word_t)e) ^ ((decaf_word_t)DECAF_SUCCESS);


Loading…
Cancel
Save