From b77148ddc3def71e6c412c3afb5f1c20be2d77cd Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Wed, 6 Feb 2019 12:05:58 +0100 Subject: [CICN-14] Removed copy of signature in libparc. The api now accepts a pointer to a buf where it stores the computed signature Change-Id: I4427a6399b5e74197303bade4f96ea74b370b07b Signed-off-by: Alberto Compagno --- libparc/parc/security/parc_SymmetricKeySigner.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libparc/parc/security/parc_SymmetricKeySigner.c') diff --git a/libparc/parc/security/parc_SymmetricKeySigner.c b/libparc/parc/security/parc_SymmetricKeySigner.c index 9f760326..5f87b945 100644 --- a/libparc/parc/security/parc_SymmetricKeySigner.c +++ b/libparc/parc/security/parc_SymmetricKeySigner.c @@ -261,11 +261,11 @@ _GetSignatureSize(PARCSymmetricKeySigner *signer) * @param hashToSign is the HMAC computed by the our PARCCryptoHasher. */ static PARCSignature * -_signDigest(PARCSymmetricKeySigner *interfaceContext, const PARCCryptoHash *hashToSign) +_signDigest(PARCSymmetricKeySigner *interfaceContext, const PARCCryptoHash *hashToSign, uint8_t * signature, uint32_t sig_len) { // The digest computed via our hash function (hmac) is the actual signature. // just need to wrap it up with the right parameters. - PARCBuffer *signatureBits = parcBuffer_Copy(parcCryptoHash_GetDigest(hashToSign)); + PARCBuffer *signatureBits = parcBuffer_Wrap(signature, sig_len, 0, sig_len);//parcBuffer_Copy(parcCryptoHash_GetDigest(hashToSign)); PARCSignature *result = parcSignature_Create(_getSigningAlgorithm(interfaceContext), parcCryptoHash_GetDigestType(hashToSign), signatureBits); parcBuffer_Release(&signatureBits); return result; @@ -274,7 +274,7 @@ _signDigest(PARCSymmetricKeySigner *interfaceContext, const PARCCryptoHash *hash PARCSigningInterface *PARCSymmetricKeySignerAsSigner = &(PARCSigningInterface) { .GetCryptoHashType = (PARCCryptoHashType (*)(void *))_getCryptoHashType, .GetCryptoHasher = (PARCCryptoHasher * (*)(void *))_getCryptoHasher, - .SignDigest = (PARCSignature * (*)(void *, const PARCCryptoHash *))_signDigest, + .SignDigest = (PARCSignature * (*)(void *, const PARCCryptoHash *, uint8_t *, uint32_t))_signDigest, .GetSigningAlgorithm = (PARCSigningAlgorithm (*)(void *))_getSigningAlgorithm, .GetKeyStore = (PARCKeyStore * (*)(void *))_getKeyStore, .GetSignatureSize = (size_t (*)(void *))_GetSignatureSize -- cgit 1.2.3-korg