Skip to content

Commit c7aac00

Browse files
Eric Biggersidryomov
authored andcommitted
libceph: Remove obsolete session key alignment logic
Since the call to crypto_shash_setkey() was replaced with hmac_sha256_preparekey() which doesn't allocate memory regardless of the alignment of the input key, remove the session key alignment logic from process_auth_done(). Also remove the inclusion of crypto/hash.h, which is no longer needed since crypto_shash is no longer used. [ idryomov: rewrap comment ] Signed-off-by: Eric Biggers <ebiggers@kernel.org> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent a0d9555 commit c7aac00

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

net/ceph/messenger_v2.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <linux/ceph/ceph_debug.h>
99

1010
#include <crypto/aead.h>
11-
#include <crypto/hash.h>
1211
#include <crypto/sha2.h>
1312
#include <crypto/utils.h>
1413
#include <linux/bvec.h>
@@ -2352,16 +2351,14 @@ static int process_auth_reply_more(struct ceph_connection *con,
23522351
}
23532352

23542353
/*
2355-
* Align session_key and con_secret to avoid GFP_ATOMIC allocation
2356-
* inside crypto_shash_setkey() and crypto_aead_setkey() called from
2357-
* setup_crypto(). __aligned(16) isn't guaranteed to work for stack
2358-
* objects, so do it by hand.
2354+
* Align con_secret to avoid GFP_ATOMIC allocation inside
2355+
* crypto_aead_setkey() called from setup_crypto(). __aligned(16)
2356+
* isn't guaranteed to work for stack objects, so do it by hand.
23592357
*/
23602358
static int process_auth_done(struct ceph_connection *con, void *p, void *end)
23612359
{
2362-
u8 session_key_buf[CEPH_MAX_KEY_LEN + 16];
2360+
u8 session_key[CEPH_MAX_KEY_LEN];
23632361
u8 con_secret_buf[CEPH_MAX_CON_SECRET_LEN + 16];
2364-
u8 *session_key = PTR_ALIGN(&session_key_buf[0], 16);
23652362
u8 *con_secret = PTR_ALIGN(&con_secret_buf[0], 16);
23662363
int session_key_len, con_secret_len;
23672364
int payload_len;
@@ -2415,7 +2412,7 @@ static int process_auth_done(struct ceph_connection *con, void *p, void *end)
24152412
con->state = CEPH_CON_S_V2_AUTH_SIGNATURE;
24162413

24172414
out:
2418-
memzero_explicit(session_key_buf, sizeof(session_key_buf));
2415+
memzero_explicit(session_key, sizeof(session_key));
24192416
memzero_explicit(con_secret_buf, sizeof(con_secret_buf));
24202417
return ret;
24212418

0 commit comments

Comments
 (0)