summaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorDirk-Willem van Gulik <dirkx@webweaving.org>2020-01-10 18:35:49 +0100
committerTomas Mraz <tmraz@fedoraproject.org>2020-04-21 17:12:32 +0200
commit4738d9e060eccdb01d443c3cefe8101cbf1d4bfa (patch)
tree271a6116a60282d7ad6acd506e2b8848d9bf4e1e /crypto/asn1
parent49d391d03c11352eeadec7df39c48d1c83fb164e (diff)
Add setter equivalents to X509_REQ_get0_signature
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/10563) (cherry picked from commit c72e59349f50ee00a1bf8605ada17dfccb8b3b1a)
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/x_algor.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/crypto/asn1/x_algor.c b/crypto/asn1/x_algor.c
index 4c4a718850..e13daf849b 100644
--- a/crypto/asn1/x_algor.c
+++ b/crypto/asn1/x_algor.c
@@ -92,3 +92,31 @@ int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b)
return 0;
return ASN1_TYPE_cmp(a->parameter, b->parameter);
}
+
+int X509_ALGOR_copy(X509_ALGOR *dest, const X509_ALGOR *src)
+{
+ if (src == NULL || dest == NULL)
+ return 0;
+
+ if (dest->algorithm)
+ ASN1_OBJECT_free(dest->algorithm);
+ dest->algorithm = NULL;
+
+ if (dest->parameter)
+ ASN1_TYPE_free(dest->parameter);
+ dest->parameter = NULL;
+
+ if (src->algorithm)
+ if ((dest->algorithm = OBJ_dup(src->algorithm)) == NULL)
+ return 0;
+
+ if (src->parameter)
+ /* Assuming this is also correct for a BOOL.
+ * set does copy as a side effect.
+ */
+ if (ASN1_TYPE_set1(dest->parameter,
+ src->parameter->type, src->parameter->value.ptr) == 0)
+ return 0;
+
+ return 1;
+}