-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87ff43c
commit 686a44a
Showing
3 changed files
with
188 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/** | ||
* @file | ||
* @brief | ||
*/ | ||
|
||
#include <stdint.h> | ||
#include "exceptions.h" | ||
#include "os_types.h" | ||
#include "os_endorsement.h" | ||
|
||
/** | ||
* @brief | ||
* | ||
* @param buffer | ||
* @return | ||
*/ | ||
unsigned int os_endorsement_get_code_hash(unsigned char *buffer PLENGTH(32)) | ||
{ | ||
bolos_err_t error = ENDORSEMENT_get_code_hash((uint8_t *) buffer); | ||
|
||
if (error) { | ||
THROW(error); | ||
} | ||
|
||
return ENDORSEMENT_HASH_LENGTH; | ||
} | ||
|
||
unsigned int os_endorsement_get_public_key(unsigned char index, | ||
unsigned char *buffer, | ||
unsigned char *length) | ||
{ | ||
return ENDORSEMENT_get_public_key((ENDORSEMENT_slot_t) index, buffer, length); | ||
} | ||
|
||
unsigned int os_endorsement_get_public_key_certificate(unsigned char index, | ||
unsigned char *buffer, | ||
unsigned char *length) | ||
{ | ||
return ENDORSEMENT_get_public_key_certificate(index, buffer, length); | ||
} | ||
|
||
unsigned int os_endorsement_key1_get_app_secret(unsigned char *buffer) | ||
{ | ||
bolos_err_t error = ENDORSEMENT_key1_get_app_secret(buffer); | ||
|
||
if (error) { | ||
THROW(error); | ||
} | ||
|
||
return ENDORSEMENT_APP_SECRET_LENGTH; | ||
} | ||
|
||
unsigned int os_endorsement_key1_sign_data(unsigned char *src, | ||
unsigned int srcLength, | ||
unsigned char *signature) | ||
{ | ||
uint32_t out_signature_length = 0; | ||
bolos_err_t error | ||
= ENDORSEMENT_key1_sign_data(src, srcLength, signature, &out_signature_length); | ||
|
||
if (error) { | ||
THROW(error); | ||
} | ||
|
||
return out_signature_length; | ||
} | ||
|
||
unsigned int os_endorsement_key1_sign_without_code_hash(unsigned char *src, | ||
unsigned int srcLength, | ||
unsigned char *signature) | ||
{ | ||
uint32_t out_signature_length = 0; | ||
bolos_err_t error | ||
= ENDORSEMENT_key1_sign_without_code_hash(src, srcLength, signature, &out_signature_length); | ||
|
||
if (error) { | ||
THROW(error); | ||
} | ||
|
||
return out_signature_length; | ||
} | ||
|
||
unsigned int os_endorsement_key2_derive_sign_data(unsigned char *src, | ||
unsigned int srcLength, | ||
unsigned char *signature) | ||
{ | ||
uint32_t out_signature_length = 0; | ||
bolos_err_t error = ENDORSEMENT_key2_derive_sign_data_internal( | ||
src, srcLength, signature, &out_signature_length); | ||
|
||
if (error) { | ||
THROW(error); | ||
} | ||
|
||
return out_signature_length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters