Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-01-15 01:24:53 +0300
committerAdam Langley <agl@google.com>2015-01-16 05:05:45 +0300
commit7f1d5d5932e123d3999453c0cd80c8538d5527c6 (patch)
tree55c2a802831615970ec76739a1162398fc5533e7 /crypto
parentf0eb1698291c00c60f76f8207b9fa9c079e75c12 (diff)
Follow-ups from recent patch train.
Comment fixups and a mismerge in aead_test. Also some buffer was larger than needed. Change-Id: I0e158089f42801575833684912f9edb206f61007 Reviewed-on: https://boringssl-review.googlesource.com/2870 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/cipher/aead_test.c18
-rw-r--r--crypto/cipher/e_ssl3.c6
-rw-r--r--crypto/cipher/e_tls.c4
-rw-r--r--crypto/cipher/internal.h2
4 files changed, 15 insertions, 15 deletions
diff --git a/crypto/cipher/aead_test.c b/crypto/cipher/aead_test.c
index df8123b0..dac022fb 100644
--- a/crypto/cipher/aead_test.c
+++ b/crypto/cipher/aead_test.c
@@ -157,15 +157,6 @@ static int run_test_case(const EVP_AEAD *aead,
return 0;
}
- /* The "stateful" AEADs for implementing pre-AEAD cipher suites need to be
- * reset after each operation. */
- EVP_AEAD_CTX_cleanup(&ctx);
- if (!EVP_AEAD_CTX_init(&ctx, aead, bufs[KEY], lengths[KEY], lengths[TAG],
- NULL)) {
- fprintf(stderr, "Failed to init AEAD on line %u\n", line_no);
- return 0;
- }
-
/* Garbage at the end isn't ignored. */
out[ciphertext_len] = 0;
if (EVP_AEAD_CTX_open(&ctx, out2, &plaintext_len, ciphertext_len + 1,
@@ -176,6 +167,15 @@ static int run_test_case(const EVP_AEAD *aead,
}
ERR_clear_error();
+ /* The "stateful" AEADs for implementing pre-AEAD cipher suites need to be
+ * reset after each operation. */
+ EVP_AEAD_CTX_cleanup(&ctx);
+ if (!EVP_AEAD_CTX_init(&ctx, aead, bufs[KEY], lengths[KEY], lengths[TAG],
+ NULL)) {
+ fprintf(stderr, "Failed to init AEAD on line %u\n", line_no);
+ return 0;
+ }
+
/* Verify integrity is checked. */
out[0] ^= 0x80;
if (EVP_AEAD_CTX_open(&ctx, out2, &plaintext_len, ciphertext_len, bufs[NONCE],
diff --git a/crypto/cipher/e_ssl3.c b/crypto/cipher/e_ssl3.c
index 1b541091..d9dec68d 100644
--- a/crypto/cipher/e_ssl3.c
+++ b/crypto/cipher/e_ssl3.c
@@ -58,7 +58,7 @@ static int ssl3_mac(AEAD_SSL3_CTX *ssl3_ctx, uint8_t *out, unsigned *out_len,
EVP_MD_CTX md_ctx;
EVP_MD_CTX_init(&md_ctx);
- uint8_t pad[EVP_MAX_MD_SIZE];
+ uint8_t pad[48];
uint8_t tmp[EVP_MAX_MD_SIZE];
memset(pad, 0x36, pad_len);
if (!EVP_MD_CTX_copy_ex(&md_ctx, &ssl3_ctx->md_ctx) ||
@@ -192,7 +192,7 @@ static int aead_ssl3_seal(const EVP_AEAD_CTX *ctx, uint8_t *out,
return 0;
}
- if (ad_len != 11 - 2) {
+ if (ad_len != 11 - 2 /* length bytes */) {
OPENSSL_PUT_ERROR(CIPHER, aead_ssl3_seal, CIPHER_R_INVALID_AD_SIZE);
return 0;
}
@@ -275,7 +275,7 @@ static int aead_ssl3_open(const EVP_AEAD_CTX *ctx, uint8_t *out,
return 0;
}
- if (ad_len != 11 - 2) {
+ if (ad_len != 11 - 2 /* length bytes */) {
OPENSSL_PUT_ERROR(CIPHER, aead_ssl3_open, CIPHER_R_INVALID_AD_SIZE);
return 0;
}
diff --git a/crypto/cipher/e_tls.c b/crypto/cipher/e_tls.c
index 2134badc..8ac1aaec 100644
--- a/crypto/cipher/e_tls.c
+++ b/crypto/cipher/e_tls.c
@@ -164,7 +164,7 @@ static int aead_tls_seal(const EVP_AEAD_CTX *ctx, uint8_t *out,
return 0;
}
- if (ad_len != 13 - 2) {
+ if (ad_len != 13 - 2 /* length bytes */) {
OPENSSL_PUT_ERROR(CIPHER, aead_tls_seal, CIPHER_R_INVALID_AD_SIZE);
return 0;
}
@@ -266,7 +266,7 @@ static int aead_tls_open(const EVP_AEAD_CTX *ctx, uint8_t *out,
return 0;
}
- if (ad_len != 13 - 2) {
+ if (ad_len != 13 - 2 /* length bytes */) {
OPENSSL_PUT_ERROR(CIPHER, aead_tls_open, CIPHER_R_INVALID_AD_SIZE);
return 0;
}
diff --git a/crypto/cipher/internal.h b/crypto/cipher/internal.h
index bd49f57e..2b8fb050 100644
--- a/crypto/cipher/internal.h
+++ b/crypto/cipher/internal.h
@@ -165,7 +165,7 @@ int EVP_tls_cbc_record_digest_supported(const EVP_MD *md);
* record.
*
* md: the hash function used in the HMAC.
- * tls_cbc_record_digest_supported must return true for this hash.
+ * EVP_tls_cbc_record_digest_supported must return true for this hash.
* md_out: the digest output. At most EVP_MAX_MD_SIZE bytes will be written.
* md_out_size: the number of output bytes is written here.
* header: the 13-byte, TLS record header.