Skip to content

Commit

Permalink
fix sig.h and sig.c
Browse files Browse the repository at this point in the history
Signed-off-by: mraksoll4 <[email protected]>
  • Loading branch information
mraksoll4 committed Jan 2, 2025
1 parent 6f16cce commit 46998c8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/sig/sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,22 @@ OQS_API OQS_STATUS OQS_SIG_keypair(const OQS_SIG *sig, uint8_t *public_key, uint
}
}

OQS_API OQS_STATUS OQS_SIG_keypair_from_fseed(const OQS_SIG *sig, uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed) {
if (sig == NULL || sig->keypair_from_fseed(public_key, secret_key, seed) != OQS_SUCCESS) {
return OQS_ERROR;
} else {
return OQS_SUCCESS;
}
}

OQS_API OQS_STATUS OQS_SIG_pubkey_from_privkey(const OQS_SIG *sig, uint8_t *public_key, const uint8_t *secret_key) {
if (sig == NULL || sig->pubkey_from_privkey(public_key, secret_key) != OQS_SUCCESS) {
return OQS_ERROR;
} else {
return OQS_SUCCESS;
}
}

OQS_API OQS_STATUS OQS_SIG_sign(const OQS_SIG *sig, uint8_t *signature, size_t *signature_len, const uint8_t *message, size_t message_len, const uint8_t *secret_key) {
if (sig == NULL || sig->sign(signature, signature_len, message, message_len, secret_key) != OQS_SUCCESS) {
return OQS_ERROR;
Expand Down
20 changes: 20 additions & 0 deletions src/sig/sig.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ typedef struct OQS_SIG {
*/
OQS_STATUS (*keypair)(uint8_t *public_key, uint8_t *secret_key);

/**
* Keypair generation algorithm but can generate keypair from fixed seed or other random source.
*/
OQS_STATUS (*keypair_from_fseed)(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed);

/**
* Public key generation from exist private key.
*/
OQS_STATUS (*pubkey_from_privkey)(uint8_t *public_key, const uint8_t *secret_key);

/**
* Signature generation algorithm.
*
Expand Down Expand Up @@ -290,6 +300,16 @@ OQS_API OQS_SIG *OQS_SIG_new(const char *method_name);
*/
OQS_API OQS_STATUS OQS_SIG_keypair(const OQS_SIG *sig, uint8_t *public_key, uint8_t *secret_key);

/**
* Keypair generation algorithm but can generate keypair from fixed seed or other random source.
*/
OQS_API OQS_STATUS OQS_SIG_keypair_from_fseed(const OQS_SIG *sig, uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed);

/**
* Public key generation from exist private key.
*/
OQS_API OQS_STATUS OQS_SIG_pubkey_from_privkey(const OQS_SIG *sig, uint8_t *public_key, const uint8_t *secret_key);

/**
* Signature generation algorithm.
*
Expand Down

0 comments on commit 46998c8

Please sign in to comment.