Don't delay-initialize legacy AEADs.
Instead, add a separate init_with_direction hook. Normal AEADs ignore the
direction, while legacy AEADs must be initialized with it. This avoids
maintaining extra state to support the delayed initialization.
Change-Id: I25271f0e56ee2783a2fd4d4026434154d58dc0a8
Reviewed-on: https://boringssl-review.googlesource.com/3731
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/cipher/internal.h b/crypto/cipher/internal.h
index f28fd4c..2130a69 100644
--- a/crypto/cipher/internal.h
+++ b/crypto/cipher/internal.h
@@ -59,6 +59,7 @@
#include <openssl/base.h>
+#include <openssl/aead.h>
#include <openssl/asn1t.h>
#if defined(__cplusplus)
@@ -117,6 +118,9 @@
int (*init)(struct evp_aead_ctx_st *, const uint8_t *key,
size_t key_len, size_t tag_len);
+ int (*init_with_direction)(struct evp_aead_ctx_st *, const uint8_t *key,
+ size_t key_len, size_t tag_len,
+ enum evp_aead_direction_t dir);
void (*cleanup)(struct evp_aead_ctx_st *);
int (*seal)(const struct evp_aead_ctx_st *ctx, uint8_t *out,