2 * @file decaf/point_448.h
6 * Copyright (c) 2015-2016 Cryptography Research, Inc. \n
7 * Released under the MIT License. See LICENSE.txt for license information.
9 * @brief A group of prime order p, based on Ed448-Goldilocks.
11 * @warning This file was automatically generated in Python.
12 * Please do not edit it.
15 #ifndef __DECAF_POINT_448_H__
16 #define __DECAF_POINT_448_H__ 1
18 #include "curve448utils.h"
25 #define DECAF_448_SCALAR_LIMBS ((446-1)/DECAF_WORD_BITS+1)
28 /** The number of bits in a scalar */
29 #define DECAF_448_SCALAR_BITS 446
32 #ifndef __DECAF_448_GF_DEFINED__
33 #define __DECAF_448_GF_DEFINED__ 1
34 /** @brief Galois field element internal structure */
35 typedef struct gf_448_s {
36 decaf_word_t limb[512/DECAF_WORD_BITS];
37 } __attribute__((aligned(32))) gf_448_s, gf_448_t[1];
38 #endif /* __DECAF_448_GF_DEFINED__ */
41 /** Number of bytes in a serialized point. */
42 #define DECAF_448_SER_BYTES 56
44 /** Number of bytes in an elligated point. For now set the same as SER_BYTES
45 * but could be different for other curves.
47 #define DECAF_448_HASH_BYTES 56
49 /** Number of bytes in a serialized scalar. */
50 #define DECAF_448_SCALAR_BYTES 56
52 /** Number of bits in the "which" field of an elligator inverse */
53 #define DECAF_448_INVERT_ELLIGATOR_WHICH_BITS 3
55 /** The cofactor the curve would have, if we hadn't removed it */
56 #define DECAF_448_REMOVED_COFACTOR 4
58 /** X448 encoding ratio. */
59 #define DECAF_X448_ENCODE_RATIO 2
61 /** Number of bytes in an x448 public key */
62 #define DECAF_X448_PUBLIC_BYTES 56
64 /** Number of bytes in an x448 private key */
65 #define DECAF_X448_PRIVATE_BYTES 56
67 /** Twisted Edwards extended homogeneous coordinates */
68 typedef struct decaf_448_point_s {
72 } decaf_448_point_t[1];
74 /** Precomputed table based on a point. Can be trivial implementation. */
75 struct decaf_448_precomputed_s;
77 /** Precomputed table based on a point. Can be trivial implementation. */
78 typedef struct decaf_448_precomputed_s decaf_448_precomputed_s;
80 /** Size and alignment of precomputed point tables. */
81 extern const size_t decaf_448_sizeof_precomputed_s DECAF_API_VIS, decaf_448_alignof_precomputed_s DECAF_API_VIS;
83 /** Scalar is stored packed, because we don't need the speed. */
84 typedef struct decaf_448_scalar_s {
86 decaf_word_t limb[DECAF_448_SCALAR_LIMBS];
88 } decaf_448_scalar_t[1];
90 /** A scalar equal to 1. */
91 extern const decaf_448_scalar_t decaf_448_scalar_one DECAF_API_VIS;
93 /** A scalar equal to 0. */
94 extern const decaf_448_scalar_t decaf_448_scalar_zero DECAF_API_VIS;
96 /** The identity point on the curve. */
97 extern const decaf_448_point_t decaf_448_point_identity DECAF_API_VIS;
99 /** An arbitrarily chosen base point on the curve. */
100 extern const decaf_448_point_t decaf_448_point_base DECAF_API_VIS;
102 /** Precomputed table for the base point on the curve. */
103 extern const struct decaf_448_precomputed_s *decaf_448_precomputed_base DECAF_API_VIS;
106 * @brief Read a scalar from wire format or from bytes.
108 * @param [in] ser Serialized form of a scalar.
109 * @param [out] out Deserialized form.
111 * @retval DECAF_SUCCESS The scalar was correctly encoded.
112 * @retval DECAF_FAILURE The scalar was greater than the modulus,
113 * and has been reduced modulo that modulus.
115 decaf_error_t decaf_448_scalar_decode (
116 decaf_448_scalar_t out,
117 const unsigned char ser[DECAF_448_SCALAR_BYTES]
118 ) DECAF_API_VIS DECAF_WARN_UNUSED DECAF_NONNULL DECAF_NOINLINE;
121 * @brief Read a scalar from wire format or from bytes. Reduces mod
124 * @param [in] ser Serialized form of a scalar.
125 * @param [in] ser_len Length of serialized form.
126 * @param [out] out Deserialized form.
128 void decaf_448_scalar_decode_long (
129 decaf_448_scalar_t out,
130 const unsigned char *ser,
132 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
135 * @brief Serialize a scalar to wire format.
137 * @param [out] ser Serialized form of a scalar.
138 * @param [in] s Deserialized scalar.
140 void decaf_448_scalar_encode (
141 unsigned char ser[DECAF_448_SCALAR_BYTES],
142 const decaf_448_scalar_t s
143 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE DECAF_NOINLINE;
146 * @brief Add two scalars. The scalars may use the same memory.
147 * @param [in] a One scalar.
148 * @param [in] b Another scalar.
149 * @param [out] out a+b.
151 void decaf_448_scalar_add (
152 decaf_448_scalar_t out,
153 const decaf_448_scalar_t a,
154 const decaf_448_scalar_t b
155 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
158 * @brief Compare two scalars.
159 * @param [in] a One scalar.
160 * @param [in] b Another scalar.
161 * @retval DECAF_TRUE The scalars are equal.
162 * @retval DECAF_FALSE The scalars are not equal.
164 decaf_bool_t decaf_448_scalar_eq (
165 const decaf_448_scalar_t a,
166 const decaf_448_scalar_t b
167 ) DECAF_API_VIS DECAF_WARN_UNUSED DECAF_NONNULL DECAF_NOINLINE;
170 * @brief Subtract two scalars. The scalars may use the same memory.
171 * @param [in] a One scalar.
172 * @param [in] b Another scalar.
173 * @param [out] out a-b.
175 void decaf_448_scalar_sub (
176 decaf_448_scalar_t out,
177 const decaf_448_scalar_t a,
178 const decaf_448_scalar_t b
179 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
182 * @brief Multiply two scalars. The scalars may use the same memory.
183 * @param [in] a One scalar.
184 * @param [in] b Another scalar.
185 * @param [out] out a*b.
187 void decaf_448_scalar_mul (
188 decaf_448_scalar_t out,
189 const decaf_448_scalar_t a,
190 const decaf_448_scalar_t b
191 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
194 * @brief Halve a scalar. The scalars may use the same memory.
195 * @param [in] a A scalar.
196 * @param [out] out a/2.
198 void decaf_448_scalar_halve (
199 decaf_448_scalar_t out,
200 const decaf_448_scalar_t a
201 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
204 * @brief Invert a scalar. When passed zero, return 0. The input and output may alias.
205 * @param [in] a A scalar.
206 * @param [out] out 1/a.
207 * @return DECAF_SUCCESS The input is nonzero.
209 decaf_error_t decaf_448_scalar_invert (
210 decaf_448_scalar_t out,
211 const decaf_448_scalar_t a
212 ) DECAF_API_VIS DECAF_WARN_UNUSED DECAF_NONNULL DECAF_NOINLINE;
215 * @brief Copy a scalar. The scalars may use the same memory, in which
216 * case this function does nothing.
217 * @param [in] a A scalar.
218 * @param [out] out Will become a copy of a.
220 static inline void DECAF_NONNULL decaf_448_scalar_copy (
221 decaf_448_scalar_t out,
222 const decaf_448_scalar_t a
228 * @brief Set a scalar to an unsigned 64-bit integer.
229 * @param [in] a An integer.
230 * @param [out] out Will become equal to a.
232 void decaf_448_scalar_set_unsigned (
233 decaf_448_scalar_t out,
235 ) DECAF_API_VIS DECAF_NONNULL;
238 * @brief Encode a point as a sequence of bytes.
240 * @param [out] ser The byte representation of the point.
241 * @param [in] pt The point to encode.
243 void decaf_448_point_encode (
244 uint8_t ser[DECAF_448_SER_BYTES],
245 const decaf_448_point_t pt
246 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
249 * @brief Decode a point from a sequence of bytes.
251 * Every point has a unique encoding, so not every
252 * sequence of bytes is a valid encoding. If an invalid
253 * encoding is given, the output is undefined.
255 * @param [out] pt The decoded point.
256 * @param [in] ser The serialized version of the point.
257 * @param [in] allow_identity DECAF_TRUE if the identity is a legal input.
258 * @retval DECAF_SUCCESS The decoding succeeded.
259 * @retval DECAF_FAILURE The decoding didn't succeed, because
260 * ser does not represent a point.
262 decaf_error_t decaf_448_point_decode (
263 decaf_448_point_t pt,
264 const uint8_t ser[DECAF_448_SER_BYTES],
265 decaf_bool_t allow_identity
266 ) DECAF_API_VIS DECAF_WARN_UNUSED DECAF_NONNULL DECAF_NOINLINE;
269 * @brief Copy a point. The input and output may alias,
270 * in which case this function does nothing.
272 * @param [out] a A copy of the point.
273 * @param [in] b Any point.
275 static inline void DECAF_NONNULL decaf_448_point_copy (
277 const decaf_448_point_t b
283 * @brief Test whether two points are equal. If yes, return
284 * DECAF_TRUE, else return DECAF_FALSE.
286 * @param [in] a A point.
287 * @param [in] b Another point.
288 * @retval DECAF_TRUE The points are equal.
289 * @retval DECAF_FALSE The points are not equal.
291 decaf_bool_t decaf_448_point_eq (
292 const decaf_448_point_t a,
293 const decaf_448_point_t b
294 ) DECAF_API_VIS DECAF_WARN_UNUSED DECAF_NONNULL DECAF_NOINLINE;
297 * @brief Add two points to produce a third point. The
298 * input points and output point can be pointers to the same
301 * @param [out] sum The sum a+b.
302 * @param [in] a An addend.
303 * @param [in] b An addend.
305 void decaf_448_point_add (
306 decaf_448_point_t sum,
307 const decaf_448_point_t a,
308 const decaf_448_point_t b
309 ) DECAF_API_VIS DECAF_NONNULL;
312 * @brief Double a point. Equivalent to
313 * decaf_448_point_add(two_a,a,a), but potentially faster.
315 * @param [out] two_a The sum a+a.
316 * @param [in] a A point.
318 void decaf_448_point_double (
319 decaf_448_point_t two_a,
320 const decaf_448_point_t a
321 ) DECAF_API_VIS DECAF_NONNULL;
324 * @brief Subtract two points to produce a third point. The
325 * input points and output point can be pointers to the same
328 * @param [out] diff The difference a-b.
329 * @param [in] a The minuend.
330 * @param [in] b The subtrahend.
332 void decaf_448_point_sub (
333 decaf_448_point_t diff,
334 const decaf_448_point_t a,
335 const decaf_448_point_t b
336 ) DECAF_API_VIS DECAF_NONNULL;
339 * @brief Negate a point to produce another point. The input
340 * and output points can use the same memory.
342 * @param [out] nega The negated input point
343 * @param [in] a The input point.
345 void decaf_448_point_negate (
346 decaf_448_point_t nega,
347 const decaf_448_point_t a
348 ) DECAF_API_VIS DECAF_NONNULL;
351 * @brief Multiply a base point by a scalar: scaled = scalar*base.
353 * @param [out] scaled The scaled point base*scalar
354 * @param [in] base The point to be scaled.
355 * @param [in] scalar The scalar to multiply by.
357 void decaf_448_point_scalarmul (
358 decaf_448_point_t scaled,
359 const decaf_448_point_t base,
360 const decaf_448_scalar_t scalar
361 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
364 * @brief Multiply a base point by a scalar: scaled = scalar*base.
365 * This function operates directly on serialized forms.
367 * @warning This function is experimental. It may not be supported
370 * @param [out] scaled The scaled point base*scalar
371 * @param [in] base The point to be scaled.
372 * @param [in] scalar The scalar to multiply by.
373 * @param [in] allow_identity Allow the input to be the identity.
374 * @param [in] short_circuit Allow a fast return if the input is illegal.
376 * @retval DECAF_SUCCESS The scalarmul succeeded.
377 * @retval DECAF_FAILURE The scalarmul didn't succeed, because
378 * base does not represent a point.
380 decaf_error_t decaf_448_direct_scalarmul (
381 uint8_t scaled[DECAF_448_SER_BYTES],
382 const uint8_t base[DECAF_448_SER_BYTES],
383 const decaf_448_scalar_t scalar,
384 decaf_bool_t allow_identity,
385 decaf_bool_t short_circuit
386 ) DECAF_API_VIS DECAF_NONNULL DECAF_WARN_UNUSED DECAF_NOINLINE;
389 * @brief RFC 7748 Diffie-Hellman scalarmul. This function uses a different
390 * (non-Decaf) encoding.
392 * @param [out] scaled The scaled point base*scalar
393 * @param [in] base The point to be scaled.
394 * @param [in] scalar The scalar to multiply by.
396 * @retval DECAF_SUCCESS The scalarmul succeeded.
397 * @retval DECAF_FAILURE The scalarmul didn't succeed, because the base
398 * point is in a small subgroup.
400 decaf_error_t decaf_x448 (
401 uint8_t out[DECAF_X448_PUBLIC_BYTES],
402 const uint8_t base[DECAF_X448_PUBLIC_BYTES],
403 const uint8_t scalar[DECAF_X448_PRIVATE_BYTES]
404 ) DECAF_API_VIS DECAF_NONNULL DECAF_WARN_UNUSED DECAF_NOINLINE;
407 * @brief Multiply a point by DECAF_X448_ENCODE_RATIO,
408 * then encode it like RFC 7748.
410 * This function is mainly used internally, but is exported in case
413 * The ratio is necessary because the internal representation doesn't
414 * track the cofactor information, so on output we must clear the cofactor.
415 * This would multiply by the cofactor, but in fact internally libdecaf's
416 * points are always even, so it multiplies by half the cofactor instead.
418 * As it happens, this aligns with the base point definitions; that is,
419 * if you pass the Decaf/Ristretto base point to this function, the result
420 * will be DECAF_X448_ENCODE_RATIO times the X448
423 * @param [out] out The scaled and encoded point.
424 * @param [in] p The point to be scaled and encoded.
426 void decaf_448_point_mul_by_ratio_and_encode_like_x448 (
427 uint8_t out[DECAF_X448_PUBLIC_BYTES],
428 const decaf_448_point_t p
429 ) DECAF_API_VIS DECAF_NONNULL;
431 /** The base point for X448 Diffie-Hellman */
432 extern const uint8_t decaf_x448_base_point[DECAF_X448_PUBLIC_BYTES] DECAF_API_VIS;
435 * @brief RFC 7748 Diffie-Hellman base point scalarmul. This function uses
436 * a different (non-Decaf) encoding.
438 * Does exactly the same thing as decaf_x448_generate_key,
439 * but has a better name.
441 * @param [out] scaled The scaled point base*scalar
442 * @param [in] scalar The scalar to multiply by.
444 void decaf_x448_derive_public_key (
445 uint8_t out[DECAF_X448_PUBLIC_BYTES],
446 const uint8_t scalar[DECAF_X448_PRIVATE_BYTES]
447 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
449 /* FUTURE: uint8_t decaf_448_encode_like_curve448) */
452 * @brief Precompute a table for fast scalar multiplication.
453 * Some implementations do not include precomputed points; for
454 * those implementations, this implementation simply copies the
457 * @param [out] a A precomputed table of multiples of the point.
458 * @param [in] b Any point.
460 void decaf_448_precompute (
461 decaf_448_precomputed_s *a,
462 const decaf_448_point_t b
463 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
466 * @brief Multiply a precomputed base point by a scalar:
467 * scaled = scalar*base.
468 * Some implementations do not include precomputed points; for
469 * those implementations, this function is the same as
470 * decaf_448_point_scalarmul
472 * @param [out] scaled The scaled point base*scalar
473 * @param [in] base The point to be scaled.
474 * @param [in] scalar The scalar to multiply by.
476 void decaf_448_precomputed_scalarmul (
477 decaf_448_point_t scaled,
478 const decaf_448_precomputed_s *base,
479 const decaf_448_scalar_t scalar
480 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
483 * @brief Multiply two base points by two scalars:
484 * scaled = scalar1*base1 + scalar2*base2.
486 * Equivalent to two calls to decaf_448_point_scalarmul, but may be
489 * @param [out] combo The linear combination scalar1*base1 + scalar2*base2.
490 * @param [in] base1 A first point to be scaled.
491 * @param [in] scalar1 A first scalar to multiply by.
492 * @param [in] base2 A second point to be scaled.
493 * @param [in] scalar2 A second scalar to multiply by.
495 void decaf_448_point_double_scalarmul (
496 decaf_448_point_t combo,
497 const decaf_448_point_t base1,
498 const decaf_448_scalar_t scalar1,
499 const decaf_448_point_t base2,
500 const decaf_448_scalar_t scalar2
501 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
504 * Multiply one base point by two scalars:
506 * a1 = scalar1 * base
507 * a2 = scalar2 * base
509 * Equivalent to two calls to decaf_448_point_scalarmul, but may be
512 * @param [out] a1 The first multiple. It may be the same as the input point.
513 * @param [out] a2 The second multiple. It may be the same as the input point.
514 * @param [in] base1 A point to be scaled.
515 * @param [in] scalar1 A first scalar to multiply by.
516 * @param [in] scalar2 A second scalar to multiply by.
518 void decaf_448_point_dual_scalarmul (
519 decaf_448_point_t a1,
520 decaf_448_point_t a2,
521 const decaf_448_point_t base1,
522 const decaf_448_scalar_t scalar1,
523 const decaf_448_scalar_t scalar2
524 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
527 * @brief Multiply two base points by two scalars:
528 * scaled = scalar1*decaf_448_point_base + scalar2*base2.
530 * Otherwise equivalent to decaf_448_point_double_scalarmul, but may be
531 * faster at the expense of being variable time.
533 * @param [out] combo The linear combination scalar1*base + scalar2*base2.
534 * @param [in] scalar1 A first scalar to multiply by.
535 * @param [in] base2 A second point to be scaled.
536 * @param [in] scalar2 A second scalar to multiply by.
538 * @warning: This function takes variable time, and may leak the scalars
539 * used. It is designed for signature verification.
541 void decaf_448_base_double_scalarmul_non_secret (
542 decaf_448_point_t combo,
543 const decaf_448_scalar_t scalar1,
544 const decaf_448_point_t base2,
545 const decaf_448_scalar_t scalar2
546 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
549 * @brief Constant-time decision between two points. If pick_b
550 * is zero, out = a; else out = b.
552 * @param [out] out The output. It may be the same as either input.
553 * @param [in] a Any point.
554 * @param [in] b Any point.
555 * @param [in] pick_b If nonzero, choose point b.
557 void decaf_448_point_cond_sel (
558 decaf_448_point_t out,
559 const decaf_448_point_t a,
560 const decaf_448_point_t b,
562 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
565 * @brief Constant-time decision between two scalars. If pick_b
566 * is zero, out = a; else out = b.
568 * @param [out] out The output. It may be the same as either input.
569 * @param [in] a Any scalar.
570 * @param [in] b Any scalar.
571 * @param [in] pick_b If nonzero, choose scalar b.
573 void decaf_448_scalar_cond_sel (
574 decaf_448_scalar_t out,
575 const decaf_448_scalar_t a,
576 const decaf_448_scalar_t b,
578 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
581 * @brief Test that a point is valid, for debugging purposes.
583 * @param [in] to_test The point to test.
584 * @retval DECAF_TRUE The point is valid.
585 * @retval DECAF_FALSE The point is invalid.
587 decaf_bool_t decaf_448_point_valid (
588 const decaf_448_point_t to_test
589 ) DECAF_API_VIS DECAF_WARN_UNUSED DECAF_NONNULL DECAF_NOINLINE;
592 * @brief Torque a point, for debugging purposes. The output
593 * will be equal to the input.
595 * @param [out] q The point to torque.
596 * @param [in] p The point to torque.
598 void decaf_448_point_debugging_torque (
600 const decaf_448_point_t p
601 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
604 * @brief Projectively scale a point, for debugging purposes.
605 * The output will be equal to the input, and will be valid
606 * even if the factor is zero.
608 * @param [out] q The point to scale.
609 * @param [in] p The point to scale.
610 * @param [in] factor Serialized GF factor to scale.
612 void decaf_448_point_debugging_pscale (
614 const decaf_448_point_t p,
615 const unsigned char factor[DECAF_448_SER_BYTES]
616 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
619 * @brief Almost-Elligator-like hash to curve.
621 * Call this function with the output of a hash to make a hash to the curve.
623 * This function runs Elligator2 on the decaf_448 Jacobi quartic model. It then
624 * uses the isogeny to put the result in twisted Edwards form. As a result,
625 * it is safe (cannot produce points of order 4), and would be compatible with
626 * hypothetical other implementations of Decaf using a Montgomery or untwisted
629 * Unlike Elligator, this function may be up to 4:1 on [0,(p-1)/2]:
630 * A factor of 2 due to the isogeny.
631 * A factor of 2 because we quotient out the 2-torsion.
633 * This makes it about 8:1 overall, or 16:1 overall on curves with cofactor 8.
635 * Negating the input (mod q) results in the same point. Inverting the input
636 * (mod q) results in the negative point. This is the same as Elligator.
638 * This function isn't quite indifferentiable from a random oracle.
639 * However, it is suitable for many protocols, including SPEKE and SPAKE2 EE.
640 * Furthermore, calling it twice with independent seeds and adding the results
641 * is indifferentiable from a random oracle.
643 * @param [in] hashed_data Output of some hash function.
644 * @param [out] pt The data hashed to the curve.
647 decaf_448_point_from_hash_nonuniform (
648 decaf_448_point_t pt,
649 const unsigned char hashed_data[DECAF_448_HASH_BYTES]
650 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
653 * @brief Indifferentiable hash function encoding to curve.
655 * Equivalent to calling decaf_448_point_from_hash_nonuniform twice and adding.
657 * @param [in] hashed_data Output of some hash function.
658 * @param [out] pt The data hashed to the curve.
660 void decaf_448_point_from_hash_uniform (
661 decaf_448_point_t pt,
662 const unsigned char hashed_data[2*DECAF_448_HASH_BYTES]
663 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE;
666 * @brief Inverse of elligator-like hash to curve.
668 * This function writes to the buffer, to make it so that
669 * decaf_448_point_from_hash_nonuniform(buffer) = pt if
670 * possible. Since there may be multiple preimages, the
671 * "which" parameter chooses between them. To ensure uniform
672 * inverse sampling, this function succeeds or fails
673 * independently for different "which" values.
675 * This function isn't guaranteed to find every possible
676 * preimage, but it finds all except a small finite number.
677 * In particular, when the number of bits in the modulus isn't
678 * a multiple of 8 (i.e. for curve25519), it sets the high bits
679 * independently, which enables the generated data to be uniform.
680 * But it doesn't add p, so you'll never get exactly p from this
681 * function. This might change in the future, especially if
682 * we ever support eg Brainpool curves, where this could cause
683 * real nonuniformity.
685 * @param [out] recovered_hash Encoded data.
686 * @param [in] pt The point to encode.
687 * @param [in] which A value determining which inverse point
690 * @retval DECAF_SUCCESS The inverse succeeded.
691 * @retval DECAF_FAILURE The inverse failed.
694 decaf_448_invert_elligator_nonuniform (
695 unsigned char recovered_hash[DECAF_448_HASH_BYTES],
696 const decaf_448_point_t pt,
698 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE DECAF_WARN_UNUSED;
701 * @brief Inverse of elligator-like hash to curve.
703 * This function writes to the buffer, to make it so that
704 * decaf_448_point_from_hash_uniform(buffer) = pt if
705 * possible. Since there may be multiple preimages, the
706 * "which" parameter chooses between them. To ensure uniform
707 * inverse sampling, this function succeeds or fails
708 * independently for different "which" values.
710 * @param [out] recovered_hash Encoded data.
711 * @param [in] pt The point to encode.
712 * @param [in] which A value determining which inverse point
715 * @retval DECAF_SUCCESS The inverse succeeded.
716 * @retval DECAF_FAILURE The inverse failed.
719 decaf_448_invert_elligator_uniform (
720 unsigned char recovered_hash[2*DECAF_448_HASH_BYTES],
721 const decaf_448_point_t pt,
723 ) DECAF_API_VIS DECAF_NONNULL DECAF_NOINLINE DECAF_WARN_UNUSED;
726 * @brief Overwrite scalar with zeros.
728 void decaf_448_scalar_destroy (
729 decaf_448_scalar_t scalar
730 ) DECAF_NONNULL DECAF_API_VIS;
733 * @brief Overwrite point with zeros.
735 void decaf_448_point_destroy (
736 decaf_448_point_t point
737 ) DECAF_NONNULL DECAF_API_VIS;
740 * @brief Overwrite precomputed table with zeros.
742 void decaf_448_precomputed_destroy (
743 decaf_448_precomputed_s *pre
744 ) DECAF_NONNULL DECAF_API_VIS;
750 #endif /* __DECAF_POINT_448_H__ */