What if the Germans had realised that their security had been compromised, and that Enigma was not secure? If they had tightened up their security to the degree that Bletchley Park could no longer decrypt their transmissions, what would the effect have been on the war's outcome? Would the U-boat campaign would have been dramatically more successful for example?
There were several possibilities for this.
It is not widely realized that French intelligence was a full partner with Britain in breaking Enigma in 1939-1940. In fact, the initial Polish break into Enigma was enabled when a French spy (Bertrand) obtained a complete set of Enigma documents (message formats, comm procedures, and some ciphertext/cleartext sets). His French colleagues weren't interested, so he passed them to the Poles. When Poland fell in 1939, the Polish codebreakers escaped to France, and went to work under Bertrand's command. At this time, German upgrades had secured Enigma, but the Franco-Poles and British were working on a new break, which came (as expected) in early 1940.
Then France fell. Fortunately, the codebreaking site was cleared of all papers before the Germans got there. The Poles escaped to Algeria.
Bertrand and his superiors in French intelligence stayed in France, remaining with the Vichy government. The Poles were brought back to southern France and resumed work - on the Vichy payroll! So for the next two years, the Vichy regime, which was regarded as a German satellite or puppet, and which was in combat with the Allies several times, had the Enigma secret but kept it from the Germans. (Though of course, I'm sure the spooks never told Petain or Laval about it.) Obviously, it could have been leaked at any time.
Then after TORCH, when Germany occupied southern France, the Poles again had to flee. No documents were left, but at least one of the Poles was picked up by the Germans. He passed himself off as an ordinary soldier, and was released. Another close call.
Finally, there was the possibility that the Germans would spot Enigma's vulnerabilties on their own. Gordon Welchman was one of the most important theorists at Bletchley Park. (He worked on techniques for code-breaking and traffic analysis, and helped design and build the famous
bombes.) Welchman wrote later about these vulnerabilities, some of which were gross negligence by the Germans. He believed that a decent skeptical review of Enigma and German procedures (as specified and in practice) would have spotted most of them, and that without these German mistakes, Enigma would have been unbreakable. His conclusion was stark: "We were lucky."
Let's start with the worst-case possibility: a trove of documents is left behind in 1940 when the Poles evacuate the first time.
The effects start very soon. I have heard contradictory statements about Enigma in the Battle of Britain, but I find it hard to believe that it was
not valuable to Fighter Command. In particular, Luftwaffe Enigma was broken early and thoroughly, and thus throughout the BoB, the British read the daily status reports from LW bases - numbers of planes and pilots in service, readiness and repair state. In reacting to German attacks and feints, it had to be valuable to know what strength the Germans actually had. (The extent of Luftwaffe decryption was immense. The British filed and cross filed everything they learned. It's been said that by 1944, the men who knew the most about the Luftwaffe were all in England.)
Perhaps more critical was the effect on the Battle of the Atlantic. Doenitz' wolfpack tactic depended on frequent communication between U-boats at sea and their HQ on shore. HQ would position U-boats in a picket line to detect a convoy. The spotter would report the convoy to HQ. HQ would then direct all the U-boats in the group to gather ahead of the convoy. Then the next night, the U-boats would attack the convoy en masse, overwhelming its escorts.
In late 1940 and early 1941, the U-boats sank a lot of British shipping. In mid-1941, the British captured much naval Enigma material, and broke the naval key. This allowed the Admiralty to move convoys around the U-boat picket lines. Losses dropped by 2/3. In February 1942, the U-boats switched to an enhanced Enigma for their use only. It was not broken for 10 months, and those were the worst of the war. A brief outage in early 1943 led to another spike in sinkings; and the U-boats were finally beaten in mid-1943 - by escort carriers, improved sonar, long-range aircraft, and more escorts.
If Enigma is secure, losses never drop in 1941. They are even worse in 1942 - U-boat operational Enigma was secure, but the British still read the traffic of the coastal forces, which escorted U-boats to and from bases. They continue bad through 1943. OTL the US shifted construction from landing craft to escort vessels late in the campaign, just before the battle was won, then had to shift back to get enough landing craft for D-Day.
If Enigma is secure, millions of tons of supplies don't even get to Europe, and the Allies have to build even more escorts. This could delay D-Day by several months.
Another area is the Mediterranean. Enigma decrypts allowed the scanty British forces at Malta to intercept a lot of Axis ships bringing supplies to North Africa. Without this advantage, the Panzer Armee Africa would be larger and better supplied. The North African campaign would be much longer and harder.
A final point: the British read the Enigma traffic from Abwehr outstations in France and Spain to Berlin. These outstations handled German spy operations in Britain. The success of the famous "Double-Cross" system was greatly assisted by the British reading the Germans' own reports, so they
knew what the Germans actually believed or suspected about their agents.