* HP's strong results trigger tech rally
* Fannie, Freddie shares near two-decade lows
* Energy stocks up, oil edges higher
* Dow, S&P little changed; Nasdaq off 0.3 pct (Updates to late afternoon, changes byline)
By Steven C. Johnson
NEW YORK, Aug 20 (Reuters) - U.S. stocks were little changed on Wednesday as investors' fear of a government bailout for Fannie Mae and Freddie Mac pushed their shares lower, offsetting gains by tech companies on strong results from Hewlett-Packard Co <HPQ.N>.
Shares of Fannie Mae <FNM.N> and Freddie Mac <FRE.N> plunged to their lowest levels in nearly two decades as speculation increased that the government would bail out the home finance firms, wiping out the holdings of existing shareholders.
Fannie Mae, the biggest U.S. provider of housing finance, fell 30.4 percent to $4.17, while Freddie Mac's shares tumbled 27.6 percent to $3.01.
However, Hewlett-Packard, the world's largest computer and printer maker, was on track for its biggest one-day rise in six months after it said quarterly profit leaped by 14 percent, raising hope that overseas demand would support technology spending even as the U.S. economy slows.
Some Financial stocks rebounded from Tuesday's sell-off even as oil rose 97 cents to $115.50 a barrel <CLc1>, but uncertainty surrounding Fannie and Freddie kept investors on edge.
"There's no question that the current environment is poor." said Rick Meckler, president of investment firm LibertyView in Jersey City, New Jersey.
The Dow Jones industrial average <
> was up 1.22 points, or 0.01 percent, at 11,349.77. The Standard & Poor's 500 Index <.SPX> was down 0.61 point, or 0.05 percent, at 1,266.08. The Nasdaq Composite Index < > was down 6.72 points, or 0.28 percent, at 2,377.64."I guess the government will need to take another step (on Fannie and Freddie)," he added. "The problem is that the bigger the commitment you make, the more people sometimes want to test that commitment. It's going to be an interesting time to see what the government does do."
Shares of HP rose 5.3 percent at $46.00 and were the main boost on both the Dow and S&P 500.
Other technology shares gained. Apple was a top boost to the Nasdaq, rising 0.9 percent to $175.09, while Research In Motion Ltd <RIM.TO> <RIMM.O> gained 3.1 percent to $129.84 after Citigroup reiterated its "buy" rating on stock of the BlackBerry maker.
But anxiety over Fannie and Freddie was the main theme of the day, and investors said the longer the uncertainty persists, the harder it will be for the market to rally.
The Treasury was recently given new powers by Congress to backstop the mortgage finance companies by buying equity in them or providing loans.
On the upside, certain energy shares posted strong gains, supporting the S&P 500. Shares of oil producer and refiner Hess Corp <HES.N> climbed 4.6 percent to $103.02, while ConocoPhillips <COP.N> rose 2.1 percent to $80.89.
Michael Koskuba, portfolio manager and analyst with Victory Capital Management, said investors "are finally recognizing the strong fundamentals that those stocks have despite what the price of oil is on a weekly basis." (Additional reporting by Walter Brandimarte and Ellis Mnyandu; Editing by Kenneth Barry)