Home | Documentation |
smdevp.c File Reference
updated Mon May 13 2024 by Robert van Engelen
|
#include "smdevp.h"
Functions | |
static int | soap_smd_send (struct soap *soap, const char *buf, size_t len) |
Callback to intercept messages for digest or signature computation/verification. More... | |
static size_t | soap_smd_recv (struct soap *soap, char *buf, size_t len) |
Callback to intercept messages for digest or signature computation/verification. More... | |
static int | soap_smd_check (struct soap *soap, struct soap_smd_data *data, int err, const char *msg) |
Check result of init/update/final smdevp engine operations. More... | |
SOAP_FMAC1 size_t SOAP_FMAC2 | soap_smd_size (int alg, const void *key) |
Returns the number of octets needed to store the digest or signature returned by soap_smd_end. More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_begin (struct soap *soap, int alg, const void *key, int keylen) |
Initiates a digest or signature computation. More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_end (struct soap *soap, char *buf, int *len) |
Completes a digest or signature computation. Also deallocates temporary storage allocated by soap_smd_begin(), so MUST be called after soap_smd_begin(). More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_init (struct soap *soap, struct soap_smd_data *data, int alg, const void *key, int keylen) |
Initiates a (signed) digest computation. More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_update (struct soap *soap, struct soap_smd_data *data, const char *buf, size_t len) |
Updates (signed) digest computation with message part. More... | |
SOAP_FMAC1 int SOAP_FMAC2 | soap_smd_final (struct soap *soap, struct soap_smd_data *data, char *buf, int *len) |
Finalizes (signed) digest computation, delete context and returns digest or signature. More... | |
SOAP_FMAC1 void SOAP_FMAC2 | soap_smd_cleanup (struct soap *soap, struct soap_smd_data *data) |
Clear (signed) digest computation and delete context. More... | |
SOAP_FMAC1 int SOAP_FMAC2 soap_smd_begin | ( | struct soap * | soap, |
int | alg, | ||
const void * | key, | ||
int | keylen | ||
) |
Initiates a digest or signature computation.
soap | context | |
[in] | alg | is the digest or signature (sign/verification) algorithm used |
[in] | key | is a HMAC key or pointer to EVP_PKEY object or NULL for digests |
[in] | keylen | is the length of the HMAC key or 0 |
|
static |
Check result of init/update/final smdevp engine operations.
soap | context | |
[in,out] | data | smdevp engine context |
[in] | ok | EVP error value |
[in] | msg | error message |
SOAP_FMAC1 void SOAP_FMAC2 soap_smd_cleanup | ( | struct soap * | soap, |
struct soap_smd_data * | data | ||
) |
Clear (signed) digest computation and delete context.
soap | context | |
[in,out] | data | smdevp engine context |
SOAP_FMAC1 int SOAP_FMAC2 soap_smd_end | ( | struct soap * | soap, |
char * | buf, | ||
int * | len | ||
) |
Completes a digest or signature computation. Also deallocates temporary storage allocated by soap_smd_begin(), so MUST be called after soap_smd_begin().
soap | context | |
[in] | buf | contains signature for verification (when using a SOAP_SMD_VRFY algorithm) or NULL for cleanup |
[out] | buf | is populated with the digest or signature with maximum length soap_smd_size(alg, key) |
[in] | len | points to length of signature to verify (when using a SOAP_SMD_VRFY algorithm) or NULL for cleanup |
[out] | len | points to length of stored digest or signature (when not NULL) |
SOAP_FMAC1 int SOAP_FMAC2 soap_smd_final | ( | struct soap * | soap, |
struct soap_smd_data * | data, | ||
char * | buf, | ||
int * | len | ||
) |
Finalizes (signed) digest computation, delete context and returns digest or signature.
soap | context | |
[in,out] | data | smdevp engine context |
[in] | buf | contains signature for verification (SOAP_SMD_VRFY algorithms) maximum length soap_smd_size(alg, key) |
[out] | buf | is populated with the digest or signature of |
[in] | len | points to length of signature to verify (SOAP_SMD_VRFY algorithms) |
[out] | len | points to length of stored digest or signature (pass NULL if you are not interested in this value) |
SOAP_FMAC1 int SOAP_FMAC2 soap_smd_init | ( | struct soap * | soap, |
struct soap_smd_data * | data, | ||
int | alg, | ||
const void * | key, | ||
int | keylen | ||
) |
Initiates a (signed) digest computation.
soap | context | |
[in,out] | data | smdevp engine context |
[in] | alg | is algorithm to use |
[in] | key | is key to use or NULL for digests |
[in] | keylen | is length of HMAC key (when provided) |
|
static |
Callback to intercept messages for digest or signature computation/verification.
soap | context | |
[in] | buf | buffer |
[in] | len | max buffer length |
|
static |
Callback to intercept messages for digest or signature computation/verification.
soap | context | |
[in] | buf | message |
[in] | len | message length |
SOAP_FMAC1 size_t SOAP_FMAC2 soap_smd_size | ( | int | alg, |
const void * | key | ||
) |
Returns the number of octets needed to store the digest or signature returned by soap_smd_end.
[in] | alg | is the digest or signature algorithm to be used |
[in] | key | is a pointer to an EVP_PKEY object for RSA/DSA signatures or NULL for digests and HMAC |
The values returned for digests are SOAP_SMD_MD5_SIZE, SOAP_SMD_SHA1_SIZE, SOAP_SMD_SHA256_SIZE, SOAP_SMD_SHA512_SIZE.
SOAP_FMAC1 int SOAP_FMAC2 soap_smd_update | ( | struct soap * | soap, |
struct soap_smd_data * | data, | ||
const char * | buf, | ||
size_t | len | ||
) |
Updates (signed) digest computation with message part.
soap | context | |
[in,out] | data | smdevp engine context |
[in] | buf | contains message part |
[in] | len | of message part |