diff options
| author | jsing <> | 2024-03-28 00:57:26 +0000 |
|---|---|---|
| committer | jsing <> | 2024-03-28 00:57:26 +0000 |
| commit | 8d3553605aee1f90e26f3697bd4c5f38bfcad02d (patch) | |
| tree | d7d9734ebe23dce6651c832547a9d10abf660a4f /src | |
| parent | 2a02cd5e6f24d9c0c7c6d6618772713d666e2d7c (diff) | |
| download | openbsd-8d3553605aee1f90e26f3697bd4c5f38bfcad02d.tar.gz openbsd-8d3553605aee1f90e26f3697bd4c5f38bfcad02d.tar.bz2 openbsd-8d3553605aee1f90e26f3697bd4c5f38bfcad02d.zip | |
Consolidate most of the AES modes into a single C file.
Discussed with tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/Makefile | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/aes/aes.c (renamed from src/lib/libcrypto/aes/aes_wrap.c) | 79 | ||||
| -rw-r--r-- | src/lib/libcrypto/aes/aes_cfb.c | 84 | ||||
| -rw-r--r-- | src/lib/libcrypto/aes/aes_ctr.c | 62 | ||||
| -rw-r--r-- | src/lib/libcrypto/aes/aes_ecb.c | 69 | ||||
| -rw-r--r-- | src/lib/libcrypto/aes/aes_ofb.c | 61 |
6 files changed, 70 insertions, 293 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile index 86d8cbcad6..63600aa923 100644 --- a/src/lib/libcrypto/Makefile +++ b/src/lib/libcrypto/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.179 2024/03/27 12:56:25 jsing Exp $ | 1 | # $OpenBSD: Makefile,v 1.180 2024/03/28 00:57:26 jsing Exp $ |
| 2 | 2 | ||
| 3 | LIB= crypto | 3 | LIB= crypto |
| 4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
| @@ -72,12 +72,8 @@ SRCS+= o_fips.c | |||
| 72 | SRCS+= o_str.c | 72 | SRCS+= o_str.c |
| 73 | 73 | ||
| 74 | # aes/ | 74 | # aes/ |
| 75 | SRCS+= aes_cfb.c | 75 | SRCS+= aes.c |
| 76 | SRCS+= aes_ctr.c | ||
| 77 | SRCS+= aes_ecb.c | ||
| 78 | SRCS+= aes_ige.c | 76 | SRCS+= aes_ige.c |
| 79 | SRCS+= aes_ofb.c | ||
| 80 | SRCS+= aes_wrap.c | ||
| 81 | 77 | ||
| 82 | # asn1/ | 78 | # asn1/ |
| 83 | SRCS+= a_bitstr.c | 79 | SRCS+= a_bitstr.c |
diff --git a/src/lib/libcrypto/aes/aes_wrap.c b/src/lib/libcrypto/aes/aes.c index b30630fe47..d3bf85947d 100644 --- a/src/lib/libcrypto/aes/aes_wrap.c +++ b/src/lib/libcrypto/aes/aes.c | |||
| @@ -1,9 +1,6 @@ | |||
| 1 | /* $OpenBSD: aes_wrap.c,v 1.12 2018/11/07 18:31:16 tb Exp $ */ | 1 | /* $OpenBSD: aes.c,v 1.1 2024/03/28 00:57:26 jsing Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | 2 | /* ==================================================================== |
| 6 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. |
| 7 | * | 4 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -20,12 +17,12 @@ | |||
| 20 | * 3. All advertising materials mentioning features or use of this | 17 | * 3. All advertising materials mentioning features or use of this |
| 21 | * software must display the following acknowledgment: | 18 | * software must display the following acknowledgment: |
| 22 | * "This product includes software developed by the OpenSSL Project | 19 | * "This product includes software developed by the OpenSSL Project |
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" |
| 24 | * | 21 | * |
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to |
| 26 | * endorse or promote products derived from this software without | 23 | * endorse or promote products derived from this software without |
| 27 | * prior written permission. For written permission, please contact | 24 | * prior written permission. For written permission, please contact |
| 28 | * licensing@OpenSSL.org. | 25 | * openssl-core@openssl.org. |
| 29 | * | 26 | * |
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | 27 | * 5. Products derived from this software may not be called "OpenSSL" |
| 31 | * nor may "OpenSSL" appear in their names without prior written | 28 | * nor may "OpenSSL" appear in their names without prior written |
| @@ -34,7 +31,7 @@ | |||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | 31 | * 6. Redistributions of any form whatsoever must retain the following |
| 35 | * acknowledgment: | 32 | * acknowledgment: |
| 36 | * "This product includes software developed by the OpenSSL Project | 33 | * "This product includes software developed by the OpenSSL Project |
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" |
| 38 | * | 35 | * |
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY |
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| @@ -49,17 +46,77 @@ | |||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | * ==================================================================== | 48 | * ==================================================================== |
| 49 | * | ||
| 52 | */ | 50 | */ |
| 53 | 51 | ||
| 54 | #include <string.h> | 52 | #include <string.h> |
| 55 | 53 | ||
| 56 | #include <openssl/aes.h> | 54 | #include <openssl/aes.h> |
| 57 | #include <openssl/bio.h> | 55 | #include <openssl/bio.h> |
| 56 | #include <openssl/modes.h> | ||
| 58 | 57 | ||
| 59 | static const unsigned char default_iv[] = { | 58 | static const unsigned char aes_wrap_default_iv[] = { |
| 60 | 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, | 59 | 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, |
| 61 | }; | 60 | }; |
| 62 | 61 | ||
| 62 | /* | ||
| 63 | * The input and output encrypted as though 128bit cfb mode is being | ||
| 64 | * used. The extra state information to record how much of the | ||
| 65 | * 128bit block we have used is contained in *num; | ||
| 66 | */ | ||
| 67 | |||
| 68 | void | ||
| 69 | AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 70 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) | ||
| 71 | { | ||
| 72 | CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc, | ||
| 73 | (block128_f)AES_encrypt); | ||
| 74 | } | ||
| 75 | |||
| 76 | /* N.B. This expects the input to be packed, MS bit first */ | ||
| 77 | void | ||
| 78 | AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 79 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) | ||
| 80 | { | ||
| 81 | CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc, | ||
| 82 | (block128_f)AES_encrypt); | ||
| 83 | } | ||
| 84 | |||
| 85 | void | ||
| 86 | AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 87 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) | ||
| 88 | { | ||
| 89 | CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc, | ||
| 90 | (block128_f)AES_encrypt); | ||
| 91 | } | ||
| 92 | |||
| 93 | void | ||
| 94 | AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, | ||
| 95 | size_t length, const AES_KEY *key, unsigned char ivec[AES_BLOCK_SIZE], | ||
| 96 | unsigned char ecount_buf[AES_BLOCK_SIZE], unsigned int *num) | ||
| 97 | { | ||
| 98 | CRYPTO_ctr128_encrypt(in, out, length, key, ivec, ecount_buf, num, | ||
| 99 | (block128_f)AES_encrypt); | ||
| 100 | } | ||
| 101 | |||
| 102 | void | ||
| 103 | AES_ecb_encrypt(const unsigned char *in, unsigned char *out, | ||
| 104 | const AES_KEY *key, const int enc) | ||
| 105 | { | ||
| 106 | if (AES_ENCRYPT == enc) | ||
| 107 | AES_encrypt(in, out, key); | ||
| 108 | else | ||
| 109 | AES_decrypt(in, out, key); | ||
| 110 | } | ||
| 111 | |||
| 112 | void | ||
| 113 | AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 114 | const AES_KEY *key, unsigned char *ivec, int *num) | ||
| 115 | { | ||
| 116 | CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num, | ||
| 117 | (block128_f)AES_encrypt); | ||
| 118 | } | ||
| 119 | |||
| 63 | int | 120 | int |
| 64 | AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, | 121 | AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, |
| 65 | const unsigned char *in, unsigned int inlen) | 122 | const unsigned char *in, unsigned int inlen) |
| @@ -73,7 +130,7 @@ AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, | |||
| 73 | t = 1; | 130 | t = 1; |
| 74 | memmove(out + 8, in, inlen); | 131 | memmove(out + 8, in, inlen); |
| 75 | if (!iv) | 132 | if (!iv) |
| 76 | iv = default_iv; | 133 | iv = aes_wrap_default_iv; |
| 77 | 134 | ||
| 78 | memcpy(A, iv, 8); | 135 | memcpy(A, iv, 8); |
| 79 | 136 | ||
| @@ -124,7 +181,7 @@ AES_unwrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, | |||
| 124 | } | 181 | } |
| 125 | } | 182 | } |
| 126 | if (!iv) | 183 | if (!iv) |
| 127 | iv = default_iv; | 184 | iv = aes_wrap_default_iv; |
| 128 | if (memcmp(A, iv, 8)) { | 185 | if (memcmp(A, iv, 8)) { |
| 129 | explicit_bzero(out, inlen); | 186 | explicit_bzero(out, inlen); |
| 130 | return 0; | 187 | return 0; |
diff --git a/src/lib/libcrypto/aes/aes_cfb.c b/src/lib/libcrypto/aes/aes_cfb.c deleted file mode 100644 index a6384f944d..0000000000 --- a/src/lib/libcrypto/aes/aes_cfb.c +++ /dev/null | |||
| @@ -1,84 +0,0 @@ | |||
| 1 | /* $OpenBSD: aes_cfb.c,v 1.8 2014/06/12 15:49:27 deraadt Exp $ */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | */ | ||
| 51 | |||
| 52 | #include <openssl/aes.h> | ||
| 53 | #include <openssl/modes.h> | ||
| 54 | |||
| 55 | /* The input and output encrypted as though 128bit cfb mode is being | ||
| 56 | * used. The extra state information to record how much of the | ||
| 57 | * 128bit block we have used is contained in *num; | ||
| 58 | */ | ||
| 59 | |||
| 60 | void | ||
| 61 | AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 62 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) | ||
| 63 | { | ||
| 64 | CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc, | ||
| 65 | (block128_f)AES_encrypt); | ||
| 66 | } | ||
| 67 | |||
| 68 | /* N.B. This expects the input to be packed, MS bit first */ | ||
| 69 | void | ||
| 70 | AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 71 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) | ||
| 72 | { | ||
| 73 | CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc, | ||
| 74 | (block128_f)AES_encrypt); | ||
| 75 | } | ||
| 76 | |||
| 77 | void | ||
| 78 | AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 79 | const AES_KEY *key, unsigned char *ivec, int *num, const int enc) | ||
| 80 | { | ||
| 81 | CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc, | ||
| 82 | (block128_f)AES_encrypt); | ||
| 83 | } | ||
| 84 | |||
diff --git a/src/lib/libcrypto/aes/aes_ctr.c b/src/lib/libcrypto/aes/aes_ctr.c deleted file mode 100644 index 607914599b..0000000000 --- a/src/lib/libcrypto/aes/aes_ctr.c +++ /dev/null | |||
| @@ -1,62 +0,0 @@ | |||
| 1 | /* $OpenBSD: aes_ctr.c,v 1.9 2014/06/12 15:49:27 deraadt Exp $ */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | */ | ||
| 51 | |||
| 52 | #include <openssl/aes.h> | ||
| 53 | #include <openssl/modes.h> | ||
| 54 | |||
| 55 | void | ||
| 56 | AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, | ||
| 57 | size_t length, const AES_KEY *key, unsigned char ivec[AES_BLOCK_SIZE], | ||
| 58 | unsigned char ecount_buf[AES_BLOCK_SIZE], unsigned int *num) | ||
| 59 | { | ||
| 60 | CRYPTO_ctr128_encrypt(in, out, length, key, ivec, ecount_buf, num, | ||
| 61 | (block128_f)AES_encrypt); | ||
| 62 | } | ||
diff --git a/src/lib/libcrypto/aes/aes_ecb.c b/src/lib/libcrypto/aes/aes_ecb.c deleted file mode 100644 index e3bb40b5aa..0000000000 --- a/src/lib/libcrypto/aes/aes_ecb.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* $OpenBSD: aes_ecb.c,v 1.7 2022/11/26 16:08:50 tb Exp $ */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | */ | ||
| 51 | |||
| 52 | #ifndef AES_DEBUG | ||
| 53 | # ifndef NDEBUG | ||
| 54 | # define NDEBUG | ||
| 55 | # endif | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #include <openssl/aes.h> | ||
| 59 | #include "aes_local.h" | ||
| 60 | |||
| 61 | void | ||
| 62 | AES_ecb_encrypt(const unsigned char *in, unsigned char *out, | ||
| 63 | const AES_KEY *key, const int enc) | ||
| 64 | { | ||
| 65 | if (AES_ENCRYPT == enc) | ||
| 66 | AES_encrypt(in, out, key); | ||
| 67 | else | ||
| 68 | AES_decrypt(in, out, key); | ||
| 69 | } | ||
diff --git a/src/lib/libcrypto/aes/aes_ofb.c b/src/lib/libcrypto/aes/aes_ofb.c deleted file mode 100644 index f8dc03a26e..0000000000 --- a/src/lib/libcrypto/aes/aes_ofb.c +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | /* $OpenBSD: aes_ofb.c,v 1.6 2014/06/12 15:49:27 deraadt Exp $ */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | */ | ||
| 51 | |||
| 52 | #include <openssl/aes.h> | ||
| 53 | #include <openssl/modes.h> | ||
| 54 | |||
| 55 | void | ||
| 56 | AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, | ||
| 57 | const AES_KEY *key, unsigned char *ivec, int *num) | ||
| 58 | { | ||
| 59 | CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num, | ||
| 60 | (block128_f)AES_encrypt); | ||
| 61 | } | ||
