Latest update.
This commit is contained in:
+23
-8
@@ -68,14 +68,21 @@ STACK_OF(X509) *OSSL_CMP_CTX_get0_untrusted_certs(const OSSL_CMP_CTX *ctx)
|
||||
*/
|
||||
int OSSL_CMP_CTX_set1_untrusted_certs(OSSL_CMP_CTX *ctx, STACK_OF(X509) *certs)
|
||||
{
|
||||
STACK_OF(X509) *untrusted_certs;
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
sk_X509_pop_free(ctx->untrusted_certs, X509_free);
|
||||
if ((ctx->untrusted_certs = sk_X509_new_null()) == NULL)
|
||||
if ((untrusted_certs = sk_X509_new_null()) == NULL)
|
||||
return 0;
|
||||
return ossl_cmp_sk_X509_add1_certs(ctx->untrusted_certs, certs, 0, 1, 0);
|
||||
if (ossl_cmp_sk_X509_add1_certs(untrusted_certs, certs, 0, 1, 0) != 1)
|
||||
goto err;
|
||||
sk_X509_pop_free(ctx->untrusted_certs, X509_free);
|
||||
ctx->untrusted_certs = untrusted_certs;
|
||||
return 1;
|
||||
err:
|
||||
sk_X509_pop_free(untrusted_certs, X509_free);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -195,7 +202,7 @@ void OSSL_CMP_CTX_free(OSSL_CMP_CTX *ctx)
|
||||
int ossl_cmp_ctx_set_status(OSSL_CMP_CTX *ctx, int status)
|
||||
{
|
||||
if (!ossl_assert(ctx != NULL))
|
||||
return 0;
|
||||
return 0;
|
||||
ctx->status = status;
|
||||
return 1;
|
||||
}
|
||||
@@ -373,13 +380,19 @@ int OSSL_CMP_CTX_set1_referenceValue(OSSL_CMP_CTX *ctx,
|
||||
int OSSL_CMP_CTX_set1_secretValue(OSSL_CMP_CTX *ctx, const unsigned char *sec,
|
||||
const int len)
|
||||
{
|
||||
ASN1_OCTET_STRING *secretValue = NULL;
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if (ctx->secretValue != NULL)
|
||||
if (ossl_cmp_asn1_octet_string_set1_bytes(&secretValue, sec, len) != 1)
|
||||
return 0;
|
||||
if (ctx->secretValue != NULL) {
|
||||
OPENSSL_cleanse(ctx->secretValue->data, ctx->secretValue->length);
|
||||
return ossl_cmp_asn1_octet_string_set1_bytes(&ctx->secretValue, sec, len);
|
||||
ASN1_OCTET_STRING_free(ctx->secretValue);
|
||||
}
|
||||
ctx->secretValue = secretValue;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -933,7 +946,8 @@ int OSSL_CMP_CTX_get_failInfoCode(const OSSL_CMP_CTX *ctx)
|
||||
* Sets a Boolean or integer option of the context to the "val" arg.
|
||||
* Returns 1 on success, 0 on error
|
||||
*/
|
||||
int OSSL_CMP_CTX_set_option(OSSL_CMP_CTX *ctx, int opt, int val) {
|
||||
int OSSL_CMP_CTX_set_option(OSSL_CMP_CTX *ctx, int opt, int val)
|
||||
{
|
||||
int min_val;
|
||||
|
||||
if (ctx == NULL) {
|
||||
@@ -1036,7 +1050,8 @@ int OSSL_CMP_CTX_set_option(OSSL_CMP_CTX *ctx, int opt, int val) {
|
||||
* Reads a Boolean or integer option value from the context.
|
||||
* Returns -1 on error (which is the default OSSL_CMP_OPT_REVOCATION_REASON)
|
||||
*/
|
||||
int OSSL_CMP_CTX_get_option(const OSSL_CMP_CTX *ctx, int opt) {
|
||||
int OSSL_CMP_CTX_get_option(const OSSL_CMP_CTX *ctx, int opt)
|
||||
{
|
||||
if (ctx == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user