Changeset View
Changeset View
Standalone View
Standalone View
sys/crypto/openssl/ossl.h
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
/* Needs to be big enough to hold any hash context. */ | /* Needs to be big enough to hold any hash context. */ | ||||
#if defined (__arm__) | #if defined (__arm__) | ||||
#define CONTEXT_DUMMY_SIZE 512 | #define CONTEXT_DUMMY_SIZE 512 | ||||
#else | #else | ||||
#define CONTEXT_DUMMY_SIZE 61 | #define CONTEXT_DUMMY_SIZE 61 | ||||
#endif | #endif | ||||
typedef struct { | |||||
uint64_t hi, lo; | |||||
} uint128_t; | |||||
struct ossl_gcm_context { | |||||
union { | |||||
uint64_t u[2]; | |||||
uint32_t d[4]; | |||||
uint8_t c[16]; | |||||
} Yi, EKi, EK0, len, Xi, H; | |||||
uint128_t Htable[1]; | |||||
kd: I'm not sure if we need the Htable to be this big.
It's main use case is to precompute… | |||||
uint32_t mres, ares; | |||||
void *key; | |||||
}; | |||||
struct ossl_hash_context { | struct ossl_hash_context { | ||||
uint32_t dummy[CONTEXT_DUMMY_SIZE]; | uint32_t dummy[CONTEXT_DUMMY_SIZE]; | ||||
} __aligned(32); | } __aligned(32); | ||||
struct ossl_cipher_context { | struct ossl_cipher_context { | ||||
uint32_t dummy[CONTEXT_DUMMY_SIZE]; | uint32_t dummy[CONTEXT_DUMMY_SIZE]; | ||||
} __aligned(32); | } __aligned(32); | ||||
Show All 18 Lines | |||||
extern struct auth_hash ossl_hash_poly1305; | extern struct auth_hash ossl_hash_poly1305; | ||||
extern struct auth_hash ossl_hash_sha1; | extern struct auth_hash ossl_hash_sha1; | ||||
extern struct auth_hash ossl_hash_sha224; | extern struct auth_hash ossl_hash_sha224; | ||||
extern struct auth_hash ossl_hash_sha256; | extern struct auth_hash ossl_hash_sha256; | ||||
extern struct auth_hash ossl_hash_sha384; | extern struct auth_hash ossl_hash_sha384; | ||||
extern struct auth_hash ossl_hash_sha512; | extern struct auth_hash ossl_hash_sha512; | ||||
extern struct ossl_cipher ossl_cipher_aes_cbc; | extern struct ossl_cipher ossl_cipher_aes_cbc; | ||||
extern struct ossl_cipher ossl_cipher_aes_gcm; | |||||
extern struct ossl_cipher ossl_cipher_chacha20; | extern struct ossl_cipher ossl_cipher_chacha20; | ||||
#endif /* !__OSSL_H__ */ | #endif /* !__OSSL_H__ */ |
I'm not sure if we need the Htable to be this big.
It's main use case is to precompute different values of H, so that later we can apply calculate ghash on multiple blocks at the same time.
From what I can see gcm_init_neon uses only a single value of H, so uint128_t Htable[1]; should be sufficient.
With a smaller context we might not need to increase the size kernel stack. (D37441)