PARIS (Reuters) - Aerospace and defense group Thales has agreed to buy chipmaker Gemalto for 4.8 billion euros ($5.6 billion), trumping an earlier bid by fellow French firm Atos to expand in the fast-growing digital security market.