/* * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. */ /* * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License * Version 2 or later at the following locations: * * http://www.opensource.org/licenses/gpl-license.html * http://www.gnu.org/copyleft/gpl.html */ /*! * @file fsl_shw_wrap.c * * This file implements Key-Wrap (Black Key) and Key Establishment functions of * the FSL SHW API for the SHW (non-SAHARA) driver. * * This is the Black Key information: * *
BLACK_KEY | = | ICV | T' | LEN | ALG | FLAGS | KEY' |
To Wrap | ||
---|---|---|
T | = | RND()16 |
KEK | = | HASHsha256(T | Ownerid)16 |
KEY' | = | TDEScbc-enc(Key=KEK, Data=KEY, IV=Ownerid) |
ICV | = | HMACsha256 (Key=T, Data=Ownerid | LEN | ALG | FLAGS | KEY')16 |
T' | = | TDESecb-enc (Key=Wrap_Key, IV=Ownerid, Data=T) |
To Unwrap | ||
T | = | TDESecb-dec (Key=Wrap_Key, IV=Ownerid, Data=T') |
ICV | = | HMACsha256 (Key=T, Data=Ownerid | LEN | ALG | FLAGS | KEY')16 |
KEK | = | HASHsha256 (T | Ownerid)16 |
KEY | = | TDEScbc-dec (Key=KEK, Data=KEY', IV=Ownerid) |