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

Function swcr_auth_supported

freebsd/opencrypto/cryptosoft.c:1174–1225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1172}
1173
1174static bool
1175swcr_auth_supported(const struct crypto_session_params *csp)
1176{
1177 struct auth_hash *axf;
1178
1179 axf = crypto_auth_hash(csp);
1180 if (axf == NULL)
1181 return (false);
1182 switch (csp->csp_auth_alg) {
1183 case CRYPTO_SHA1_HMAC:
1184 case CRYPTO_SHA2_224_HMAC:
1185 case CRYPTO_SHA2_256_HMAC:
1186 case CRYPTO_SHA2_384_HMAC:
1187 case CRYPTO_SHA2_512_HMAC:
1188 case CRYPTO_NULL_HMAC:
1189 case CRYPTO_RIPEMD160_HMAC:
1190 break;
1191 case CRYPTO_AES_NIST_GMAC:
1192 switch (csp->csp_auth_klen * 8) {
1193 case 128:
1194 case 192:
1195 case 256:
1196 break;
1197 default:
1198 return (false);
1199 }
1200 if (csp->csp_auth_key == NULL)
1201 return (false);
1202 if (csp->csp_ivlen != AES_GCM_IV_LEN)
1203 return (false);
1204 break;
1205 case CRYPTO_POLY1305:
1206 if (csp->csp_auth_klen != POLY1305_KEY_LEN)
1207 return (false);
1208 break;
1209 case CRYPTO_AES_CCM_CBC_MAC:
1210 switch (csp->csp_auth_klen * 8) {
1211 case 128:
1212 case 192:
1213 case 256:
1214 break;
1215 default:
1216 return (false);
1217 }
1218 if (csp->csp_auth_key == NULL)
1219 return (false);
1220 if (csp->csp_ivlen != AES_CCM_IV_LEN)
1221 return (false);
1222 break;
1223 }
1224 return (true);
1225}
1226
1227static bool
1228swcr_cipher_supported(const struct crypto_session_params *csp)

Callers 1

swcr_probesessionFunction · 0.85

Calls 1

crypto_auth_hashFunction · 0.85

Tested by

no test coverage detected