diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/evp/e_chacha20poly1305.c | 22 | ||||
-rw-r--r-- | lib/libcrypto/evp/evp.h | 4 | ||||
-rw-r--r-- | lib/libssl/ssl_ciph.c | 4 |
3 files changed, 15 insertions, 15 deletions
diff --git a/lib/libcrypto/evp/e_chacha20poly1305.c b/lib/libcrypto/evp/e_chacha20poly1305.c index f512837c32c..e5395ad8caf 100644 --- a/lib/libcrypto/evp/e_chacha20poly1305.c +++ b/lib/libcrypto/evp/e_chacha20poly1305.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_chacha20poly1305.c,v 1.13 2016/04/13 13:25:05 jsing Exp $ */ +/* $OpenBSD: e_chacha20poly1305.c,v 1.14 2016/04/28 16:06:53 jsing Exp $ */ /* * Copyright (c) 2015 Reyk Floter <reyk@openbsd.org> @@ -32,7 +32,7 @@ #include "evp_locl.h" #define POLY1305_TAG_LEN 16 -#define CHACHA20_NONCE_LEN 8 +#define CHACHA20_NONCE_LEN_OLD 8 /* * The informational RFC 7539, "ChaCha20 and Poly1305 for IETF Protocols", @@ -42,7 +42,7 @@ */ #define CHACHA20_CONSTANT_LEN 4 #define CHACHA20_IV_LEN 8 -#define CHACHA20_NONCE_LEN_IETF (CHACHA20_CONSTANT_LEN + CHACHA20_IV_LEN) +#define CHACHA20_NONCE_LEN (CHACHA20_CONSTANT_LEN + CHACHA20_IV_LEN) struct aead_chacha20_poly1305_ctx { unsigned char key[32]; @@ -157,7 +157,7 @@ aead_chacha20_poly1305_seal(const EVP_AEAD_CTX *ctx, unsigned char *out, return 0; } - if (nonce_len == CHACHA20_NONCE_LEN) { + if (nonce_len == CHACHA20_NONCE_LEN_OLD) { /* Google's draft-agl-tls-chacha20poly1305-04, Nov 2013 */ memset(poly1305_key, 0, sizeof(poly1305_key)); @@ -168,7 +168,7 @@ aead_chacha20_poly1305_seal(const EVP_AEAD_CTX *ctx, unsigned char *out, poly1305_update_with_length(&poly1305, ad, ad_len); CRYPTO_chacha_20(out, in, in_len, c20_ctx->key, nonce, 1); poly1305_update_with_length(&poly1305, out, in_len); - } else if (nonce_len == CHACHA20_NONCE_LEN_IETF) { + } else if (nonce_len == CHACHA20_NONCE_LEN) { /* RFC 7539, May 2015 */ ctr = (uint64_t)(nonce[0] | nonce[1] << 8 | @@ -245,7 +245,7 @@ aead_chacha20_poly1305_open(const EVP_AEAD_CTX *ctx, unsigned char *out, return 0; } - if (nonce_len == CHACHA20_NONCE_LEN) { + if (nonce_len == CHACHA20_NONCE_LEN_OLD) { /* Google's draft-agl-tls-chacha20poly1305-04, Nov 2013 */ memset(poly1305_key, 0, sizeof(poly1305_key)); @@ -255,7 +255,7 @@ aead_chacha20_poly1305_open(const EVP_AEAD_CTX *ctx, unsigned char *out, CRYPTO_poly1305_init(&poly1305, poly1305_key); poly1305_update_with_length(&poly1305, ad, ad_len); poly1305_update_with_length(&poly1305, in, plaintext_len); - } else if (nonce_len == CHACHA20_NONCE_LEN_IETF) { + } else if (nonce_len == CHACHA20_NONCE_LEN) { /* RFC 7539, May 2015 */ ctr = (uint64_t)(nonce[0] | nonce[1] << 8 | @@ -297,9 +297,9 @@ static const EVP_AEAD aead_chacha20_poly1305 = { .open = aead_chacha20_poly1305_open, }; -static const EVP_AEAD aead_chacha20_poly1305_ietf = { +static const EVP_AEAD aead_chacha20_poly1305_old = { .key_len = 32, - .nonce_len = CHACHA20_NONCE_LEN_IETF, + .nonce_len = CHACHA20_NONCE_LEN_OLD, .overhead = POLY1305_TAG_LEN, .max_tag_len = POLY1305_TAG_LEN, @@ -316,9 +316,9 @@ EVP_aead_chacha20_poly1305() } const EVP_AEAD * -EVP_aead_chacha20_poly1305_ietf() +EVP_aead_chacha20_poly1305_old() { - return &aead_chacha20_poly1305_ietf; + return &aead_chacha20_poly1305_old; } #endif /* !OPENSSL_NO_CHACHA && !OPENSSL_NO_POLY1305 */ diff --git a/lib/libcrypto/evp/evp.h b/lib/libcrypto/evp/evp.h index 1ec24879c01..a0adbece014 100644 --- a/lib/libcrypto/evp/evp.h +++ b/lib/libcrypto/evp/evp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: evp.h,v 1.49 2015/11/02 15:40:53 reyk Exp $ */ +/* $OpenBSD: evp.h,v 1.50 2016/04/28 16:06:53 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1215,7 +1215,7 @@ const EVP_AEAD *EVP_aead_aes_256_gcm(void); #if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) /* EVP_aead_chacha20_poly1305 is ChaCha20 with a Poly1305 authenticator. */ const EVP_AEAD *EVP_aead_chacha20_poly1305(void); -const EVP_AEAD *EVP_aead_chacha20_poly1305_ietf(void); +const EVP_AEAD *EVP_aead_chacha20_poly1305_old(void); #endif /* EVP_AEAD_key_length returns the length of the keys used. */ diff --git a/lib/libssl/ssl_ciph.c b/lib/libssl/ssl_ciph.c index 05bfc47c1ed..5d1d568ff84 100644 --- a/lib/libssl/ssl_ciph.c +++ b/lib/libssl/ssl_ciph.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_ciph.c,v 1.84 2015/12/12 22:04:10 mmcc Exp $ */ +/* $OpenBSD: ssl_ciph.c,v 1.85 2016/04/28 16:06:53 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -731,7 +731,7 @@ ssl_cipher_get_evp_aead(const SSL_SESSION *s, const EVP_AEAD **aead) #endif #if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) case SSL_CHACHA20POLY1305: - *aead = EVP_aead_chacha20_poly1305(); + *aead = EVP_aead_chacha20_poly1305_old(); return 1; #endif default: |