|
@@ -110,7 +110,6 @@ static int sctp_do_bind(struct sock *, union sctp_addr *, int);
|
|
|
static int sctp_autobind(struct sock *sk);
|
|
static int sctp_autobind(struct sock *sk);
|
|
|
static void sctp_sock_migrate(struct sock *, struct sock *,
|
|
static void sctp_sock_migrate(struct sock *, struct sock *,
|
|
|
struct sctp_association *, sctp_socket_type_t);
|
|
struct sctp_association *, sctp_socket_type_t);
|
|
|
-static char *sctp_hmac_alg = SCTP_COOKIE_HMAC_ALG;
|
|
|
|
|
|
|
|
|
|
extern struct kmem_cache *sctp_bucket_cachep;
|
|
extern struct kmem_cache *sctp_bucket_cachep;
|
|
|
extern long sysctl_sctp_mem[3];
|
|
extern long sysctl_sctp_mem[3];
|
|
@@ -3890,6 +3889,8 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
|
|
|
sp->default_rcv_context = 0;
|
|
sp->default_rcv_context = 0;
|
|
|
sp->max_burst = net->sctp.max_burst;
|
|
sp->max_burst = net->sctp.max_burst;
|
|
|
|
|
|
|
|
|
|
+ sp->sctp_hmac_alg = net->sctp.sctp_hmac_alg;
|
|
|
|
|
+
|
|
|
/* Initialize default setup parameters. These parameters
|
|
/* Initialize default setup parameters. These parameters
|
|
|
* can be modified with the SCTP_INITMSG socket option or
|
|
* can be modified with the SCTP_INITMSG socket option or
|
|
|
* overridden by the SCTP_INIT CMSG.
|
|
* overridden by the SCTP_INIT CMSG.
|
|
@@ -5981,13 +5982,15 @@ SCTP_STATIC int sctp_listen_start(struct sock *sk, int backlog)
|
|
|
struct sctp_sock *sp = sctp_sk(sk);
|
|
struct sctp_sock *sp = sctp_sk(sk);
|
|
|
struct sctp_endpoint *ep = sp->ep;
|
|
struct sctp_endpoint *ep = sp->ep;
|
|
|
struct crypto_hash *tfm = NULL;
|
|
struct crypto_hash *tfm = NULL;
|
|
|
|
|
+ char alg[32];
|
|
|
|
|
|
|
|
/* Allocate HMAC for generating cookie. */
|
|
/* Allocate HMAC for generating cookie. */
|
|
|
- if (!sctp_sk(sk)->hmac && sctp_hmac_alg) {
|
|
|
|
|
- tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC);
|
|
|
|
|
|
|
+ if (!sp->hmac && sp->sctp_hmac_alg) {
|
|
|
|
|
+ sprintf(alg, "hmac(%s)", sp->sctp_hmac_alg);
|
|
|
|
|
+ tfm = crypto_alloc_hash(alg, 0, CRYPTO_ALG_ASYNC);
|
|
|
if (IS_ERR(tfm)) {
|
|
if (IS_ERR(tfm)) {
|
|
|
net_info_ratelimited("failed to load transform for %s: %ld\n",
|
|
net_info_ratelimited("failed to load transform for %s: %ld\n",
|
|
|
- sctp_hmac_alg, PTR_ERR(tfm));
|
|
|
|
|
|
|
+ sp->sctp_hmac_alg, PTR_ERR(tfm));
|
|
|
return -ENOSYS;
|
|
return -ENOSYS;
|
|
|
}
|
|
}
|
|
|
sctp_sk(sk)->hmac = tfm;
|
|
sctp_sk(sk)->hmac = tfm;
|