Yes, the secession of the Confederate states was illegal.
When the question is phrased as in the OP, the answer can seem confusing. It's a negative question: Was there any specific written law against secession? How could secession be illegal in the absence of such a law? The issue becomes much clearer when phrased as the logically equivalent positive question: did the states have a right to secede, prior to the Court's 1869 ruling in Texas v White? The answer is no, they did not.
That's the exact ruling in Texas v White. The Union was:
"of indissoluble unity... When, therefore, Texas became one of the
United States, she entered into an indissoluble relation. All the
obligations of perpetual union, and all the guaranties of republican
government in the Union, attached at once to the State. The act which
consummated her admission into the Union was something more than a
compact; it was the incorporation of a new member into the political
body. And it was final. The union between Texas and the other States
was as complete, as perpetual, and as indissoluble as the union
between the original States."
(emphasis added, obviously)
The Court's ruling was that no state had ever had the right to secede. Therefore secession was always illegal. It's very cut and dried.
Which doesn't mean that it hasn't been argued about, of course. The rest of this post is supplementary discussion.
The position that secession became illegal when (and only when) the Supreme Court issued its ruling in 1869, just doesn't make sense. First, the Supreme Court doesn't MAKE law, it interprets and settles law: so there's a logical flaw in assuming that secession only became illegal when the Court ruled. The Supreme Court is the END of the road of legal action, not the beginning. Second, it's more than a little strange to argue that secession was legal in 1861, when the Court's ruling is that it wasn't. The exact ruling was that the 1861 Texas ordinance of secession was "absolutely null" and "utterly without operation in law," ie illegal.
If you're serious in asking the question, it's important to understand that in the historiography of the Civil War, this position is one of the Southern Apologist arguments. Saying that secession was legal until the Court issued its ruling implies that there was no legal basis for the Court's ruling, ie it's pure judicial fiat. That's a pure Southern Apologist argument. The rest of the logic goes: "secession was not illegal until 1869, therefore secession was LEGAL up until 1869, therefore Lincoln's use of armed force to put down the slaveholders rebellion was illegal." The line of argument is used to paint Lincoln as a criminal, an aggressor, a dictator.
But the Court's ruling in Texas v White did not spring up out of nowhere. Even Buchanan agreed that the states had no right to secede. Buchanan told Congress that the perpetuity of the Union was inherent in the "nature and extent of the powers conferred by the Constitution on the Federal Government. ... These powers embrace the very highest attributes of national sovereignty." (From Buchanan's 4th annual message, available here) It's striking that even Buchanan didn't support the Southern position on this issue.
Perpetuity goes back to the Articles of Confederation. Article 13 explicitly stated "the Union shall be perpetual." The Constitution formed a MORE perfect Union, not a less perfect or less perpetual one – this is the reasoning the Court used in Texas v White, also the argument that Lincoln made in his address to Congress after Ft Sumter.
The words "secession" or "perpetual" do not appear in the Constitution, so you have to reason around what is there and draw some inferences. But the inferences all lead one way. The Constitution says it is the supreme law of the land: there's no room for a state government to suspend or nullify it. Article 4 section 3 says, "no new State shall be formed or erected within the Jurisdiction of any other States without the consent of the Legislatures of the States concerned as well as of the Congress." Congress never consented to the formation of the Confederacy.
Traditionally where the text is ambiguous you dig deeper, looking at what the framers thought. The debates at the Constitutional Convention don't have much to say about it – possibly because the issue was already settled by the "perpetual" nature of the existing Union. There is a letter from Madison to Hamilton on the topic, from the Ratification era. Madison says "a reservation of the right to withdraw... is a conditional ratification... it does not make N. York a member of the New Union... she could not be received on that plan." (Letter to Hamilton, online here)
Buchanan pointed out some pretty strong negative evidence: in the long fight for Constitutional ratification, no one ever tried to persuade reluctant states by arguing that "the moment that any state felt herself aggrieved she might secede from the Union. ... What a crushing argument would this have proved against those who dreaded that the rights of the States would be endangered by the Constitution!" (from his message) The absence of counter-evidence is not the same thing as evidence; but this actually is a strong point. Constitutional ratification was protracted and difficult, with extensive discussion by the leading political minds of the day. They didn't just FORGET to mention a right to withdraw, if one existed.
So the best evidence, both from within the text of the Constitution and from what little the Framers said, suggests that there was no right to secede. I think "suggests" is the right word. You wouldn't call this powerful and conclusive evidence: it doesn't end the discussion. But it does mean that you have to look outside the Constitution and debates for "extra textual" support of a right to secede.
Jefferson Davis' argument was that the states agreed to enter into the US Constitution, so they could decide to leave. But by itself that argument is severely flawed. Either party can opt to stay out of a contract; entering into a contract is voluntary. But once a contract is entered into, it takes BOTH parties to dissolve it. One party can't dissolve a contract unilaterally. To support unilateral secession, Davis invokes what is called "Compact Theory": that the Union is not a national government, but instead a compact of independent sovereigns, like a League of Nations. Nations can unilaterally rescind treaties.
Compact Theory had a long and respectable pedigree in American politics. Jefferson was a proponent. You can see the Court explicitly rejecting Compact Theory in Texas v White, when they write that the Union was "more than a compact." (quoted above) But Compact Theory had already been rejected by the Supreme Court decades earlier. In Chisholm v Georgia (1793) the Court ruled that the Union was established by "the people acting as sovereigns of the whole country," and that the State governments were bound by it. The Court went further in Martin v Hunter's Lessee (1816), ruling that "The Constitution of the United States was ordained and established not by the States in their sovereign capacities, but emphatically, as the preamble of the Constitution declares, by 'the people of the United States.'" McCulloch v Maryland (1819) reiterated this: "It would be difficult to sustain [the] proposition [that] the powers of the general government are delegated by the states, who alone are truly sovereign; and must be exercised in subordination to the states, who alone possess supreme dominion." Rather, the Constitution emanated from the people, NOT as the act of sovereign and independent states.
Compact Theory as a legal justification for secession was dead by 1820 (long before 1861). Compact Theory also ignores ignores the whole larger picture of the 1787 Constitutional Convention, which was convened specifically to replace a loose confederation of sovereign states and weak central government, with a stronger Federal government. This is a structural argument (and a textual one). The government crafted by the Convention just looks more like a nation than it looks like a treaty between nations. The new government had the core powers of a sovereign nation. These were enumerated by Buchanan when he spoke against secession (his message, again): the powers to declare war, raise armies, enter treaties, tax citizens, coin money, regulate trade, rule on its own laws, etc. These powers are more than the European Union (except coinage) or the United Nations have. So from both a legal and a practical sense, Compact Theory just doesn't fly.
Jefferson Davis reached for the 10th Amendment here. If secession is not mentioned or specifically disallowed by the Constitution, then it must be one of the "powers not delegated to the US, nor prohibited to the States;" so the power to secede is reserved to the states. But when the Constitution was drafted, the states did not have the power to secede. The Articles of Confederation were perpetual, explicitly. So secession was not one of the powers the states could delegate or reserve. The only way the states could have retained the right to secede is if they were independent sovereigns – ie under Compact Theory, which the Courts had rejected. So the 10th Amendment doesn't help the secession case.
The states never had a right to secede. The Supreme Court did not rule specifically on it until 1869; but the Court by its very nature operates well behind events. The first secession case appeared before the Court well after secession – that's how it works. In terms of legality, the chief argument for secession (Compact Theory) had been soundly rejected by the Court 40 to 45 years before the Civil War. It's also worth noting that Congress and the President both understood secession to be illegal in 1861. The Supreme Court made it unanimous among the branches in 1869. The states never had a right to secede.
Yes, the secession of the Confederate states was illegal.