Skip to content

Commit

Permalink
armv7m: shake*
Browse files Browse the repository at this point in the history
  • Loading branch information
tfaoliveira committed Oct 22, 2023
1 parent 832cb34 commit 079f309
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/crypto_xof/shake128/armv7m/ref/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
override JFLAGS += -arch arm-m4
SRCS := xof.jazz
include ../../../../Makefile.common
17 changes: 17 additions & 0 deletions src/crypto_xof/shake128/armv7m/ref/include/api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef JADE_XOF_shake128_armv7m_ref_API_H
#define JADE_XOF_shake128_armv7m_ref_API_H

#define JADE_XOF_shake128_armv7m_ref_ALGNAME "SHAKE128"
#define JADE_XOF_shake128_armv7m_ref_ARCH "armv7m"
#define JADE_XOF_shake128_armv7m_ref_IMPL "ref"

#include <stdint.h>

int jade_xof_shake128_armv7m_ref(
uint8_t *output,
uint32_t output_length,
const uint8_t *input,
uint32_t input_length
);

#endif
13 changes: 13 additions & 0 deletions src/crypto_xof/shake128/armv7m/ref/shake128.jinc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from Jade require "common/keccak/keccak1600/armv7m/ref/keccak1600.jinc"

inline fn __shake128_ref(reg u32 out outlen in inlen)
{
reg u32 rate trail_byte;

trail_byte = 0x1F;
rate = (1344/8);

__keccak1600_ref(out, outlen, in, inlen, trail_byte, rate);
}


11 changes: 11 additions & 0 deletions src/crypto_xof/shake128/armv7m/ref/xof.jazz
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "shake128.jinc"

export fn jade_xof_shake128_armv7m_ref(reg u32 output output_length input input_length) -> reg u32
{
reg u32 r;
__shake128_ref(output, output_length, input, input_length);
r = 0;
return r;
}


3 changes: 3 additions & 0 deletions src/crypto_xof/shake256/armv7m/ref/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
override JFLAGS += -arch arm-m4
SRCS := xof.jazz
include ../../../../Makefile.common
17 changes: 17 additions & 0 deletions src/crypto_xof/shake256/armv7m/ref/include/api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef JADE_XOF_shake256_armv7m_ref_API_H
#define JADE_XOF_shake256_armv7m_ref_API_H

#define JADE_XOF_shake256_armv7m_ref_ALGNAME "SHAKE256"
#define JADE_XOF_shake256_armv7m_ref_ARCH "armv7m"
#define JADE_XOF_shake256_armv7m_ref_IMPL "ref"

#include <stdint.h>

int jade_xof_shake256_armv7m_ref(
uint8_t *output,
uint32_t output_length,
const uint8_t *input,
uint32_t input_length
);

#endif
13 changes: 13 additions & 0 deletions src/crypto_xof/shake256/armv7m/ref/shake256.jinc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from Jade require "common/keccak/keccak1600/armv7m/ref/keccak1600.jinc"

inline fn __shake256_ref(reg u32 out outlen in inlen)
{
reg u32 rate trail_byte;

trail_byte = 0x1F;
rate = (1088/8);

__keccak1600_ref(out, outlen, in, inlen, trail_byte, rate);
}


10 changes: 10 additions & 0 deletions src/crypto_xof/shake256/armv7m/ref/xof.jazz
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require "shake256.jinc"

export fn jade_xof_shake256_armv7m_ref(reg u32 output output_length input input_length) -> reg u32
{
reg u32 r;
__shake256_ref(output, output_length, input, input_length);
r = 0;
return r;
}

0 comments on commit 079f309

Please sign in to comment.