Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
fips202.c File Reference
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "fips202.h"
#include "keccakf1600.h"
Include dependency graph for fips202.c:

Go to the source code of this file.

Macros

#define NROUNDS   24
#define ROL(a, offset)

Functions

void shake128_inc_init (shake128incctx *state)
void shake128_inc_absorb (shake128incctx *state, const uint8_t *input, size_t inlen)
void shake128_inc_finalize (shake128incctx *state)
void shake128_inc_squeeze (uint8_t *output, size_t outlen, shake128incctx *state)
void shake128_inc_ctx_clone (shake128incctx *dest, const shake128incctx *src)
void shake128_inc_ctx_release (shake128incctx *state)
void shake256_inc_init (shake256incctx *state)
void shake256_inc_absorb (shake256incctx *state, const uint8_t *input, size_t inlen)
void shake256_inc_finalize (shake256incctx *state)
void shake256_inc_squeeze (uint8_t *output, size_t outlen, shake256incctx *state)
void shake256_inc_ctx_clone (shake256incctx *dest, const shake256incctx *src)
void shake256_inc_ctx_release (shake256incctx *state)
void cshake128_simple_absorb (shake128ctx *state, uint16_t cstm, const uint8_t *in, size_t inlen)
void cshake128_simple_squeezeblocks (uint8_t *output, size_t nblocks, shake128ctx *state)
void cshake128_simple (uint8_t *output, size_t outlen, uint16_t cstm, const uint8_t *in, size_t inlen)
void shake128_absorb (shake128ctx *state, const uint8_t *input, size_t inlen)
void shake128_squeezeblocks (uint8_t *output, size_t nblocks, shake128ctx *state)
void shake128 (uint8_t *output, size_t outlen, const uint8_t *input, size_t inlen)
void shake128_ctx_release (shake128ctx *state)
void shake128_ctx_clone (shake128ctx *dest, const shake128ctx *src)
void shake256_absorb (shake256ctx *state, const uint8_t *input, size_t inlen)
void shake256_squeezeblocks (uint8_t *output, size_t nblocks, shake256ctx *state)
void shake256 (uint8_t *output, size_t outlen, const uint8_t *input, size_t inlen)
void shake256_ctx_release (shake256ctx *state)
void shake256_ctx_clone (shake256ctx *dest, const shake256ctx *src)
void sha3_256 (uint8_t *output, const uint8_t *input, size_t inlen)
void sha3_256_inc_init (sha3_256incctx *state)
void sha3_256_inc_absorb (sha3_256incctx *state, const uint8_t *input, size_t inlen)
void sha3_256_inc_finalize (uint8_t *output, sha3_256incctx *state)
void sha3_256_inc_ctx_clone (sha3_256incctx *dest, const sha3_256incctx *src)
void sha3_256_inc_ctx_release (sha3_256incctx *state)
void sha3_384_inc_init (sha3_384incctx *state)
void sha3_384_inc_absorb (sha3_384incctx *state, const uint8_t *input, size_t inlen)
void sha3_384_inc_finalize (uint8_t *output, sha3_384incctx *state)
void sha3_384_inc_ctx_clone (sha3_384incctx *dest, const sha3_384incctx *src)
void sha3_384_inc_ctx_release (sha3_384incctx *state)
void sha3_384 (uint8_t *output, const uint8_t *input, size_t inlen)
void sha3_512 (uint8_t *output, const uint8_t *input, size_t inlen)
void sha3_512_inc_init (sha3_512incctx *state)
void sha3_512_inc_absorb (sha3_512incctx *state, const uint8_t *input, size_t inlen)
void sha3_512_inc_finalize (uint8_t *output, sha3_512incctx *state)
void sha3_512_inc_ctx_clone (sha3_512incctx *dest, const sha3_512incctx *src)
void sha3_512_inc_ctx_release (sha3_512incctx *state)
void cshake256_simple_absorb (shake256ctx *state, uint16_t cstm, const uint8_t *in, size_t inlen)
void cshake256_simple_squeezeblocks (uint8_t *output, size_t nblocks, shake256ctx *state)
void cshake256_simple (uint8_t *output, size_t outlen, uint16_t cstm, const uint8_t *in, size_t inlen)

Macro Definition Documentation

◆ NROUNDS

#define NROUNDS   24

Definition at line 15 of file fips202.c.

Referenced by KeccakF1600_StatePermute().

◆ ROL

#define ROL ( a,
offset )
Value:
(((a) << (offset)) ^ ((a) >> (64 - (offset))))
f a
Definition to_model.m:12

Definition at line 16 of file fips202.c.

Function Documentation

◆ cshake128_simple()

void cshake128_simple ( uint8_t * output,
size_t outlen,
uint16_t cstm,
const uint8_t * in,
size_t inlen )

Definition at line 370 of file fips202.c.

371{
372 shake128incctx state;
373 uint8_t sep[8];
374#ifdef PROFILE_HASHING
375 uint64_t t0 = hal_get_time();
376#endif
377
378 keccak_inc_init(state.ctx);
379
380 /* Absorb customization (domain-separation) string */
381 sep[0] = 0x01;
382 sep[1] = 0xa8;
383 sep[2] = 0x01;
384 sep[3] = 0x00;
385 sep[4] = 0x01;
386 sep[5] = 16; // fixed bitlen of cstm
387 sep[6] = cstm & 0xff;
388 sep[7] = cstm >> 8;
389
390 KeccakF1600_StateXORBytes(state.ctx, sep, 0, 8);
392
393 /* Absorb input */
394 keccak_inc_absorb(state.ctx, SHAKE128_RATE, in, inlen);
395 keccak_inc_finalize(state.ctx, SHAKE128_RATE, 0x04);
396
397 /* Squeeze output */
398 keccak_inc_squeeze(output, outlen, state.ctx, SHAKE128_RATE);
399#ifdef PROFILE_HASHING
400 uint64_t t1 = hal_get_time();
401 hash_cycles += (t1-t0);
402#endif
403}
#define SHAKE128_RATE
Definition fips202.h:7
uint64_t hal_get_time()
Definition hal-cortexa.c:10
void KeccakF1600_StateXORBytes(uint64_t *state, const unsigned char *data, unsigned int offset, unsigned int length)
Definition keccakf1600.c:52
void KeccakF1600_StatePermute(uint64_t *state)
Definition keccakf1600.c:61
uint64_t ctx[26]
Definition fips202.h:16

References shake128incctx::ctx, hal_get_time(), KeccakF1600_StatePermute(), KeccakF1600_StateXORBytes(), and SHAKE128_RATE.

Here is the call graph for this function:

◆ cshake128_simple_absorb()

void cshake128_simple_absorb ( shake128ctx * state,
uint16_t cstm,
const uint8_t * in,
size_t inlen )

Definition at line 320 of file fips202.c.

321{
322#ifdef PROFILE_HASHING
323 uint64_t t0 = hal_get_time();
324#endif
325
326
327 uint8_t sep[8];
328 size_t i;
329
330 for (i = 0; i < 25; i++)
331 state->ctx[i] = 0;
332
333 /* Absorb customization (domain-separation) string */
334 sep[0] = 0x01;
335 sep[1] = 0xa8;
336 sep[2] = 0x01;
337 sep[3] = 0x00;
338 sep[4] = 0x01;
339 sep[5] = 16; // fixed bitlen of cstm
340 sep[6] = cstm & 0xff;
341 sep[7] = cstm >> 8;
342
343 KeccakF1600_StateXORBytes(state->ctx, sep, 0, 8);
345
346 /* Absorb input */
347 keccak_absorb(state->ctx, SHAKE128_RATE, in, inlen, 0x04);
348
349#ifdef PROFILE_HASHING
350 uint64_t t1 = hal_get_time();
351 hash_cycles += (t1-t0);
352#endif
353
354}
for i
uint64_t ctx[25]
Definition fips202.h:21

References shake128ctx::ctx, hal_get_time(), i, KeccakF1600_StatePermute(), KeccakF1600_StateXORBytes(), and SHAKE128_RATE.

Here is the call graph for this function:

◆ cshake128_simple_squeezeblocks()

void cshake128_simple_squeezeblocks ( uint8_t * output,
size_t nblocks,
shake128ctx * state )

Definition at line 357 of file fips202.c.

358{
359#ifdef PROFILE_HASHING
360 uint64_t t0 = hal_get_time();
361#endif
362 keccak_squeezeblocks(output, nblocks, state->ctx, SHAKE128_RATE);
363#ifdef PROFILE_HASHING
364 uint64_t t1 = hal_get_time();
365 hash_cycles += (t1-t0);
366#endif
367}

References shake128ctx::ctx, hal_get_time(), and SHAKE128_RATE.

Here is the call graph for this function:

◆ cshake256_simple()

void cshake256_simple ( uint8_t * output,
size_t outlen,
uint16_t cstm,
const uint8_t * in,
size_t inlen )

Definition at line 829 of file fips202.c.

830{
831 shake256incctx state;
832 uint8_t sep[8];
833 #ifdef PROFILE_HASHING
834 uint64_t t0 = hal_get_time();
835 #endif
836
837
838 keccak_inc_init(state.ctx);
839
840 /* Absorb customization (domain-separation) string */
841 sep[0] = 0x01;
842 sep[1] = 0x88;
843 sep[2] = 0x01;
844 sep[3] = 0x00;
845 sep[4] = 0x01;
846 sep[5] = 16; // fixed bitlen of cstm
847 sep[6] = cstm & 0xff;
848 sep[7] = cstm >> 8;
849
850 KeccakF1600_StateXORBytes(state.ctx, sep, 0, 8);
852
853 /* Absorb input */
854 keccak_inc_absorb(state.ctx, SHAKE256_RATE, in, inlen);
855 keccak_inc_finalize(state.ctx, SHAKE256_RATE, 0x04);
856
857 /* Squeeze output */
858 keccak_inc_squeeze(output, outlen, state.ctx, SHAKE256_RATE);
859#ifdef PROFILE_HASHING
860 uint64_t t1 = hal_get_time();
861 hash_cycles += (t1-t0);
862#endif
863}
#define SHAKE256_RATE
Definition fips202.h:8
uint64_t ctx[26]
Definition fips202.h:26

References shake256incctx::ctx, hal_get_time(), KeccakF1600_StatePermute(), KeccakF1600_StateXORBytes(), and SHAKE256_RATE.

Here is the call graph for this function:

◆ cshake256_simple_absorb()

void cshake256_simple_absorb ( shake256ctx * state,
uint16_t cstm,
const uint8_t * in,
size_t inlen )

Definition at line 783 of file fips202.c.

784{
785#ifdef PROFILE_HASHING
786 uint64_t t0 = hal_get_time();
787#endif
788 uint8_t sep[8];
789 size_t i;
790
791 for (i = 0; i < 25; i++)
792 state->ctx[i] = 0;
793
794 /* Absorb customization (domain-separation) string */
795 sep[0] = 0x01;
796 sep[1] = 0x88;
797 sep[2] = 0x01;
798 sep[3] = 0x00;
799 sep[4] = 0x01;
800 sep[5] = 16; // fixed bitlen of cstm
801 sep[6] = cstm & 0xff;
802 sep[7] = cstm >> 8;
803
804 KeccakF1600_StateXORBytes(state->ctx, sep, 0, 8);
806
807 /* Absorb input */
808 keccak_absorb(state->ctx, SHAKE256_RATE, in, inlen, 0x04);
809#ifdef PROFILE_HASHING
810 uint64_t t1 = hal_get_time();
811 hash_cycles += (t1-t0);
812#endif
813}
uint64_t ctx[25]
Definition fips202.h:31

References shake256ctx::ctx, hal_get_time(), i, KeccakF1600_StatePermute(), KeccakF1600_StateXORBytes(), and SHAKE256_RATE.

Here is the call graph for this function:

◆ cshake256_simple_squeezeblocks()

void cshake256_simple_squeezeblocks ( uint8_t * output,
size_t nblocks,
shake256ctx * state )

Definition at line 816 of file fips202.c.

817{
818#ifdef PROFILE_HASHING
819 uint64_t t0 = hal_get_time();
820#endif
821 keccak_squeezeblocks(output, nblocks, state->ctx, SHAKE256_RATE);
822#ifdef PROFILE_HASHING
823 uint64_t t1 = hal_get_time();
824 hash_cycles += (t1-t0);
825#endif
826}

References shake256ctx::ctx, hal_get_time(), and SHAKE256_RATE.

Here is the call graph for this function:

◆ sha3_256()

void sha3_256 ( uint8_t * output,
const uint8_t * input,
size_t inlen )

Definition at line 563 of file fips202.c.

564{
565#ifdef PROFILE_HASHING
566 uint64_t t0 = hal_get_time();
567#endif
568 sha3_256incctx state;
569 keccak_inc_init(state.ctx);
570
571 /* Absorb input */
572 keccak_inc_absorb(state.ctx, SHA3_256_RATE, input, inlen);
573 keccak_inc_finalize(state.ctx, SHA3_256_RATE, 0x06);
574
575 /* Squeeze output */
576 keccak_inc_squeeze(output, 32, state.ctx, SHA3_256_RATE);
577#ifdef PROFILE_HASHING
578 uint64_t t1 = hal_get_time();
579 hash_cycles += (t1-t0);
580#endif
581}
#define SHA3_256_RATE
Definition fips202.h:9
uint64_t ctx[26]
Definition fips202.h:36

References sha3_256incctx::ctx, hal_get_time(), and SHA3_256_RATE.

Here is the call graph for this function:

◆ sha3_256_inc_absorb()

void sha3_256_inc_absorb ( sha3_256incctx * state,
const uint8_t * input,
size_t inlen )

Definition at line 593 of file fips202.c.

593 {
594#ifdef PROFILE_HASHING
595 uint64_t t0 = hal_get_time();
596#endif
597 keccak_inc_absorb(state->ctx, SHA3_256_RATE, input, inlen);
598#ifdef PROFILE_HASHING
599 uint64_t t1 = hal_get_time();
600 hash_cycles += (t1-t0);
601#endif
602}

References sha3_256incctx::ctx, hal_get_time(), and SHA3_256_RATE.

Here is the call graph for this function:

◆ sha3_256_inc_ctx_clone()

void sha3_256_inc_ctx_clone ( sha3_256incctx * dest,
const sha3_256incctx * src )

Definition at line 622 of file fips202.c.

622 {
623 memcpy(dest, src, sizeof(sha3_256incctx));
624}

◆ sha3_256_inc_ctx_release()

void sha3_256_inc_ctx_release ( sha3_256incctx * state)

Definition at line 626 of file fips202.c.

626 {
627 (void) state;
628}

◆ sha3_256_inc_finalize()

void sha3_256_inc_finalize ( uint8_t * output,
sha3_256incctx * state )

Definition at line 604 of file fips202.c.

604 {
605#ifdef PROFILE_HASHING
606 uint64_t t0 = hal_get_time();
607#endif
608 uint8_t t[SHA3_256_RATE];
609 keccak_inc_finalize(state->ctx, SHA3_256_RATE, 0x06);
610
611 keccak_squeezeblocks(t, 1, state->ctx, SHA3_256_RATE);
612
613 for (size_t i = 0; i < 32; i++) {
614 output[i] = t[i];
615 }
616#ifdef PROFILE_HASHING
617 uint64_t t1 = hal_get_time();
618 hash_cycles += (t1-t0);
619#endif
620}

References sha3_256incctx::ctx, hal_get_time(), i, and SHA3_256_RATE.

Here is the call graph for this function:

◆ sha3_256_inc_init()

void sha3_256_inc_init ( sha3_256incctx * state)

Definition at line 582 of file fips202.c.

582 {
583#ifdef PROFILE_HASHING
584 uint64_t t0 = hal_get_time();
585#endif
586 keccak_inc_init(state->ctx);
587#ifdef PROFILE_HASHING
588 uint64_t t1 = hal_get_time();
589 hash_cycles += (t1-t0);
590#endif
591}

References sha3_256incctx::ctx, and hal_get_time().

Here is the call graph for this function:

◆ sha3_384()

void sha3_384 ( uint8_t * output,
const uint8_t * input,
size_t inlen )

Definition at line 687 of file fips202.c.

687 {
688#ifdef PROFILE_HASHING
689 uint64_t t0 = hal_get_time();
690#endif
691 sha3_384incctx state;
692 keccak_inc_init(state.ctx);
693
694 /* Absorb input */
695 keccak_inc_absorb(state.ctx, SHA3_384_RATE, input, inlen);
696 keccak_inc_finalize(state.ctx, SHA3_384_RATE, 0x06);
697
698 /* Squeeze output */
699 keccak_inc_squeeze(output, 48, state.ctx, SHA3_384_RATE);
700#ifdef PROFILE_HASHING
701 uint64_t t1 = hal_get_time();
702 hash_cycles += (t1-t0);
703#endif
704}
#define SHA3_384_RATE
Definition fips202.h:10
uint64_t ctx[26]
Definition fips202.h:41

References sha3_384incctx::ctx, hal_get_time(), and SHA3_384_RATE.

Here is the call graph for this function:

◆ sha3_384_inc_absorb()

void sha3_384_inc_absorb ( sha3_384incctx * state,
const uint8_t * input,
size_t inlen )

Definition at line 641 of file fips202.c.

641 {
642#ifdef PROFILE_HASHING
643 uint64_t t0 = hal_get_time();
644#endif
645 keccak_inc_absorb(state->ctx, SHA3_384_RATE, input, inlen);
646#ifdef PROFILE_HASHING
647 uint64_t t1 = hal_get_time();
648 hash_cycles += (t1-t0);
649#endif
650}

References sha3_384incctx::ctx, hal_get_time(), and SHA3_384_RATE.

Here is the call graph for this function:

◆ sha3_384_inc_ctx_clone()

void sha3_384_inc_ctx_clone ( sha3_384incctx * dest,
const sha3_384incctx * src )

Definition at line 670 of file fips202.c.

670 {
671 memcpy(dest, src, sizeof(sha3_384incctx));
672}

◆ sha3_384_inc_ctx_release()

void sha3_384_inc_ctx_release ( sha3_384incctx * state)

Definition at line 674 of file fips202.c.

674 {
675 (void) state;
676}

◆ sha3_384_inc_finalize()

void sha3_384_inc_finalize ( uint8_t * output,
sha3_384incctx * state )

Definition at line 652 of file fips202.c.

652 {
653#ifdef PROFILE_HASHING
654 uint64_t t0 = hal_get_time();
655#endif
656 uint8_t t[SHA3_384_RATE];
657 keccak_inc_finalize(state->ctx, SHA3_384_RATE, 0x06);
658
659 keccak_squeezeblocks(t, 1, state->ctx, SHA3_384_RATE);
660
661 for (size_t i = 0; i < 48; i++) {
662 output[i] = t[i];
663 }
664#ifdef PROFILE_HASHING
665 uint64_t t1 = hal_get_time();
666 hash_cycles += (t1-t0);
667#endif
668}

References sha3_384incctx::ctx, hal_get_time(), i, and SHA3_384_RATE.

Here is the call graph for this function:

◆ sha3_384_inc_init()

void sha3_384_inc_init ( sha3_384incctx * state)

Definition at line 630 of file fips202.c.

630 {
631#ifdef PROFILE_HASHING
632 uint64_t t0 = hal_get_time();
633#endif
634 keccak_inc_init(state->ctx);
635#ifdef PROFILE_HASHING
636 uint64_t t1 = hal_get_time();
637 hash_cycles += (t1-t0);
638#endif
639}

References sha3_384incctx::ctx, and hal_get_time().

Here is the call graph for this function:

◆ sha3_512()

void sha3_512 ( uint8_t * output,
const uint8_t * input,
size_t inlen )

Definition at line 714 of file fips202.c.

715{
716#ifdef PROFILE_HASHING
717 uint64_t t0 = hal_get_time();
718#endif
719 sha3_512incctx state;
720 keccak_inc_init(state.ctx);
721
722 /* Absorb input */
723 keccak_inc_absorb(state.ctx, SHA3_512_RATE, input, inlen);
724 keccak_inc_finalize(state.ctx, SHA3_512_RATE, 0x06);
725
726 /* Squeeze output */
727 keccak_inc_squeeze(output, 64, state.ctx, SHA3_512_RATE);
728#ifdef PROFILE_HASHING
729 uint64_t t1 = hal_get_time();
730 hash_cycles += (t1-t0);
731#endif
732}
#define SHA3_512_RATE
Definition fips202.h:11
uint64_t ctx[26]
Definition fips202.h:46

References sha3_512incctx::ctx, hal_get_time(), and SHA3_512_RATE.

Here is the call graph for this function:

◆ sha3_512_inc_absorb()

void sha3_512_inc_absorb ( sha3_512incctx * state,
const uint8_t * input,
size_t inlen )

Definition at line 744 of file fips202.c.

744 {
745#ifdef PROFILE_HASHING
746 uint64_t t0 = hal_get_time();
747#endif
748 keccak_inc_absorb(state->ctx, SHA3_512_RATE, input, inlen);
749#ifdef PROFILE_HASHING
750 uint64_t t1 = hal_get_time();
751 hash_cycles += (t1-t0);
752#endif
753}

References sha3_512incctx::ctx, hal_get_time(), and SHA3_512_RATE.

Here is the call graph for this function:

◆ sha3_512_inc_ctx_clone()

void sha3_512_inc_ctx_clone ( sha3_512incctx * dest,
const sha3_512incctx * src )

Definition at line 773 of file fips202.c.

773 {
774 memcpy(dest, src, sizeof(sha3_512incctx));
775}

◆ sha3_512_inc_ctx_release()

void sha3_512_inc_ctx_release ( sha3_512incctx * state)

Definition at line 777 of file fips202.c.

777 {
778 (void) state;
779}

◆ sha3_512_inc_finalize()

void sha3_512_inc_finalize ( uint8_t * output,
sha3_512incctx * state )

Definition at line 755 of file fips202.c.

755 {
756#ifdef PROFILE_HASHING
757 uint64_t t0 = hal_get_time();
758#endif
759 uint8_t t[SHA3_512_RATE];
760 keccak_inc_finalize(state->ctx, SHA3_512_RATE, 0x06);
761
762 keccak_squeezeblocks(t, 1, state->ctx, SHA3_512_RATE);
763
764 for (size_t i = 0; i < 64; i++) {
765 output[i] = t[i];
766 }
767#ifdef PROFILE_HASHING
768 uint64_t t1 = hal_get_time();
769 hash_cycles += (t1-t0);
770#endif
771}

References sha3_512incctx::ctx, hal_get_time(), i, and SHA3_512_RATE.

Here is the call graph for this function:

◆ sha3_512_inc_init()

void sha3_512_inc_init ( sha3_512incctx * state)

Definition at line 733 of file fips202.c.

733 {
734#ifdef PROFILE_HASHING
735 uint64_t t0 = hal_get_time();
736#endif
737 keccak_inc_init(state->ctx);
738#ifdef PROFILE_HASHING
739 uint64_t t1 = hal_get_time();
740 hash_cycles += (t1-t0);
741#endif
742}

References sha3_512incctx::ctx, and hal_get_time().

Here is the call graph for this function:

◆ shake128()

void shake128 ( uint8_t * output,
size_t outlen,
const uint8_t * input,
size_t inlen )

Definition at line 456 of file fips202.c.

457{
458#ifdef PROFILE_HASHING
459 uint64_t t0 = hal_get_time();
460#endif
461 shake128incctx state;
462
463 keccak_inc_init(state.ctx);
464
465 /* Absorb input */
466 keccak_inc_absorb(state.ctx, SHAKE128_RATE, input, inlen);
467 keccak_inc_finalize(state.ctx, SHAKE128_RATE, 0x1F);
468
469 /* Squeeze output */
470 keccak_inc_squeeze(output, outlen, state.ctx, SHAKE128_RATE);
471#ifdef PROFILE_HASHING
472 uint64_t t1 = hal_get_time();
473 hash_cycles += (t1-t0);
474#endif
475}

References shake128incctx::ctx, hal_get_time(), and SHAKE128_RATE.

Here is the call graph for this function:

◆ shake128_absorb()

void shake128_absorb ( shake128ctx * state,
const uint8_t * input,
size_t inlen )

Definition at line 417 of file fips202.c.

418{
419#ifdef PROFILE_HASHING
420 uint64_t t0 = hal_get_time();
421#endif
422 int i;
423 for (i = 0; i < 25; i++)
424 state->ctx[i] = 0;
425
426 keccak_absorb(state->ctx, SHAKE128_RATE, input, inlen, 0x1F);
427#ifdef PROFILE_HASHING
428 uint64_t t1 = hal_get_time();
429 hash_cycles += (t1-t0);
430#endif
431}

References shake128ctx::ctx, hal_get_time(), i, and SHAKE128_RATE.

Here is the call graph for this function:

◆ shake128_ctx_clone()

void shake128_ctx_clone ( shake128ctx * dest,
const shake128ctx * src )

Definition at line 480 of file fips202.c.

480 {
481 memcpy(dest, src, sizeof(shake128ctx));
482}

◆ shake128_ctx_release()

void shake128_ctx_release ( shake128ctx * state)

Definition at line 477 of file fips202.c.

477 {
478 (void) state;
479}

◆ shake128_inc_absorb()

void shake128_inc_absorb ( shake128incctx * state,
const uint8_t * input,
size_t inlen )

Definition at line 225 of file fips202.c.

225 {
226#ifdef PROFILE_HASHING
227 uint64_t t0 = hal_get_time();
228#endif
229 keccak_inc_absorb(state->ctx, SHAKE128_RATE, input, inlen);
230#ifdef PROFILE_HASHING
231 uint64_t t1 = hal_get_time();
232 hash_cycles += (t1-t0);
233#endif
234}

References shake128incctx::ctx, hal_get_time(), and SHAKE128_RATE.

Here is the call graph for this function:

◆ shake128_inc_ctx_clone()

void shake128_inc_ctx_clone ( shake128incctx * dest,
const shake128incctx * src )

Definition at line 258 of file fips202.c.

258 {
259 memcpy(dest, src, sizeof(shake128incctx));
260}

◆ shake128_inc_ctx_release()

void shake128_inc_ctx_release ( shake128incctx * state)

Definition at line 262 of file fips202.c.

262 {
263 (void) state;
264}

◆ shake128_inc_finalize()

void shake128_inc_finalize ( shake128incctx * state)

Definition at line 236 of file fips202.c.

236 {
237#ifdef PROFILE_HASHING
238 uint64_t t0 = hal_get_time();
239#endif
240 keccak_inc_finalize(state->ctx, SHAKE128_RATE, 0x1F);
241#ifdef PROFILE_HASHING
242 uint64_t t1 = hal_get_time();
243 hash_cycles += (t1-t0);
244#endif
245}

References shake128incctx::ctx, hal_get_time(), and SHAKE128_RATE.

Here is the call graph for this function:

◆ shake128_inc_init()

void shake128_inc_init ( shake128incctx * state)

Definition at line 214 of file fips202.c.

214 {
215#ifdef PROFILE_HASHING
216 uint64_t t0 = hal_get_time();
217#endif
218 keccak_inc_init(state->ctx);
219#ifdef PROFILE_HASHING
220 uint64_t t1 = hal_get_time();
221 hash_cycles += (t1-t0);
222#endif
223}

References shake128incctx::ctx, and hal_get_time().

Here is the call graph for this function:

◆ shake128_inc_squeeze()

void shake128_inc_squeeze ( uint8_t * output,
size_t outlen,
shake128incctx * state )

Definition at line 247 of file fips202.c.

247 {
248#ifdef PROFILE_HASHING
249 uint64_t t0 = hal_get_time();
250#endif
251 keccak_inc_squeeze(output, outlen, state->ctx, SHAKE128_RATE);
252#ifdef PROFILE_HASHING
253 uint64_t t1 = hal_get_time();
254 hash_cycles += (t1-t0);
255#endif
256}

References shake128incctx::ctx, hal_get_time(), and SHAKE128_RATE.

Here is the call graph for this function:

◆ shake128_squeezeblocks()

void shake128_squeezeblocks ( uint8_t * output,
size_t nblocks,
shake128ctx * state )

Definition at line 444 of file fips202.c.

445{
446#ifdef PROFILE_HASHING
447 uint64_t t0 = hal_get_time();
448#endif
449 keccak_squeezeblocks(output, nblocks, state->ctx, SHAKE128_RATE);
450#ifdef PROFILE_HASHING
451 uint64_t t1 = hal_get_time();
452 hash_cycles += (t1-t0);
453#endif
454}

References shake128ctx::ctx, hal_get_time(), and SHAKE128_RATE.

Here is the call graph for this function:

◆ shake256()

void shake256 ( uint8_t * output,
size_t outlen,
const uint8_t * input,
size_t inlen )

Definition at line 523 of file fips202.c.

525{
526#ifdef PROFILE_HASHING
527 uint64_t t0 = hal_get_time();
528#endif
529 shake256incctx state;
530
531 keccak_inc_init(state.ctx);
532
533 /* Absorb input */
534 keccak_inc_absorb(state.ctx, SHAKE256_RATE, input, inlen);
535 keccak_inc_finalize(state.ctx, SHAKE256_RATE, 0x1F);
536
537 /* Squeeze output */
538 keccak_inc_squeeze(output, outlen, state.ctx, SHAKE256_RATE);
539#ifdef PROFILE_HASHING
540 uint64_t t1 = hal_get_time();
541 hash_cycles += (t1-t0);
542#endif
543}

References shake256incctx::ctx, hal_get_time(), and SHAKE256_RATE.

Here is the call graph for this function:

◆ shake256_absorb()

void shake256_absorb ( shake256ctx * state,
const uint8_t * input,
size_t inlen )

Definition at line 484 of file fips202.c.

485{
486#ifdef PROFILE_HASHING
487 uint64_t t0 = hal_get_time();
488#endif
489 int i;
490 for (i = 0; i < 25; i++)
491 state->ctx[i] = 0;
492
493 keccak_absorb(state->ctx, SHAKE256_RATE, input, inlen, 0x1F);
494#ifdef PROFILE_HASHING
495 uint64_t t1 = hal_get_time();
496 hash_cycles += (t1-t0);
497#endif
498}

References shake256ctx::ctx, hal_get_time(), i, and SHAKE256_RATE.

Here is the call graph for this function:

◆ shake256_ctx_clone()

void shake256_ctx_clone ( shake256ctx * dest,
const shake256ctx * src )

Definition at line 549 of file fips202.c.

549 {
550 memcpy(dest, src, sizeof(shake256ctx));
551}

◆ shake256_ctx_release()

void shake256_ctx_release ( shake256ctx * state)

Definition at line 545 of file fips202.c.

545 {
546 (void) state;
547}

◆ shake256_inc_absorb()

void shake256_inc_absorb ( shake256incctx * state,
const uint8_t * input,
size_t inlen )

Definition at line 277 of file fips202.c.

277 {
278#ifdef PROFILE_HASHING
279 uint64_t t0 = hal_get_time();
280#endif
281 keccak_inc_absorb(state->ctx, SHAKE256_RATE, input, inlen);
282#ifdef PROFILE_HASHING
283 uint64_t t1 = hal_get_time();
284 hash_cycles += (t1-t0);
285#endif
286}

References shake256incctx::ctx, hal_get_time(), and SHAKE256_RATE.

Here is the call graph for this function:

◆ shake256_inc_ctx_clone()

void shake256_inc_ctx_clone ( shake256incctx * dest,
const shake256incctx * src )

Definition at line 310 of file fips202.c.

310 {
311 memcpy(dest, src, sizeof(shake256incctx));
312}

◆ shake256_inc_ctx_release()

void shake256_inc_ctx_release ( shake256incctx * state)

Definition at line 314 of file fips202.c.

314 {
315 (void) state;
316}

◆ shake256_inc_finalize()

void shake256_inc_finalize ( shake256incctx * state)

Definition at line 288 of file fips202.c.

288 {
289#ifdef PROFILE_HASHING
290 uint64_t t0 = hal_get_time();
291#endif
292 keccak_inc_finalize(state->ctx, SHAKE256_RATE, 0x1F);
293#ifdef PROFILE_HASHING
294 uint64_t t1 = hal_get_time();
295 hash_cycles += (t1-t0);
296#endif
297}

References shake256incctx::ctx, hal_get_time(), and SHAKE256_RATE.

Here is the call graph for this function:

◆ shake256_inc_init()

void shake256_inc_init ( shake256incctx * state)

Definition at line 266 of file fips202.c.

266 {
267#ifdef PROFILE_HASHING
268 uint64_t t0 = hal_get_time();
269#endif
270 keccak_inc_init(state->ctx);
271#ifdef PROFILE_HASHING
272 uint64_t t1 = hal_get_time();
273 hash_cycles += (t1-t0);
274#endif
275}

References shake256incctx::ctx, and hal_get_time().

Here is the call graph for this function:

◆ shake256_inc_squeeze()

void shake256_inc_squeeze ( uint8_t * output,
size_t outlen,
shake256incctx * state )

Definition at line 299 of file fips202.c.

299 {
300#ifdef PROFILE_HASHING
301 uint64_t t0 = hal_get_time();
302#endif
303 keccak_inc_squeeze(output, outlen, state->ctx, SHAKE256_RATE);
304#ifdef PROFILE_HASHING
305 uint64_t t1 = hal_get_time();
306 hash_cycles += (t1-t0);
307#endif
308}

References shake256incctx::ctx, hal_get_time(), and SHAKE256_RATE.

Here is the call graph for this function:

◆ shake256_squeezeblocks()

void shake256_squeezeblocks ( uint8_t * output,
size_t nblocks,
shake256ctx * state )

Definition at line 501 of file fips202.c.

502{
503#ifdef PROFILE_HASHING
504 uint64_t t0 = hal_get_time();
505#endif
506 keccak_squeezeblocks(output, nblocks, state->ctx, SHAKE256_RATE);
507#ifdef PROFILE_HASHING
508 uint64_t t1 = hal_get_time();
509 hash_cycles += (t1-t0);
510#endif
511}

References shake256ctx::ctx, hal_get_time(), and SHAKE256_RATE.

Here is the call graph for this function: