[crypto] add support for ECDSA signing (#3218)

This commit is contained in:
Łukasz Duda
2018-10-30 12:23:10 -07:00
committed by Jonathan Hui
parent e99ce0cf1f
commit 014514442d
9 changed files with 300 additions and 4 deletions
+24
View File
@@ -38,6 +38,8 @@
#include <stdbool.h>
#include <stdint.h>
#include <openthread/error.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -103,6 +105,28 @@ void otCryptoAesCcm(const uint8_t *aKey,
bool aEncrypt,
void * aTag);
/**
* This method creates ECDSA sign.
*
* @param[out] aOutput An output buffer where ECDSA sign should be stored.
* @param[inout] aOutputLength The length of the @p aOutput buffer.
* @param[in] aInputHash An input hash.
* @param[in] aInputHashLength The length of the @p aClaims buffer.
* @param[in] aPrivateKey A private key in PEM format.
* @param[in] aPrivateKeyLength The length of the @p aPrivateKey buffer.
*
* @retval OT_ERROR_NONE ECDSA sign has been created successfully.
* @retval OT_ERROR_NO_BUFS Output buffer is too small.
* @retval OT_ERROR_INVALID_ARGS Private key is not valid EC Private Key.
* @rerval OT_ERROR_FAILED Error during signing.
*/
otError otCryptoEcdsaSign(uint8_t * aOutput,
uint16_t * aOutputLength,
const uint8_t *aInputHash,
uint16_t aInputHashLength,
const uint8_t *aPrivateKey,
uint16_t aPrivateKeyLength);
/**
* @}
*