add sha256 syscall (#12569)

This commit is contained in:
Jack May
2020-09-29 23:29:20 -07:00
committed by GitHub
parent 89424b29bf
commit 058bca6632
16 changed files with 321 additions and 6 deletions

View File

@ -391,6 +391,32 @@ static bool sol_deserialize(
return true;
}
/**
* Byte array pointer and string
*/
typedef struct {
const uint8_t *addr; /** bytes */
uint64_t len; /** number of bytes*/
} SolBytes;
/**
* Length of a sha256 hash result
*/
#define SHA256_RESULT_LENGTH 32
/**
* Sha256
*
* @param bytes Array of byte arrays
* @param bytes_len Number of byte arrays
* @param result 32 byte array to hold the result
*/
static uint64_t sol_sha256(
const SolBytes *bytes,
int bytes_len,
const uint8_t *result
);
/**
* Account Meta
*/
@ -428,7 +454,7 @@ typedef struct {
uint64_t len; /** Number of seeds */
} SolSignerSeeds;
/*
/**
* Create a program address
*
* @param seeds Seed bytes used to sign program accounts
@ -448,7 +474,7 @@ static uint64_t sol_create_program_address(
* * @{
*/
/*
/**
* Invoke another program and sign for some of the keys
*
* @param instruction Instruction to process
@ -480,7 +506,7 @@ static uint64_t sol_invoke_signed(
signers_seeds_len
);
}
/*
/**
* Invoke another program
*
* @param instruction Instruction to process