diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-02-13 16:34:18 +0100 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-02-13 16:34:18 +0100 |
commit | 63e47cd7180a46635ed08a80e3b1bcb17c3b8a58 (patch) | |
tree | 58efd429413f93e48e17f807edce736dd31c50c9 /libparc/parc/security/parc_Signer.c | |
parent | fa9264951b3b3b4e69af84744f20e2dc147facf6 (diff) |
Reintroduced for backward compatibility the old api for signing packets that allocates the buffer holding the signature.
Change-Id: I7ee9089b5cb1ec21fd0c5c27f9ee391cc294266b
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'libparc/parc/security/parc_Signer.c')
-rw-r--r-- | libparc/parc/security/parc_Signer.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libparc/parc/security/parc_Signer.c b/libparc/parc/security/parc_Signer.c index 2d3c7465..4015875a 100644 --- a/libparc/parc/security/parc_Signer.c +++ b/libparc/parc/security/parc_Signer.c @@ -108,12 +108,21 @@ parcSigner_GetCryptoHasher(const PARCSigner *signer) } PARCSignature * -parcSigner_SignDigest(const PARCSigner *signer, const PARCCryptoHash *parcDigest, uint8_t * signature, uint32_t sig_len) +parcSigner_SignDigestNoAlloc(const PARCSigner *signer, const PARCCryptoHash *parcDigest, uint8_t * signature, uint32_t sig_len) { parcSigner_OptionalAssertValid(signer); parcAssertNotNull(parcDigest, "parcDigest to sign must not be null"); - return signer->interface->SignDigest(signer->instance, parcDigest, signature, sig_len); + return signer->interface->SignDigestNoAlloc(signer->instance, parcDigest, signature, sig_len); +} + +PARCSignature * +parcSigner_SignDigest(const PARCSigner *signer, const PARCCryptoHash *parcDigest) +{ + parcSigner_OptionalAssertValid(signer); + + parcAssertNotNull(parcDigest, "parcDigest to sign must not be null"); + return signer->interface->SignDigest(signer->instance, parcDigest); } PARCSignature * @@ -129,7 +138,7 @@ parcSigner_SignBuffer(const PARCSigner *signer, const PARCBuffer *buffer, uint8_ PARCCryptoHash *hash = parcCryptoHasher_Finalize(hasher); parcCryptoHasher_Release(&hasher); - PARCSignature *signature = parcSigner_SignDigest(signer, hash, signature_buf, sig_len); + PARCSignature *signature = parcSigner_SignDigestNoAlloc(signer, hash, signature_buf, sig_len); parcCryptoHash_Release(&hash); return signature; |