Print this page
5253 kmem_alloc/kmem_zalloc won't fail with KM_SLEEP
5254 getrbuf won't fail with KM_SLEEP


  87 };
  88 
  89 static void michael_mic(struct tkip_ctx *, const uint8_t *,
  90     mblk_t *, uint_t, size_t, uint8_t[]);
  91 static int tkip_encrypt(struct tkip_ctx *, struct ieee80211_key *,
  92     mblk_t *, int);
  93 static int tkip_decrypt(struct tkip_ctx *, struct ieee80211_key *,
  94     mblk_t *, int);
  95 
  96 extern int rc4_init(crypto_context_t *, const uint8_t *, int);
  97 extern int rc4_crypt(crypto_context_t, const uint8_t *, uint8_t *, int);
  98 extern int rc4_final(crypto_context_t, uint8_t *, int);
  99 
 100 /* ARGSUSED */
 101 static void *
 102 tkip_attach(struct ieee80211com *ic, struct ieee80211_key *k)
 103 {
 104         struct tkip_ctx *ctx;
 105 
 106         ctx = kmem_zalloc(sizeof (struct tkip_ctx), KM_SLEEP);
 107         if (ctx == NULL)
 108                 return (NULL);
 109 
 110         ctx->tc_ic = ic;
 111         return (ctx);
 112 }
 113 
 114 static void
 115 tkip_detach(struct ieee80211_key *k)
 116 {
 117         struct tkip_ctx *ctx = k->wk_private;
 118 
 119         if (ctx != NULL)
 120                 kmem_free(ctx, sizeof (struct tkip_ctx));
 121 }
 122 
 123 static int
 124 tkip_setkey(struct ieee80211_key *k)
 125 {
 126         if (k->wk_keylen != (128/NBBY))
 127                 return (0);
 128 




  87 };
  88 
  89 static void michael_mic(struct tkip_ctx *, const uint8_t *,
  90     mblk_t *, uint_t, size_t, uint8_t[]);
  91 static int tkip_encrypt(struct tkip_ctx *, struct ieee80211_key *,
  92     mblk_t *, int);
  93 static int tkip_decrypt(struct tkip_ctx *, struct ieee80211_key *,
  94     mblk_t *, int);
  95 
  96 extern int rc4_init(crypto_context_t *, const uint8_t *, int);
  97 extern int rc4_crypt(crypto_context_t, const uint8_t *, uint8_t *, int);
  98 extern int rc4_final(crypto_context_t, uint8_t *, int);
  99 
 100 /* ARGSUSED */
 101 static void *
 102 tkip_attach(struct ieee80211com *ic, struct ieee80211_key *k)
 103 {
 104         struct tkip_ctx *ctx;
 105 
 106         ctx = kmem_zalloc(sizeof (struct tkip_ctx), KM_SLEEP);


 107 
 108         ctx->tc_ic = ic;
 109         return (ctx);
 110 }
 111 
 112 static void
 113 tkip_detach(struct ieee80211_key *k)
 114 {
 115         struct tkip_ctx *ctx = k->wk_private;
 116 
 117         if (ctx != NULL)
 118                 kmem_free(ctx, sizeof (struct tkip_ctx));
 119 }
 120 
 121 static int
 122 tkip_setkey(struct ieee80211_key *k)
 123 {
 124         if (k->wk_keylen != (128/NBBY))
 125                 return (0);
 126