That's actually an interesting one - it depends on your jurisdiction. E.g. in all Australian jurisdictions (and quite a few US states), one cannot consent to serious bodily harm. Some jurisdictions allow consent as a defence for "lower" assaults that don't meet the threshold of serious bodily harm. In Australia (I'm not as familiar with other countries), there are usually explicit carve-outs for sports like boxing, but only when under the purview of a licensed boxing authority.
It's not a crime if you both consent.