-/* $OpenBSD: crypto.c,v 1.90 2021/10/23 15:42:35 tobhe Exp $ */
+/* $OpenBSD: crypto.c,v 1.91 2021/10/24 10:26:22 patrick Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
crypto_drivers[hid].cc_bytes += crp->crp_ilen;
error = crypto_drivers[hid].cc_process(crp);
- if (error) {
- if (error == ERESTART) {
- /* Unregister driver and migrate session. */
- crypto_unregister(hid, CRYPTO_ALGORITHM_MAX + 1);
- goto migrate;
- } else {
- crp->crp_etype = error;
- }
+ crp->crp_etype = error;
+ if (error == ERESTART) {
+ /* Unregister driver and migrate session. */
+ crypto_unregister(hid, CRYPTO_ALGORITHM_MAX + 1);
+ goto migrate;
}
splx(s);
-/* $OpenBSD: cryptosoft.c,v 1.90 2021/10/23 15:42:35 tobhe Exp $ */
+/* $OpenBSD: cryptosoft.c,v 1.91 2021/10/24 10:26:22 patrick Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
struct swcr_list *session;
struct swcr_data *sw;
u_int32_t lid;
+ int err = 0;
int type;
int i;
KASSERT(crp->crp_ndesc >= 1);
if (crp->crp_buf == NULL) {
- crp->crp_etype = EINVAL;
+ err = EINVAL;
goto done;
}
lid = crp->crp_sid & 0xffffffff;
if (lid >= swcr_sesnum || lid == 0 ||
SLIST_EMPTY(&swcr_sessions[lid])) {
- crp->crp_etype = ENOENT;
+ err = ENOENT;
goto done;
}
/* No such context ? */
if (sw == NULL) {
- crp->crp_etype = EINVAL;
+ err = EINVAL;
goto done;
}
case CRYPTO_RIJNDAEL128_CBC:
case CRYPTO_AES_CTR:
case CRYPTO_AES_XTS:
- if ((crp->crp_etype = swcr_encdec(crd, sw,
+ if ((err = swcr_encdec(crd, sw,
crp->crp_buf, type)) != 0)
goto done;
break;
case CRYPTO_SHA2_256_HMAC:
case CRYPTO_SHA2_384_HMAC:
case CRYPTO_SHA2_512_HMAC:
- if ((crp->crp_etype = swcr_authcompute(crp, crd, sw,
+ if ((err = swcr_authcompute(crp, crd, sw,
crp->crp_buf, type)) != 0)
goto done;
break;
case CRYPTO_AES_256_GMAC:
case CRYPTO_CHACHA20_POLY1305:
case CRYPTO_CHACHA20_POLY1305_MAC:
- crp->crp_etype = swcr_authenc(crp);
+ err = swcr_authenc(crp);
goto done;
case CRYPTO_DEFLATE_COMP:
- if ((crp->crp_etype = swcr_compdec(crd, sw,
+ if ((err = swcr_compdec(crd, sw,
crp->crp_buf, type)) != 0)
goto done;
else
default:
/* Unknown/unsupported algorithm */
- crp->crp_etype = EINVAL;
+ err = EINVAL;
goto done;
}
}
done:
- return 0;
+ return err;
}
/*