opencrypto: Add missing ioctl exit SDTs

The opencrypto ioctl code has very useful probe points at the various exit
points. These allow us to figure out exactly why a request failed. However, a
few paths did not have these probe points. Add them here.

Reviewed by:	jhb
This commit is contained in:
Kristof Provost 2020-05-11 21:42:19 +00:00
parent b0084bf6cd
commit 38dc0eac57

View File

@ -465,6 +465,8 @@ cryptof_ioctl(
/* Should always be paired with GCM. */ /* Should always be paired with GCM. */
if (sop->cipher != CRYPTO_AES_NIST_GCM_16) { if (sop->cipher != CRYPTO_AES_NIST_GCM_16) {
CRYPTDEB("GMAC without GCM"); CRYPTDEB("GMAC without GCM");
SDT_PROBE1(opencrypto, dev, ioctl, error,
__LINE__);
return (EINVAL); return (EINVAL);
} }
break; break;
@ -539,8 +541,10 @@ cryptof_ioctl(
return (EINVAL); return (EINVAL);
} }
if (txform == NULL && thash == NULL) if (txform == NULL && thash == NULL) {
SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
return (EINVAL); return (EINVAL);
}
memset(&csp, 0, sizeof(csp)); memset(&csp, 0, sizeof(csp));
@ -550,13 +554,18 @@ cryptof_ioctl(
case CRYPTO_AES_128_NIST_GMAC: case CRYPTO_AES_128_NIST_GMAC:
case CRYPTO_AES_192_NIST_GMAC: case CRYPTO_AES_192_NIST_GMAC:
case CRYPTO_AES_256_NIST_GMAC: case CRYPTO_AES_256_NIST_GMAC:
if (sop->keylen != sop->mackeylen) if (sop->keylen != sop->mackeylen) {
SDT_PROBE1(opencrypto, dev, ioctl,
error, __LINE__);
return (EINVAL); return (EINVAL);
}
break; break;
#endif #endif
case 0: case 0:
break; break;
default: default:
SDT_PROBE1(opencrypto, dev, ioctl, error,
__LINE__);
return (EINVAL); return (EINVAL);
} }
csp.csp_mode = CSP_MODE_AEAD; csp.csp_mode = CSP_MODE_AEAD;
@ -564,14 +573,19 @@ cryptof_ioctl(
switch (sop->mac) { switch (sop->mac) {
#ifdef COMPAT_FREEBSD12 #ifdef COMPAT_FREEBSD12
case CRYPTO_AES_CCM_CBC_MAC: case CRYPTO_AES_CCM_CBC_MAC:
if (sop->keylen != sop->mackeylen) if (sop->keylen != sop->mackeylen) {
SDT_PROBE1(opencrypto, dev, ioctl,
error, __LINE__);
return (EINVAL); return (EINVAL);
}
thash = NULL; thash = NULL;
break; break;
#endif #endif
case 0: case 0:
break; break;
default: default:
SDT_PROBE1(opencrypto, dev, ioctl, error,
__LINE__);
return (EINVAL); return (EINVAL);
} }
csp.csp_mode = CSP_MODE_AEAD; csp.csp_mode = CSP_MODE_AEAD;