MCPcopy Create free account
hub / github.com/F-Stack/f-stack / swcr_setup_cipher

Function swcr_setup_cipher

freebsd/opencrypto/cryptosoft.c:975–1000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

973}
974
975static int
976swcr_setup_cipher(struct swcr_session *ses,
977 const struct crypto_session_params *csp)
978{
979 struct swcr_encdec *swe;
980 struct enc_xform *txf;
981 int error;
982
983 swe = &ses->swcr_encdec;
984 txf = crypto_cipher(csp);
985 MPASS(txf->ivsize == csp->csp_ivlen);
986 if (txf->ctxsize != 0) {
987 swe->sw_kschedule = malloc(txf->ctxsize, M_CRYPTO_DATA,
988 M_NOWAIT);
989 if (swe->sw_kschedule == NULL)
990 return (ENOMEM);
991 }
992 if (csp->csp_cipher_key != NULL) {
993 error = txf->setkey(swe->sw_kschedule,
994 csp->csp_cipher_key, csp->csp_cipher_klen);
995 if (error)
996 return (error);
997 }
998 swe->sw_exf = txf;
999 return (0);
1000}
1001
1002static int
1003swcr_setup_auth(struct swcr_session *ses,

Callers 3

swcr_setup_gcmFunction · 0.85
swcr_setup_ccmFunction · 0.85
swcr_newsessionFunction · 0.85

Calls 2

crypto_cipherFunction · 0.85
mallocFunction · 0.85

Tested by

no test coverage detected