catch up with openssl's abi change. do_cipher length changed from u_int to size_t.diff -r1.2 -r1.3 src/crypto/external/bsd/openssh/dist/cipher-3des1.c
(christos)
--- src/crypto/external/bsd/openssh/dist/Attic/cipher-3des1.c 2009/06/07 22:38:46 1.2
+++ src/crypto/external/bsd/openssh/dist/Attic/cipher-3des1.c 2009/07/20 15:33:44 1.3
@@ -1,41 +1,41 @@ | @@ -1,41 +1,41 @@ | |||
1 | /* $NetBSD: cipher-3des1.c,v 1.2 2009/06/07 22:38:46 christos Exp $ */ | 1 | /* $NetBSD: cipher-3des1.c,v 1.3 2009/07/20 15:33:44 christos Exp $ */ | |
2 | /* $OpenBSD: cipher-3des1.c,v 1.6 2006/08/03 03:34:42 deraadt Exp $ */ | 2 | /* $OpenBSD: cipher-3des1.c,v 1.6 2006/08/03 03:34:42 deraadt Exp $ */ | |
3 | /* | 3 | /* | |
4 | * Copyright (c) 2003 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2003 Markus Friedl. All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | */ | 25 | */ | |
26 | 26 | |||
27 | #include "includes.h" | 27 | #include "includes.h" | |
28 | __RCSID("$NetBSD: cipher-3des1.c,v 1.2 2009/06/07 22:38:46 christos Exp $"); | 28 | __RCSID("$NetBSD: cipher-3des1.c,v 1.3 2009/07/20 15:33:44 christos Exp $"); | |
29 | #include <sys/types.h> | 29 | #include <sys/types.h> | |
30 | 30 | |||
31 | #include <openssl/evp.h> | 31 | #include <openssl/evp.h> | |
32 | 32 | |||
33 | #include <string.h> | 33 | #include <string.h> | |
34 | 34 | |||
35 | #include "xmalloc.h" | 35 | #include "xmalloc.h" | |
36 | #include "log.h" | 36 | #include "log.h" | |
37 | 37 | |||
38 | /* | 38 | /* | |
39 | * This is used by SSH1: | 39 | * This is used by SSH1: | |
40 | * | 40 | * | |
41 | * What kind of triple DES are these 2 routines? | 41 | * What kind of triple DES are these 2 routines? | |
@@ -85,27 +85,27 @@ ssh1_3des_init(EVP_CIPHER_CTX *ctx, cons | @@ -85,27 +85,27 @@ ssh1_3des_init(EVP_CIPHER_CTX *ctx, cons | |||
85 | EVP_CIPHER_CTX_init(&c->k3); | 85 | EVP_CIPHER_CTX_init(&c->k3); | |
86 | if (EVP_CipherInit(&c->k1, EVP_des_cbc(), k1, NULL, enc) == 0 || | 86 | if (EVP_CipherInit(&c->k1, EVP_des_cbc(), k1, NULL, enc) == 0 || | |
87 | EVP_CipherInit(&c->k2, EVP_des_cbc(), k2, NULL, !enc) == 0 || | 87 | EVP_CipherInit(&c->k2, EVP_des_cbc(), k2, NULL, !enc) == 0 || | |
88 | EVP_CipherInit(&c->k3, EVP_des_cbc(), k3, NULL, enc) == 0) { | 88 | EVP_CipherInit(&c->k3, EVP_des_cbc(), k3, NULL, enc) == 0) { | |
89 | memset(c, 0, sizeof(*c)); | 89 | memset(c, 0, sizeof(*c)); | |
90 | xfree(c); | 90 | xfree(c); | |
91 | EVP_CIPHER_CTX_set_app_data(ctx, NULL); | 91 | EVP_CIPHER_CTX_set_app_data(ctx, NULL); | |
92 | return (0); | 92 | return (0); | |
93 | } | 93 | } | |
94 | return (1); | 94 | return (1); | |
95 | } | 95 | } | |
96 | 96 | |||
97 | static int | 97 | static int | |
98 | ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, u_int len) | 98 | ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, size_t len) | |
99 | { | 99 | { | |
100 | struct ssh1_3des_ctx *c; | 100 | struct ssh1_3des_ctx *c; | |
101 | 101 | |||
102 | if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) { | 102 | if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) { | |
103 | error("ssh1_3des_cbc: no context"); | 103 | error("ssh1_3des_cbc: no context"); | |
104 | return (0); | 104 | return (0); | |
105 | } | 105 | } | |
106 | if (EVP_Cipher(&c->k1, dest, (u_char *)src, len) == 0 || | 106 | if (EVP_Cipher(&c->k1, dest, (u_char *)src, len) == 0 || | |
107 | EVP_Cipher(&c->k2, dest, dest, len) == 0 || | 107 | EVP_Cipher(&c->k2, dest, dest, len) == 0 || | |
108 | EVP_Cipher(&c->k3, dest, dest, len) == 0) | 108 | EVP_Cipher(&c->k3, dest, dest, len) == 0) | |
109 | return (0); | 109 | return (0); | |
110 | return (1); | 110 | return (1); | |
111 | } | 111 | } |
--- src/crypto/external/bsd/openssh/dist/Attic/cipher-bf1.c 2009/06/07 22:38:46 1.2
+++ src/crypto/external/bsd/openssh/dist/Attic/cipher-bf1.c 2009/07/20 15:33:44 1.3
@@ -1,41 +1,41 @@ | @@ -1,41 +1,41 @@ | |||
1 | /* $NetBSD: cipher-bf1.c,v 1.2 2009/06/07 22:38:46 christos Exp $ */ | 1 | /* $NetBSD: cipher-bf1.c,v 1.3 2009/07/20 15:33:44 christos Exp $ */ | |
2 | /* $OpenBSD: cipher-bf1.c,v 1.5 2006/08/03 03:34:42 deraadt Exp $ */ | 2 | /* $OpenBSD: cipher-bf1.c,v 1.5 2006/08/03 03:34:42 deraadt Exp $ */ | |
3 | /* | 3 | /* | |
4 | * Copyright (c) 2003 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2003 Markus Friedl. All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | */ | 25 | */ | |
26 | 26 | |||
27 | #include "includes.h" | 27 | #include "includes.h" | |
28 | __RCSID("$NetBSD: cipher-bf1.c,v 1.2 2009/06/07 22:38:46 christos Exp $"); | 28 | __RCSID("$NetBSD: cipher-bf1.c,v 1.3 2009/07/20 15:33:44 christos Exp $"); | |
29 | #include <sys/types.h> | 29 | #include <sys/types.h> | |
30 | 30 | |||
31 | #include <openssl/evp.h> | 31 | #include <openssl/evp.h> | |
32 | 32 | |||
33 | #include <string.h> | 33 | #include <string.h> | |
34 | 34 | |||
35 | #include "xmalloc.h" | 35 | #include "xmalloc.h" | |
36 | #include "log.h" | 36 | #include "log.h" | |
37 | /* | 37 | /* | |
38 | * SSH1 uses a variation on Blowfish, all bytes must be swapped before | 38 | * SSH1 uses a variation on Blowfish, all bytes must be swapped before | |
39 | * and after encryption/decryption. Thus the swap_bytes stuff (yuk). | 39 | * and after encryption/decryption. Thus the swap_bytes stuff (yuk). | |
40 | */ | 40 | */ | |
41 | 41 | |||
@@ -50,30 +50,30 @@ swap_bytes(const u_char *src, u_char *ds | @@ -50,30 +50,30 @@ swap_bytes(const u_char *src, u_char *ds | |||
50 | for (n = n / 4; n > 0; n--) { | 50 | for (n = n / 4; n > 0; n--) { | |
51 | c[3] = *src++; | 51 | c[3] = *src++; | |
52 | c[2] = *src++; | 52 | c[2] = *src++; | |
53 | c[1] = *src++; | 53 | c[1] = *src++; | |
54 | c[0] = *src++; | 54 | c[0] = *src++; | |
55 | 55 | |||
56 | *dst++ = c[0]; | 56 | *dst++ = c[0]; | |
57 | *dst++ = c[1]; | 57 | *dst++ = c[1]; | |
58 | *dst++ = c[2]; | 58 | *dst++ = c[2]; | |
59 | *dst++ = c[3]; | 59 | *dst++ = c[3]; | |
60 | } | 60 | } | |
61 | } | 61 | } | |
62 | 62 | |||
63 | static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL; | 63 | static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, size_t) = NULL; | |
64 | 64 | |||
65 | static int | 65 | static int | |
66 | bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, u_int len) | 66 | bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, size_t len) | |
67 | { | 67 | { | |
68 | int ret; | 68 | int ret; | |
69 | 69 | |||
70 | swap_bytes(in, out, len); | 70 | swap_bytes(in, out, len); | |
71 | ret = (*orig_bf)(ctx, out, out, len); | 71 | ret = (*orig_bf)(ctx, out, out, len); | |
72 | swap_bytes(out, out, len); | 72 | swap_bytes(out, out, len); | |
73 | return (ret); | 73 | return (ret); | |
74 | } | 74 | } | |
75 | 75 | |||
76 | const EVP_CIPHER * | 76 | const EVP_CIPHER * | |
77 | evp_ssh1_bf(void) | 77 | evp_ssh1_bf(void) | |
78 | { | 78 | { | |
79 | static EVP_CIPHER ssh1_bf; | 79 | static EVP_CIPHER ssh1_bf; |
--- src/crypto/external/bsd/openssh/dist/Attic/cipher-ctr.c 2009/06/07 22:38:46 1.2
+++ src/crypto/external/bsd/openssh/dist/Attic/cipher-ctr.c 2009/07/20 15:33:44 1.3
@@ -1,73 +1,73 @@ | @@ -1,73 +1,73 @@ | |||
1 | /* $NetBSD: cipher-ctr.c,v 1.2 2009/06/07 22:38:46 christos Exp $ */ | 1 | /* $NetBSD: cipher-ctr.c,v 1.3 2009/07/20 15:33:44 christos Exp $ */ | |
2 | /* $OpenBSD: cipher-ctr.c,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */ | 2 | /* $OpenBSD: cipher-ctr.c,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */ | |
3 | /* | 3 | /* | |
4 | * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> | 4 | * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> | |
5 | * | 5 | * | |
6 | * Permission to use, copy, modify, and distribute this software for any | 6 | * Permission to use, copy, modify, and distribute this software for any | |
7 | * purpose with or without fee is hereby granted, provided that the above | 7 | * purpose with or without fee is hereby granted, provided that the above | |
8 | * copyright notice and this permission notice appear in all copies. | 8 | * copyright notice and this permission notice appear in all copies. | |
9 | * | 9 | * | |
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 | */ | 17 | */ | |
18 | 18 | |||
19 | #include "includes.h" | 19 | #include "includes.h" | |
20 | __RCSID("$NetBSD: cipher-ctr.c,v 1.2 2009/06/07 22:38:46 christos Exp $"); | 20 | __RCSID("$NetBSD: cipher-ctr.c,v 1.3 2009/07/20 15:33:44 christos Exp $"); | |
21 | #include <sys/types.h> | 21 | #include <sys/types.h> | |
22 | 22 | |||
23 | #include <string.h> | 23 | #include <string.h> | |
24 | 24 | |||
25 | #include <openssl/evp.h> | 25 | #include <openssl/evp.h> | |
26 | #include <openssl/aes.h> | 26 | #include <openssl/aes.h> | |
27 | 27 | |||
28 | #include "xmalloc.h" | 28 | #include "xmalloc.h" | |
29 | #include "log.h" | 29 | #include "log.h" | |
30 | 30 | |||
31 | const EVP_CIPHER *evp_aes_128_ctr(void); | 31 | const EVP_CIPHER *evp_aes_128_ctr(void); | |
32 | void ssh_aes_ctr_iv(EVP_CIPHER_CTX *, int, u_char *, u_int); | 32 | void ssh_aes_ctr_iv(EVP_CIPHER_CTX *, int, u_char *, size_t); | |
33 | 33 | |||
34 | struct ssh_aes_ctr_ctx | 34 | struct ssh_aes_ctr_ctx | |
35 | { | 35 | { | |
36 | AES_KEY aes_ctx; | 36 | AES_KEY aes_ctx; | |
37 | u_char aes_counter[AES_BLOCK_SIZE]; | 37 | u_char aes_counter[AES_BLOCK_SIZE]; | |
38 | }; | 38 | }; | |
39 | 39 | |||
40 | /* | 40 | /* | |
41 | * increment counter 'ctr', | 41 | * increment counter 'ctr', | |
42 | * the counter is of size 'len' bytes and stored in network-byte-order. | 42 | * the counter is of size 'len' bytes and stored in network-byte-order. | |
43 | * (LSB at ctr[len-1], MSB at ctr[0]) | 43 | * (LSB at ctr[len-1], MSB at ctr[0]) | |
44 | */ | 44 | */ | |
45 | static void | 45 | static void | |
46 | ssh_ctr_inc(u_char *ctr, u_int len) | 46 | ssh_ctr_inc(u_char *ctr, size_t len) | |
47 | { | 47 | { | |
48 | int i; | 48 | int i; | |
49 | 49 | |||
50 | for (i = len - 1; i >= 0; i--) | 50 | for (i = len - 1; i >= 0; i--) | |
51 | if (++ctr[i]) /* continue on overflow */ | 51 | if (++ctr[i]) /* continue on overflow */ | |
52 | return; | 52 | return; | |
53 | } | 53 | } | |
54 | 54 | |||
55 | static int | 55 | static int | |
56 | ssh_aes_ctr(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, | 56 | ssh_aes_ctr(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, | |
57 | u_int len) | 57 | size_t len) | |
58 | { | 58 | { | |
59 | struct ssh_aes_ctr_ctx *c; | 59 | struct ssh_aes_ctr_ctx *c; | |
60 | u_int n = 0; | 60 | size_t n = 0; | |
61 | u_char buf[AES_BLOCK_SIZE]; | 61 | u_char buf[AES_BLOCK_SIZE]; | |
62 | 62 | |||
63 | if (len == 0) | 63 | if (len == 0) | |
64 | return (1); | 64 | return (1); | |
65 | if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) | 65 | if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) | |
66 | return (0); | 66 | return (0); | |
67 | 67 | |||
68 | while ((len--) > 0) { | 68 | while ((len--) > 0) { | |
69 | if (n == 0) { | 69 | if (n == 0) { | |
70 | AES_encrypt(c->aes_counter, buf, &c->aes_ctx); | 70 | AES_encrypt(c->aes_counter, buf, &c->aes_ctx); | |
71 | ssh_ctr_inc(c->aes_counter, AES_BLOCK_SIZE); | 71 | ssh_ctr_inc(c->aes_counter, AES_BLOCK_SIZE); | |
72 | } | 72 | } | |
73 | *(dest++) = *(src++) ^ buf[n]; | 73 | *(dest++) = *(src++) ^ buf[n]; | |
@@ -98,27 +98,27 @@ static int | @@ -98,27 +98,27 @@ static int | |||
98 | ssh_aes_ctr_cleanup(EVP_CIPHER_CTX *ctx) | 98 | ssh_aes_ctr_cleanup(EVP_CIPHER_CTX *ctx) | |
99 | { | 99 | { | |
100 | struct ssh_aes_ctr_ctx *c; | 100 | struct ssh_aes_ctr_ctx *c; | |
101 | 101 | |||
102 | if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) != NULL) { | 102 | if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) != NULL) { | |
103 | memset(c, 0, sizeof(*c)); | 103 | memset(c, 0, sizeof(*c)); | |
104 | xfree(c); | 104 | xfree(c); | |
105 | EVP_CIPHER_CTX_set_app_data(ctx, NULL); | 105 | EVP_CIPHER_CTX_set_app_data(ctx, NULL); | |
106 | } | 106 | } | |
107 | return (1); | 107 | return (1); | |
108 | } | 108 | } | |
109 | 109 | |||
110 | void | 110 | void | |
111 | ssh_aes_ctr_iv(EVP_CIPHER_CTX *evp, int doset, u_char * iv, u_int len) | 111 | ssh_aes_ctr_iv(EVP_CIPHER_CTX *evp, int doset, u_char * iv, size_t len) | |
112 | { | 112 | { | |
113 | struct ssh_aes_ctr_ctx *c; | 113 | struct ssh_aes_ctr_ctx *c; | |
114 | 114 | |||
115 | if ((c = EVP_CIPHER_CTX_get_app_data(evp)) == NULL) | 115 | if ((c = EVP_CIPHER_CTX_get_app_data(evp)) == NULL) | |
116 | fatal("ssh_aes_ctr_iv: no context"); | 116 | fatal("ssh_aes_ctr_iv: no context"); | |
117 | if (doset) | 117 | if (doset) | |
118 | memcpy(c->aes_counter, iv, len); | 118 | memcpy(c->aes_counter, iv, len); | |
119 | else | 119 | else | |
120 | memcpy(iv, c->aes_counter, len); | 120 | memcpy(iv, c->aes_counter, len); | |
121 | } | 121 | } | |
122 | 122 | |||
123 | const EVP_CIPHER * | 123 | const EVP_CIPHER * | |
124 | evp_aes_128_ctr(void) | 124 | evp_aes_128_ctr(void) |