diff options
author | djm@openbsd.org <djm@openbsd.org> | 2015-01-14 10:29:45 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-01-14 21:32:55 +1100 |
commit | 540e891191b98b89ee90aacf5b14a4a68635e763 (patch) | |
tree | 326b80921b50da318e33354159418cfb49a4b9bc /cipher.c | |
parent | 60c2c4ea5e1ad0ddfe8b2877b78ed5143be79c53 (diff) |
upstream commit
make non-OpenSSL aes-ctr work on sshd w/ privsep; ok
markus@
Diffstat (limited to 'cipher.c')
-rw-r--r-- | cipher.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cipher.c,v 1.99 2014/06/24 01:13:21 djm Exp $ */ | 1 | /* $OpenBSD: cipher.c,v 1.100 2015/01/14 10:29:45 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -512,6 +512,8 @@ cipher_get_keyiv_len(const struct sshcipher_ctx *cc) | |||
512 | ivlen = 24; | 512 | ivlen = 24; |
513 | else if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) | 513 | else if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) |
514 | ivlen = 0; | 514 | ivlen = 0; |
515 | else if ((cc->cipher->flags & CFLAG_AESCTR) != 0) | ||
516 | ivlen = sizeof(cc->ac_ctx.ctr); | ||
515 | #ifdef WITH_OPENSSL | 517 | #ifdef WITH_OPENSSL |
516 | else | 518 | else |
517 | ivlen = EVP_CIPHER_CTX_iv_length(&cc->evp); | 519 | ivlen = EVP_CIPHER_CTX_iv_length(&cc->evp); |
@@ -532,6 +534,12 @@ cipher_get_keyiv(struct sshcipher_ctx *cc, u_char *iv, u_int len) | |||
532 | return SSH_ERR_INVALID_ARGUMENT; | 534 | return SSH_ERR_INVALID_ARGUMENT; |
533 | return 0; | 535 | return 0; |
534 | } | 536 | } |
537 | if ((cc->cipher->flags & CFLAG_AESCTR) != 0) { | ||
538 | if (len != sizeof(cc->ac_ctx.ctr)) | ||
539 | return SSH_ERR_INVALID_ARGUMENT; | ||
540 | memcpy(iv, cc->ac_ctx.ctr, len); | ||
541 | return 0; | ||
542 | } | ||
535 | if ((cc->cipher->flags & CFLAG_NONE) != 0) | 543 | if ((cc->cipher->flags & CFLAG_NONE) != 0) |
536 | return 0; | 544 | return 0; |
537 | 545 | ||