Just wanted to state in addendum to all the comments and answers already given, magnesium chloride, calcium chloride, and calcium sulfate are all classified as GRAS (Generally Recognized As Safe) per the FDA.
EDIT:
After coming back to read the comments from the OP, I decided to elaborate a bit on the process in the interest of demystifying how industry goes about insuring the safety of food processes involved for foods like tofu.
First of all, a bit of the fundamentals and clarification on terminologies: what is "harm"? We define harm as any unintended, adverse health impact that results from the ingestion of foods containing hazards; and likewise, we define "hazards" as the unintended presence of potentially harmful elements or substances. These hazards are traditionally grouped into three major categories: physical, chemical, and biological (note: radiological and allergenic hazards have been consolidated under the chemical hazards category post-FSMA). The sciences and disciplines involved with the prevention, reduction, and control of such hazards as what is known as food safety, and just like any other branch of science, there are systematic, evidence-based methodologies deployed in the interest of mitigating aforementioned hazards. Of the existent systems, the USDA and FDA in particular enforce what is known as Hazard Analysis and Critical Control Points (HACCP) — and in more recent years in light of the Food Safety Modernization Act (FSMA), we now incorporate the more robust Hazard Analysis and Risk-based Preventative Controls (HARPC). In short, the principles and practices in these sets of methodologies allow us to quantify health hazards, and once quantified, we are able to manage undesirable outcomes based upon principles of risk management. And what is "risk"? We define risk as the product of likelihood and harm. Employing such principles, each and every individual processing step (and beyond) is analyzed and potential hazards are systematically addressed. This is enforced on the federal, local, and most of all, the retail spaces; surprising as it may seem, the driving force of food safety in the past few decades has in fact been the major retailers and international consortiums. Why? Because food recalls cost money, it's as simple as that.
This is a very gross generalization of how food safety fits into todays industries, but at least to the average laymen I hope that helps shed some light on how things work.