diff options
| author | tb <> | 2025-07-12 19:57:13 +0000 |
|---|---|---|
| committer | tb <> | 2025-07-12 19:57:13 +0000 |
| commit | d8116bd100cd9a4c1e502db89ddc6042bdb71643 (patch) | |
| tree | fd89724e300002861ec4df175d1e18990e3ff95a /src | |
| parent | 63d44e27ad76fc5499e99ddb652e92397ea23c20 (diff) | |
| download | openbsd-d8116bd100cd9a4c1e502db89ddc6042bdb71643.tar.gz openbsd-d8116bd100cd9a4c1e502db89ddc6042bdb71643.tar.bz2 openbsd-d8116bd100cd9a4c1e502db89ddc6042bdb71643.zip | |
Merge the two functions from x_info.c into pem_info.c
X509_INFO_new() isn't used directly outside of this file, so this is a bit
tidier.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/Makefile | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/x_info.c | 97 | ||||
| -rw-r--r-- | src/lib/libcrypto/pem/pem_info.c | 36 |
3 files changed, 36 insertions, 100 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile index a33a209ef7..53a95af9bb 100644 --- a/src/lib/libcrypto/Makefile +++ b/src/lib/libcrypto/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.238 2025/06/27 17:26:57 jsing Exp $ | 1 | # $OpenBSD: Makefile,v 1.239 2025/07/12 19:57:13 tb Exp $ |
| 2 | 2 | ||
| 3 | LIB= crypto | 3 | LIB= crypto |
| 4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
| @@ -119,7 +119,6 @@ SRCS+= x_attrib.c | |||
| 119 | SRCS+= x_bignum.c | 119 | SRCS+= x_bignum.c |
| 120 | SRCS+= x_crl.c | 120 | SRCS+= x_crl.c |
| 121 | SRCS+= x_exten.c | 121 | SRCS+= x_exten.c |
| 122 | SRCS+= x_info.c | ||
| 123 | SRCS+= x_long.c | 122 | SRCS+= x_long.c |
| 124 | SRCS+= x_name.c | 123 | SRCS+= x_name.c |
| 125 | SRCS+= x_pkey.c | 124 | SRCS+= x_pkey.c |
diff --git a/src/lib/libcrypto/asn1/x_info.c b/src/lib/libcrypto/asn1/x_info.c deleted file mode 100644 index e8b2c368a6..0000000000 --- a/src/lib/libcrypto/asn1/x_info.c +++ /dev/null | |||
| @@ -1,97 +0,0 @@ | |||
| 1 | /* $OpenBSD: x_info.c,v 1.23 2025/05/10 05:54:38 tb Exp $ */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | |||
| 61 | #include <openssl/asn1.h> | ||
| 62 | #include <openssl/x509.h> | ||
| 63 | |||
| 64 | #include "err_local.h" | ||
| 65 | |||
| 66 | X509_INFO * | ||
| 67 | X509_INFO_new(void) | ||
| 68 | { | ||
| 69 | X509_INFO *ret; | ||
| 70 | |||
| 71 | if ((ret = calloc(1, sizeof(X509_INFO))) == NULL) { | ||
| 72 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 73 | return NULL; | ||
| 74 | } | ||
| 75 | ret->references = 1; | ||
| 76 | |||
| 77 | return ret; | ||
| 78 | } | ||
| 79 | LCRYPTO_ALIAS(X509_INFO_new); | ||
| 80 | |||
| 81 | void | ||
| 82 | X509_INFO_free(X509_INFO *x) | ||
| 83 | { | ||
| 84 | if (x == NULL) | ||
| 85 | return; | ||
| 86 | |||
| 87 | if (CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_INFO) > 0) | ||
| 88 | return; | ||
| 89 | |||
| 90 | X509_free(x->x509); | ||
| 91 | X509_CRL_free(x->crl); | ||
| 92 | X509_PKEY_free(x->x_pkey); | ||
| 93 | free(x->enc_data); | ||
| 94 | |||
| 95 | free(x); | ||
| 96 | } | ||
| 97 | LCRYPTO_ALIAS(X509_INFO_free); | ||
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) |
