diff options
Diffstat (limited to 'src/lib/libcrypto/pem/pem_info.c')
-rw-r--r-- | src/lib/libcrypto/pem/pem_info.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c index 5848703c4e..e1a264f4c5 100644 --- a/src/lib/libcrypto/pem/pem_info.c +++ b/src/lib/libcrypto/pem/pem_info.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pem_info.c,v 1.30 2025/07/12 19:54:58 tb Exp $ */ | 1 | /* $OpenBSD: pem_info.c,v 1.31 2025/07/12 19:57:13 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -64,6 +64,7 @@ | |||
64 | 64 | ||
65 | #include <openssl/asn1.h> | 65 | #include <openssl/asn1.h> |
66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
67 | #include <openssl/crypto.h> | ||
67 | #include <openssl/dsa.h> | 68 | #include <openssl/dsa.h> |
68 | #include <openssl/ec.h> | 69 | #include <openssl/ec.h> |
69 | #include <openssl/err.h> | 70 | #include <openssl/err.h> |
@@ -76,6 +77,39 @@ | |||
76 | #include "err_local.h" | 77 | #include "err_local.h" |
77 | #include "evp_local.h" | 78 | #include "evp_local.h" |
78 | 79 | ||
80 | X509_INFO * | ||
81 | X509_INFO_new(void) | ||
82 | { | ||
83 | X509_INFO *ret; | ||
84 | |||
85 | if ((ret = calloc(1, sizeof(X509_INFO))) == NULL) { | ||
86 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
87 | return NULL; | ||
88 | } | ||
89 | ret->references = 1; | ||
90 | |||
91 | return ret; | ||
92 | } | ||
93 | LCRYPTO_ALIAS(X509_INFO_new); | ||
94 | |||
95 | void | ||
96 | X509_INFO_free(X509_INFO *x) | ||
97 | { | ||
98 | if (x == NULL) | ||
99 | return; | ||
100 | |||
101 | if (CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_INFO) > 0) | ||
102 | return; | ||
103 | |||
104 | X509_free(x->x509); | ||
105 | X509_CRL_free(x->crl); | ||
106 | X509_PKEY_free(x->x_pkey); | ||
107 | free(x->enc_data); | ||
108 | |||
109 | free(x); | ||
110 | } | ||
111 | LCRYPTO_ALIAS(X509_INFO_free); | ||
112 | |||
79 | STACK_OF(X509_INFO) * | 113 | STACK_OF(X509_INFO) * |
80 | PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, | 114 | PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, |
81 | void *u) | 115 | void *u) |