diff options
| author | tb <> | 2023-12-20 13:46:05 +0000 |
|---|---|---|
| committer | tb <> | 2023-12-20 13:46:05 +0000 |
| commit | 3f0e0e719ac3b710e4d7852ecb71a1f66da1c4a9 (patch) | |
| tree | 66a9efed725304e53c9ba71e923b786f06d2f976 /src | |
| parent | 9d47c0a9529e3e210a5e8a1c823a4f720fd027e7 (diff) | |
| download | openbsd-3f0e0e719ac3b710e4d7852ecb71a1f66da1c4a9.tar.gz openbsd-3f0e0e719ac3b710e4d7852ecb71a1f66da1c4a9.tar.bz2 openbsd-3f0e0e719ac3b710e4d7852ecb71a1f66da1c4a9.zip | |
Fold p_dec.c and p_enc.c into a new p_legacy.c
discussed with jsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/Makefile | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/p_enc.c | 77 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/p_legacy.c (renamed from src/lib/libcrypto/evp/p_dec.c) | 15 |
3 files changed, 16 insertions, 81 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile index d97358900d..d584019e14 100644 --- a/src/lib/libcrypto/Makefile +++ b/src/lib/libcrypto/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.157 2023/12/20 06:28:04 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.158 2023/12/20 13:46:05 tb Exp $ |
| 2 | 2 | ||
| 3 | LIB= crypto | 3 | LIB= crypto |
| 4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
| @@ -392,8 +392,7 @@ SRCS+= m_wp.c | |||
| 392 | SRCS+= names.c | 392 | SRCS+= names.c |
| 393 | SRCS+= p5_crpt.c | 393 | SRCS+= p5_crpt.c |
| 394 | SRCS+= p5_crpt2.c | 394 | SRCS+= p5_crpt2.c |
| 395 | SRCS+= p_dec.c | 395 | SRCS+= p_legacy.c |
| 396 | SRCS+= p_enc.c | ||
| 397 | SRCS+= p_lib.c | 396 | SRCS+= p_lib.c |
| 398 | SRCS+= p_open.c | 397 | SRCS+= p_open.c |
| 399 | SRCS+= p_seal.c | 398 | SRCS+= p_seal.c |
diff --git a/src/lib/libcrypto/evp/p_enc.c b/src/lib/libcrypto/evp/p_enc.c deleted file mode 100644 index 549ac897af..0000000000 --- a/src/lib/libcrypto/evp/p_enc.c +++ /dev/null | |||
| @@ -1,77 +0,0 @@ | |||
| 1 | /* $OpenBSD: p_enc.c,v 1.17 2023/12/20 13:34:47 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 <openssl/err.h> | ||
| 60 | #include <openssl/evp.h> | ||
| 61 | |||
| 62 | #include <openssl/rsa.h> | ||
| 63 | |||
| 64 | #include "evp_local.h" | ||
| 65 | |||
| 66 | int | ||
| 67 | EVP_PKEY_encrypt_old(unsigned char *to, const unsigned char *from, int from_len, | ||
| 68 | EVP_PKEY *pkey) | ||
| 69 | { | ||
| 70 | if (pkey->type != EVP_PKEY_RSA) { | ||
| 71 | EVPerror(EVP_R_PUBLIC_KEY_NOT_RSA); | ||
| 72 | return 0; | ||
| 73 | } | ||
| 74 | |||
| 75 | return RSA_public_encrypt(from_len, from, to, pkey->pkey.rsa, | ||
| 76 | RSA_PKCS1_PADDING); | ||
| 77 | } | ||
diff --git a/src/lib/libcrypto/evp/p_dec.c b/src/lib/libcrypto/evp/p_legacy.c index 78a5ab4823..a88393a849 100644 --- a/src/lib/libcrypto/evp/p_dec.c +++ b/src/lib/libcrypto/evp/p_legacy.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p_dec.c,v 1.17 2023/12/20 13:34:47 tb Exp $ */ | 1 | /* $OpenBSD: p_legacy.c,v 1.1 2023/12/20 13:46:05 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 | * |
| @@ -75,3 +75,16 @@ EVP_PKEY_decrypt_old(unsigned char *to, const unsigned char *from, int from_len, | |||
| 75 | return RSA_private_decrypt(from_len, from, to, pkey->pkey.rsa, | 75 | return RSA_private_decrypt(from_len, from, to, pkey->pkey.rsa, |
| 76 | RSA_PKCS1_PADDING); | 76 | RSA_PKCS1_PADDING); |
| 77 | } | 77 | } |
| 78 | |||
| 79 | int | ||
| 80 | EVP_PKEY_encrypt_old(unsigned char *to, const unsigned char *from, int from_len, | ||
| 81 | EVP_PKEY *pkey) | ||
| 82 | { | ||
| 83 | if (pkey->type != EVP_PKEY_RSA) { | ||
| 84 | EVPerror(EVP_R_PUBLIC_KEY_NOT_RSA); | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | return RSA_public_encrypt(from_len, from, to, pkey->pkey.rsa, | ||
| 89 | RSA_PKCS1_PADDING); | ||
| 90 | } | ||
