add hx509_peer_info_add_cms_algs

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25165 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2009-05-04 06:16:17 +00:00
parent db78789397
commit ee02b6c453

View File

@@ -119,6 +119,39 @@ hx509_peer_info_set_cert(hx509_peer_info peer,
return 0;
}
/**
* Add an additional algorithm that the peer supports.
*
* @param context A hx509 context.
* @param peer the peer to set the new algorithms for
* @param val an AlgorithmsIdentier to add
*
* @return An hx509 error code, see hx509_get_error_string().
*
* @ingroup hx509_peer
*/
int
hx509_peer_info_add_cms_algs(hx509_context context,
hx509_peer_info peer,
const AlgorithmIdentifier *val)
{
void *ptr;
int ret;
ptr = realloc(peer->val, sizeof(peer->val[0]) * (peer->len + 1));
if (ptr == NULL) {
hx509_set_error_string(context, 0, ENOMEM, "out of memory");
return ENOMEM;
}
ret = copy_AlgorithmIdentifier(val, &peer->val[peer->len]);
if (ret == 0)
peer->len += 1;
else
hx509_set_error_string(context, 0, ret, "out of memory");
return ret;
}
/**
* Set the algorithms that the peer supports.
*