| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
This document describes interface components accessing cryptographic h
Top Searches for this datasheetMPC180SWUG/D Rev. 0.1, 2/2003 MPC180 Security Co-Processor Software Reference Guide This document describes interface components accessing cryptographic hardware accelerators provided MPC180 integrated circuit. covers following topics: Topic Section "General Overview" Section "MPC180Init Module" Section "MPC180Pkha Module" Section "MPC180Des Module" Section "MPC180Mdha Module" Section "MPC180Afha Module" Section "MPC180Rng Module" Section "MPC180 Interface Module Porting" Section "IPsec IKE" Section "vxWorks" Page General Overview MPC180Lib Interface Module provides language programming interface accessing cryptographic hardware accelerators provided MPC180. Table shows modules that make MPC180Lib Interface. Table 1-1. MPC180 Programming Interface Module MPC180Init MPC180Pkha MPC180Des MPC180Lib MPC180Mdha MPC180Afha MPC180Rng Function Initialization Interrupt Handling code Public Encryption-ECC Encryption Hash HMAC Compatible Encryption Random Number Generation. More Information This Product, www.freescale.com MPC180 designed work with vxWorks operating system. Detail porting found Section "MPC180 Interface Module Porting." MPC180Init Module shown Table 2-1, MPC180Init module contains initialization routines interrupt service routine (ISR). initialization routines broken into two, used before operating system running (mpc180InitHw) used after operating system running (mpc180InitHw2). routines described sections that follow. Table 2-1. MPC180Init Module Module Routine mpc180InitHw MPC180Init mpc180InitHw2 mpc180Initisr MPC180Init Routines following sections describe functions that used initialize MPC180 hardware. 2.1.1 mpc180InitHw() This function used initialize MPC180 hardware before operating system kernel running. resets MPC180 masks interrupts. void mpc180InitHw Returns: 2.1.2 mpc180InitHw2() This function used initialize MPC180 hardware interface modules after operating system kernel running. creates necessary semaphores connects interrupt routine. void mpc180InitHw2 Returns: 2.1.3 mpc180Int() This function interrupt service routine that services single interrupt line MPC180. determines type interrupt that occurred gives appropriate semaphore. void mpc180Int MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA Returns: MPC180Pkha Module MPC180Pkha module performs many advanced mathematical functions support both public cryptographic algorithms. supported both (polynomial-basis) shown Table 3-1, PKHA software module made three modules. MOTOROLA MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com Table 3-1. MPC180PkhaUtil Module Module Module Routine mpc180PkhaLoadModSize mpc180PkhaReadModSize mpc180PkhaLoadSubReg mpc180PkhaReadSubReg mpc180PkhaUtil mpc180PkhaCopySubReg mpc180PkhaLoadReg mpc180PkhaReadReg mpc180PkhaCopyReg mpc180PkhaClearMemory mpc180PkhaR2 mpc180PkhaRpRN MPC180Pkha mpc180EccMultkPtoQ mpc180EccAddPto mpc180EccDoubleQ mpc180PkhaEcc mpc180EccModularAdd mpc180EccModularSubtract mpc180EccModularMulitply mpc180EccModularMultiply2 mpc180RsaExpA mpc180RsaModularAdd mpc180PkhaRsa mpc180RsaModularSubtract mpc180RsaModularMultiply mpc180RsaModularMultiply2 first these modules, mpc180PkhaUtil, allows users load read large number registers which present chip, set/read modulus size, clear register memory, perform supporting calculations. register functions able load/read bits 16bit digits) from registers full register functions able load/read 2048 bits 16bit digits) from registers addition, supporting calculations performed finding RpRN second these modules, MPC180Ecc, used perform calculations ECC, Elliptic Curve Cryptography. levels calculation performed. first high level performs elliptic curve point multiplication. These point multiplies performed either basis using either projective affine coordinates. second level operations allows application perform elliptic curve point additions point doubles. These operations require that application work projective coordinates, inputs outputs these operations expected Montgomery residue system. These operations used internally point multiplication, provided user, they needed. MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA second level operations allows application perform modular multiplication, addition, subtraction either basis. Notice that module does provide Point Point Double routines that used internally MPC180 perform Point Multiplication, which have extremely limited value application program. third, final, these modules, MPC180Rsa, used perform calculations modular arithmetic (such RSA, DSA, Diffie-Hellman). levels calculation performed: first level high level performs modular exponentiation, second level allows application perform modular multiplication, addition, subtraction. This implemented with functions mpc180RsaModularMultiply(), mpc180RsaModularMultiply2(), mpc180RsaModularAdd mpc180RsaModularSubtract Normally, these full register (512 bits). However, calls support sub-register operations. These provided support Chinese Remainder Theorem (CRT) operations, which often generate intermediate values that must stored later use. using registers, need store retrieve these values from MPC180 memory alleviated. PKHA routines, modSize register specifies maximum size modulus digits. calling mpc180PkhaLoadModSize(). number bits modulus evenly divisible those remaining bits above evenly-divisible number bits constitutes entire block setting modSize concerned. Each routine minimum number digits work with, maximum operations operations. following example mpc180Pkha module performing exponentiation using mpc180Util mpc180Rsa routines: PKHA_NUM number, exponent, modulus, result; modulus_size; exponent_size; mpc180PkhaLoadReg(modulus, PKHA_REGN); mpc180PkhaLoadReg(number, PKHA_REGA); mpc180RsaExpA(exponent, exponent_size, mpc180PkhaReadReg(result, PKHA_REGB); MPC180Pkha Routines following sections describe functions that used read size modulus, load read PKHA registers, copy from PKHA registers another register. 3.1.1 mpc180PkhaLoadModSize() This function used size modulus used calculations. specified number digits modulus. number bits modulus evenly divisible those remaining bits above evenly-divisible number bits constitutes entire 16-bit block setting modSize concerned. Each routine minimum number digits work with, maximum operations operations. STATUS mpc180PkhaLoadModSize MOTOROLA MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com unsigned modSize Returns: ERROR modSize 128. 3.1.2 mpc180PkhaReadModSize() This function used read size modulus (set mpc180PkhaLoadModSize()) used calculations. unsigned mpc180PkhaReadModSize Returns: Current value modSize. 3.1.3 mpc180PkhaLoadSubReg() This function used load MPC180 PKHA registers calculation. value load specified with current modSize parameter specifying number digits value regSel specifies into which registers load number (PKHA_B0 PKHA_B1 PKHA_B2 PKHA_B3 PKHA_A0 PKHA_A1 PKHA_A2 PKHA_A3 PKHA_N0 PKHA_N1 PKHA_N2 PKHA_N3 11). void mpc180PkhaLoadSubReg PKHA_SUBNUM unsigned regSel Returns following: ERROR modSize 3.1.4 mpc180PkhaReadSubReg() This function used read MPC180 PKHA registers obtain result calculation. value read returned with current modSize parameter specifying number 16-bit digits value regSel specifies from which registers read number (PKHA_B0 PKHA_B1 PKHA_B2 PKHA_B3 PKHA_A0 PKHA_A1 PKHA_A2 PKHA_A3 PKHA_N0 PKHA_N1 PKHA_N2 PKHA_N3 11). unsigned mpc180PkhaReadSubReg PKHA_SUBNUM unsigned regSel Returns following: modSize parameter specifying number 16-bit digits value ERROR modSize MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA Freescale Semiconductor, Inc. 3.1.5 mpc180PkhaCopySubReg() This function used copy MPC180 PKHA registers another. current modSize parameter specifies number digits copy. regSrcSel specifies from which registers copy (PKHA_B0 PKHA_B1 PKHA_B2 PKHA_B3 PKHA_A0 PKHA_A1 PKHA_A2 PKHA_A3 PKHA_N0 PKHA_N1 PKHA_N2 PKHA_N3 11), regDestSel specifies destination register. STATUS mpc180PkhaCopySubReg unsigned regSrcSel, unsigned regDestSel Returns following: ERROR modSize 3.1.6 mpc180PkhaLoadReg() This function used load MPC180 PKHA full registers calculation. value load specified with current modSize parameter specifying number 16-bit digits value regSel specifies into which full registers load number (PKHA_B PKHA_A PKHA_N STATUS mpc180PkhaLoadReg PKHA_NUM unsigned regSel Returns: 3.1.7 mpc180PkhaReadReg() This function used read MPC180 PKHA full registers obtain result calculation. value read returned with current modSize parameter specifying number digits value regSel specifies into which full registers load number (PKHA_B PKHA_A PKHA_N unsigned mpc180PkhaReadReg PKHA_NUM unsigned regSel Returns: modSize parameter specifying number 16-bit digits value 3.1.8 mpc180PkhaCopyReg() This function used copy MPC180 PKHA full registers another. current modSize parameter specifies number digits copy. regSrcSel specifies from which full registers copy (PKHA_B PKHA_A PKHA_N regDestSel specifies destination full register. MOTOROLA MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com void mpc180PkhaCopyReg unsigned regSrcSel, unsigned regDestSel Returns: 3.1.9 mpc180PkhaClearMemory() This routine clears memory locations PKHA. This includes RAMs. locations zero. This routine automatically invoked following reset. STATUS mpc180PkhaClearMemory Returns: ERROR response from MPC180. 3.1.10 mpc180PkhaR2() This function used calculate where 216D number digits modulus vector input parameters expected loaded, using mpc180LoadNReg() function, following registers. Parameter (modulus) N0-3 Register NOTE this routine execute, upper bits must output parameters left following registers read with function mpc180ReadBReg(). Parameter B0-3 Register This function works with minimum digits, value modSize should have been previously (with mpc180PkhaLoadModSize) value between 128. STATUS mpc180PkhaR2 Returns following: ERROR following: modSize upper bits modulo response from MPC180 MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA Freescale Semiconductor, Inc. 3.1.11 mpc180PkhaRpRn() This function used calculate where 216D 216E, number 16-bit digits modulus number 16-bit digits modulus input parameters expected loaded, using mpc180LoadNReg() function, following registers. Parameter (prime modulus) N0-3 Register output parameters left following registers read with function mpc180ReadBReg(). Parameter RpRN B0-3 Register pModSize nModSize specify maximum size modulus 16-bit digits. calculation works with minimum digits, value pModSize nModSize should between 128. This function does depend mpc180PkhaLoadModSize load modSize register, uses input parameters instead. modSize register left pModSize specified after execution. STATUS mpc180PkhaRpRn unsigned pModSize, unsigned nModSize Returns following: ERROR following: pModSize pModSize nModSize nModSize (pModSize nModSize) response from MPC180 MPC180PkhaEcc Routines following sections describe functions that perform elliptic curve point multiplication addition, modular addition subtraction, Montgomery Modular Multiplication. 3.2.1 mpc180EccMultkPtoQ() This function performs elliptic curve point multiply where (X1,Y1,Z1). parameter basis specifies point multiply done basis (basis PKHA_F basis (basis PKHA_F2m). MOTOROLA MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com parameter coordinate specifies point multiply done with input parameters projective (coordinate PKHA_PROJ) affine (coordinate PKHA_AFF) coordinates. input parameters expected loaded, using mpc180LoadSubReg function, registers specified table below. Parameter elliptic curve parameter elliptic curve parameter Register (Set automatically coordinate=PKHA_AFF) modulus prime output parameters left following registers read with function mpc180ReadSubReg(). Parameter (when coordinate PKHA_AFF) (when coordinate PKHA_PROJ) Register input numbers expected standard format, Montgomery residue system. When coordinate PKHA_AFF, output consists projective coordinate values Montgomery residue system. these coordinates their affine form, following equations should used along with returned values Z23: Since MPC180 does support inverse function, responsibility host processor find (Z2)-1 (Z3) using available module-n inversion techniques. Once this accomplished, programmer then these values function mpc180EccFpModularMultiply2() calculate required values. input parameter scalar multiplier. point multiply works with minimum modulus size value modSize should have been previously (with mpc180PkhaLoadModSize) between ksize specifies size multiplier 32-bit words. parameter kLswToMsw boolean which specifies ordering words input parameter k.If order words "LSW lowest memory," kLswToMsw should TRUE; order "MSW lowest memory," should FALSE. STATUS mpc180EccMultkPtoQ PKHA_SUBNUM MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA unsigned kSize, unsigned basis, unsigned coordinate, BOOLEAN kLswToMsw Returns following: ERROR following: modSize modSize response from MPC180 3.2.2 mpc180EccAddPtoQ() This function performs elliptic curve point addition where (X1,Y1,Z1), (X3,Y3,Z3) parameter basis specifies point multiply done basis (basis PKHA_F basis (basis PKHA_F2m). input parameters expected loaded, using mpc180LoadSubReg() function, following registers. Parameter Register elliptic curve parameter elliptic curve parameter modulus prime output parameters left following registers read with function mpc180ReadSubReg(). Parameter Register MOTOROLA MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com Parameter Register elliptic curve parameter elliptic curve parameter MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA input/output numbers expected Montgomery residue system, standard format. point multiply works with minimum modulus size value modSize should have been previously (with mpc180PkhaLoadModSize) value between STATUS mpc180EccAddPtoQ unsigned basis Returns following: ERROR following: modSize modSize response from MPC180 3.2.3 mpc180EccDoubleQ() This function performs elliptic curve point addition where (X1,Y1,Z1) (X3,Y3,Z3) parameter basis specifies point multiply done basis (basis PKHA_F basis (basis PKHA_F2m). input parameters expected loaded, using mpc180LoadSubReg function, following registers. Parameter elliptic curve parameter elliptic curve parameter modulus prime Register output parameters left following registers read with function mpc180ReadSubReg(). More Information This Product, www.freescale.com Parameter Register elliptic curve parameter elliptic curve parameter input/output numbers expected Montgomery residue system, standard format. point multiply works with minimum modulus size value modSize should have been previously (with mpc180PkhaLoadModSize) value between STATUS mpc180EccDoubleQ unsigned basis Returns following: ERROR following: modSize modSize response from MPC180 3.2.4 mpc180EccModularAdd This function performs modular addition, with vectors loaded into registers, where both these vectors less than value stored modulus register parameters regAsel (0,1,2,3), regBsel (0,1,2,3), regNsel (0,1,2,3) specify which registers operation. result returned same register input parameter. example, regAsel regBsel regNsel calculation would follows: parameter basis specifies modular addition done basis (basis PKHA_Fp) basis (basis PKHA_F2m). modular addition works with minimum digits, value modSize should have been previously (with mpc180PkhaLoadModSize) value between STATUS mpc180EccModularAdd unsigned regAsel, unsigned regBsel unsigned regNsel, unsigned basis Returns following: MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA ERROR following: modSize modSize response from MPC180 3.2.5 mpc180EccModularSubtract() This function performs modular subtraction, with vectors loaded into registers, where both these vectors less than value stored modulus register parameters regAsel (0,1,2,3), regBsel (0,1,2,3), regNsel (0,1,2,3) specify which registers operation. result returned same register input parameter. example, regAsel regBsel regNsel calculation would follows: parameter basis specifies modular subtraction done basis (basis PKHA_F basis (basis PKHA_F2m). modular subtraction works with minimum value modSize should have been previously (with mpc180PkhaLoadModSize) value between STATUS mpc180EccModularSubtract unsigned regAsel, unsigned regBsel, unsigned regNsel, unsigned basis Returns following: ERROR following: modSize modSize response from MPC180 3.2.6 mpc180EccModularMultiply() This function performs Montgomery Modular Multiplication R-1) with vectors loaded into registers, where both these vectors less than value stored modulus register 216D, where number digits modulus vector. parameters regAsel (0,1,2,3), regBsel (0,1,2,3), regNsel (0,1,2,3) specify which registers operation. result returned same register input parameter. example, regAsel regBsel regNsel calculation would follows: R-1) modular multiplication works with minimum value modSize should have been previously (with mpc180PkhaLoadModSize) between parameter basis specifies modular multiply done basis (basis PKHA_Fp) basis (basis PKHA_F2m). MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA STATUS mpc180EccModularMultiply unsigned regAsel, unsigned regBsel, unsigned regNsel, unsigned basis Returns following: ERROR following: modSize modSize response from MPC180 3.2.7 mpc180EccModularMultiply2() This function performs Montgomery Modular Multiplication. R-2) with vectors loaded into registers, where both these vectors less than value stored modulus register 216D, where number digits modulus vector. parameters regAsel (0,1,2,3), regBsel (0,1,2,3), regNsel (0,1,2,3) specify which registers operation. result returned same register input parameter. example, regAsel regBsel regNsel calculation would follows: R-2) parameter basis specifies modular multiply done basis (basis PKHA_Fp) basis (basis PKHA_F2m). This function ideal working with affine coordinates. After point multiply, this function used exit projective coordinates. example find X/Z2, where (Z2)-1 Montgomery residue system. Loading (Z2)-1 into appropriate operand registers initiating this function would yield which longer Montgomery residue system. modular multiplication works with minimum digits, value modSize should have been previously (with mpc180PkhaLoadModSize) value between STATUS mpc180EccFpModularMultiply2 unsigned regAsel, unsigned regBsel, unsigned regNsel, unsigned basis Returns following: ERROR following: modSize modSize MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA response from MPC180 MPC180PkhaRsa Interface following sections describe functions that perform exponentiation input value, modular addition subtraction with vectors, Montgomery Modular Multiplication. 3.3.1 mpc180RsaExpA() This function performs exponentiation input value. mathematical representation R-1)EXP input parameters expected loaded, using mpc180LoadAReg mpc180LoadNReg() functions, following registers. Parameter (modulus) A0-3 N0-3 Register output parameters left following registers read with function mpc180ReadBReg(). Parameter B0-3 Register input register A0-3 should provided Montgomery format. value calculated follows: R-1)EXP R-1)EXP parameter exponent, expSize size exponent 32-bit words (1-64). parameter expLswToMsw boolean which specifies ordering words input parameter exp. order words "LSW lowest memory," expLswToMsw should TRUE; otherwise, order "MSW lowest memory," should FALSE.The exponentiation works with minimum digits, value modSize should have been previously (with mpc180PkhaLoadModSize) value between 128. STATUS mpc180RsaExpA PKHA_NUM exp, unsigned exposes, BOOLEAN expLswToMsw Returns following: ERROR following: modSize response from MPC180 MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA Freescale Semiconductor, Inc. 3.3.2 mpc180RsaModularMultiply() This function performs Montgomery Modular Multiplication with vectors loaded into registers, where both these vectors less than value stored modulus register 216D, where number digits modulus vector. result returned register. parameters regAsel (0,1,2,3), regBsel (0,1,2,3), regNsel (0,1,2,3) specify which registers operation. result returned same register input parameter. Normally, these parameters size parameters. However, operations such Chinese Remainder Theorem, they other values. example, regAsel regBsel regNsel calculation would follows: R-1) This routine used messages into Montgomery format. modular multiplication works with minimum digits value modSize should have been previously (with mpc180PkhaLoadModSize) value between 128. STATUS mpc180RsaModularMultiply unsigned regAsel, unsigned regBsel, unsigned regNsel Returns following: ERROR following: modSize response from MPC180 3.3.3 mpc180RsaModularMultiply2() This function performs Montgomery Modular Multiplication with vectors loaded into registers, where both these vectors less than value stored modulus register 216D, where number digits modulus vector. result returned register. parameters regAsel (0,1,2,3), regBsel (0,1,2,3), regNsel (0,1,2,3) specify which registers operation. result returned same register input parameter. Normally, these parameters size parameters. However, operations such Chinese Remainder Theorem, they other values. example, regAsel regBsel regNsel calculation would follows: R-1) This routine used take messages Montgomery format. modular multiplication works with minimum digits value modSize should have been previously (with mpc180PkhaLoadModSize) value between 128. STATUS mpc180RsaModularMultiply2 MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA unsigned regAsel, unsigned regBsel, unsigned regNsel Returns following: ERROR modSize response from MPC180 3.3.4 mpc180RsaModularAdd() This function performs modular addition with vectors loaded into registers, where both these vectors less than value stored modulus register result returned register parameters regAsel (0,1,2,3), regBsel (0,1,2,3), regNsel (0,1,2,3) specify which registers operation. result returned same register input parameter. Normally, these parameters size parameters. However, operations such Chinese Remainder Theorem, they other values. example, regAsel regBsel regNsel calculation would follows: modular addition works with minimum digits value modSize should have been previously (with mpc180PkhaLoadModSize) value between 128. STATUS mpc180RsaModularAdd unsigned regAsel, unsigned regBsel, unsigned regNsel Returns: ERROR modSize response from MPC180. 3.3.5 mpc180RsaModularSubtract() This function performs modular subtraction with vectors loaded into registers, where both these vectors less than value stored modulus register result returned register. parameters regAsel (0,1,2,3), regBsel (0,1,2,3), regNsel (0,1,2,3) specify which registers operation. result returned same register input parameter. Normally, these parameters size parameters. However, operations such Chinese Remainder Theorem, they other values. example, regAsel regBsel regNsel calculation would follows: modular subtraction works with minimum digits value modSize should have been previously (with mpc180PkhaLoadModSize) value between 128. MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA STATUS mpc180RsaModularSubtract unsigned regAsel, unsigned regBsel, unsigned regNsel Returns: ERROR modSize response from MPC180. MPC180Des Module MPC180Des module performs high-speed encryption decryption using algorithm. also supports three Triple-DES encryption/decryption. used both Electronic Code Book (ECB) Cipher Block Chaining (CBC) modes operation. This module uses MPC180 chip's FIFO mode transfer data encryption/decryption. Table 4-1. MPC180Des Module Module Routine mpc180DesEcb mpc1803DesEcb MPC180Des mpc180DesCbc mpc1803DesCbc MPC180Des Routines following sections describe functions that encrypt decrypt buffer. 4.1.1 mpc180DesEcb() algorithm mode, together with bits key, used encrypt decrypt buffer (inBuff) bytes returns result outBuff. encrypt true, function will encrypt data; otherwise, will decrypt data. STATUS mpc180DesEcb unsigned long key[2], unsigned long *inBuff, unsigned len, unsigned long *outBuff, BOOLEAN encrypt Returns following: ERROR following: response from MPC180 multiple block size MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA Freescale Semiconductor, Inc. 4.1.2 mpc1803DesEcb Triple algorithm mode, together with three 64-bit keys key, used encrypt decrypt buffer (inBuff) bytes returns result outBuff. encrypt true, function will encrypt data; otherwise will decrypt data. STATUS mpc1803DesEcb unsigned long key[3][2], unsigned long *inBuff, unsigned len, unsigned long *outBuff, BOOLEAN encrypt Returns following: ERROR following: response from MPC180 multiple block size 4.1.3 mpc180DesCbc algorithm mode, together with bits bits initialization vector used encrypt decrypt buffer (inBuff) bytes. returns result outBuff. encrypt true, then function will encrypt data; otherwise will decrypt data. STATUS mpc180DesCbc unsigned long key[2], unsigned long iv[2], unsigned long *inBuff, unsigned len, unsigned long *outBuff, BOOLEAN encrypt Returns following: ERROR following: response from MPC180 multiple block size 4.1.4 mpc1803DesCbc Triple algorithm mode, together with three 64-bit keys bits initialization vector used encrypt decrypt buffer (inBuff) bytes. returns result outBuff. encrypt true, then function will encrypt data; otherwise will decrypt data. STATUS mpc1803DesCbc MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA unsigned long key[3][2], unsigned long iv[2], unsigned long *inBuff, unsigned len, unsigned long *outBuff, BOOLEAN encrypt Returns following: ERROR following: response from MPC180 multiple block size MPC180Mdha Module MPC180Mdha module capable performing SHA-1, MD4, MD5, three most popular public Message Digest algorithms. also cable generating HMAC specified 2104. HMAC built upon hash functions supported MPC180Mdha. Table 5-1. MPC180Mdha Module Module Routine mpc180MdhaHash mpc180MdhaHmac mpc180MdhaHashInit MPC180Mdha mpc1803MdhaHmacInit mpc1803MdhaUpdate mpc1803MdhaFinal interfaces MPC180Mdha broken into groups. first intended process complete messages through hash HMAC. This accomplished calling mpc180Hash() mpc180Hmac(). This type sequence illustrated following: unsigned char *myMsg "This message hashed."; unsigned char digest[4]; mpc180Hash(MDHA_MD5, myMsg, strlen(myMsg), digest); second interface used when message hashed HMACed presented chunks. This accomplished calling mpc180HashInit() mpc180HmacInit() start hash, mpc180MdhaUpdate() hash chunk, mpc180MdhaFinal() finish hash store digest. This type sequence illustrated following: unsigned unsigned unsigned unsigned unsigned char char char char char *myMsg1 "This message hashed."; *myMsg2 "And comes several parts."; *myMsg3 "Which must hashed separately."; *key "AbCdEfG"; digest[4]; MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA MDHA_CTX *context; context (MDHA_CTX malloc(sizeof(MDHA_CTX)); mpc180HmacInit(MDHA_MD5, context, FALSE, mpc180MdhaUpdate(myMsg1, strlen(myMsg1), mpc180MdhaUpdate(myMsg2, strlen(myMsg2), mpc180MdhaUpdate(myMsg2, strlen(myMsg2), mpc180MdhaFinal(digest, context); key, NULL); context); context); context); second interface also used precomputation step, same going used many HMAC calculations. this, routine called with context NULL precalc FALSE, which will hash key, return partial result *digest. Then, initialize HMAC with precomputed digest, call routine again with context NULL, precalc TRUE, precomputed digest *digest. Note, key, keyLen must still provided this call, they used HMAC calculation sequence mpc180MdhaFinal()).This sequence, shown following code, will save time over previous one, same reused many times: unsigned char *myMsg1 "This message hashed."; unsigned char *myMsg2 "And comes several parts."; unsigned char *myMsg3 "Which must hashed separately."; unsigned char *key "AbCdEfG"; unsigned char preDigest[4]; unsigned char digest[4]; MDHA_CTX *context; context (MDHA_CTX malloc(sizeof(MDHA_CTX)); mpc180HmacInit(MDHA_MD5, NULL, FALSE, key, preDigest); mpc180HmacInit(MDHA_MD5, context, TRUE, key, preDigest); mpc180MdhaUpdate(myMsg1, strlen(myMsg1), context); mpc180MdhaUpdate(myMsg2, strlen(myMsg2), context); mpc180MdhaUpdate(myMsg2, strlen(myMsg2), context); mpc180MdhaFinal(digest, context); MPC180Mdha Routines following section describe functions that compute message digest authentication, initialize context structure used hashing. 5.1.1 mpc180MdhaHash() Compute message digest bytes stored inBuff place digest. parameter algorithm specifies which hashing algorithm (algorithm MDHA_MD4, MDHA_MD5, MDHA_SHA1). digest buffer must able hold bytes bytes SHA-1. STATUS mpc180MdhaHash unsigned algorithm, unsigned char *inBuff, unsigned len, MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA unsigned char *digest Returns: ERROR response from MPC180. 5.1.2 mpc180MdhaHmac() Computes message authentication code bytes inBuff using respective hash function (MD4, MD5, SHA-1) which keyLen bytes long. code stored code buffer digest, which must able hold bytes bytes SHA-1. parameter algorithm specifies which hashing algorithm (algorithm MDHA_MD4, MDHA_MD5, MDHA_SHA1). STATUS mpc180MdhaHmac unsigned alogorithm unsigned char *key, unsigned keyLen, unsigned char *inBuff, unsigned len, unsigned char *digest Returns: ERROR response from MPC180. 5.1.3 mpc180MdhaHashInit Initializes context structure used hashing message parts. structure *context should pre-allocated. parameter algorithm specifies which hashing algorithm (algorithm MDHA_MD4, MDHA_MD5, MDHA_SHA1). void mpc180HashInit unsigned alogorithm, MDHA_CTX *context Returns: 5.1.4 mpc180MdhaHmacInit Initializes context structure used computing HMAC message parts. structure *context should pre-allocated. parameter algorithm specifies which hashing algorithm (algorithm MDHA_MD4, MDHA_MD5, MDHA_SHA1). used keyLen bytes long. This routine also used precalculate partial digest that reused many times. this, routine called with context NULL precalc FALSE, which will hash return partial result *digest. Then, initialize HMAC with precomputed digest, call routine again with context NULL, precalc TRUE, precomputed digest *digest. Note, keyLen must still provided this call, they used HMAC calculation sequence mpc180MdhaFinal()). NOTE context NULL precalc FALSE, then digest ignored, NULL. MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA STATUS mpc180HmacInit unsigned alogorithm, MDHA_CTX *context BOOLEAN precalc, unsigned char *key, unsigned keyLen, const unsigned char *digest Returns: ERROR response from MPC180. 5.1.5 mpc180MdhaUpdate() This function called repeatedly with chunks message data hashed. data hashed bytes inBuff, with hash context context used. digest computed using hashing algorithm that selected when either mpc180MdhHashInit() mpc180MdhaHmacInit() called this context. STATUS mpc180HashUpdate MDHA_CTX *context, const unsigned char *inBuff, unsigned Returns: ERROR response from MPC180. 5.1.6 mpc180MdhaFinal() Places completed message digest digest, which must able hold bytes data algorithms, bytes data SHA-1 algorithm. also erases hash context structure *context. digest computed using hashing algorithm that selected when either mpc180MdhHashInit() mpc180MdhaHmacInit() called this context. STATUS mpc180HashFinal unsigned char *digest, MDHA_CTX *context Returns: ERROR response from MPC180. MPC180Afha Module AFHA Module accelerates algorithm compatible with stream cipher from Security, Inc. algorithm byte oriented, therefore byte plaintext encrypted with produce byte ciphertext. variable length, MPC180Afha supports keys ranging from bits bits. MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA Table 6-1. MPCAfha Module Module MPC180Afha mpc180AfhaProcess Routine mpc180AfhaSetKey MPC180Afha module used making call encryption/decryption sequence, calling process function process sequential encryption/decryption blocks. This illustrated following code segment: unsigned char *myKey "AbCdE"; unsigned char *block1 "Now time unsigned char *block2 "for every unsigned char *encryptBlock1; unsigned char *encryptBlock2; AFHA_CTX *context; context (AFHA_CTX malloc(sizeof(AFHA_CTX)); mpc180AfhaSetKey(myKey, context); encryptBlock1 malloc(strlen(block1)); encryptBlock2 malloc(strlen(block2)); mpc180AfhaProcess(block1, strlen(block1), encryptBlock1,context); mpc180AfhaProcess(block2, strlen(block2), encryptBlock2,context); MPC180Afha module also able support encryption context switching, where encryption/decryption sequence temporarily suspended allow encryption another message with different key. encryption context switch done automatically calling mpc180AfhaSetKey() mpc180AfhaProcess() second third, etc.) data. Note, however, that context switch time quite large large amount data must transferred to/from MPC180 perform context switch. This sequence operations illustrated following code segment: unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned AFHA_CTX AFHA_CTX context1 context2 char *myKey1 "AbCdE"; char *myKey2 "FgHiJk"; char *block11 "Now time char *block12 "for every char *block21 "Four score char *block22 "twenty years char *encryptBlock11; char *encryptBlock12; char *encryptBlock21; char *encryptBlock22; *context; *context2; (AFHA_CTX malloc(sizeof(AFHA_CTX)); (AFHA_CTX malloc(sizeof(AFHA_CTX); mpc180AfhaSetKey(myKey1, context1); encryptBlock1 malloc(strlen(block1)); mpc180AfhaProcess(block11, strlen(block11), encryptBlock11,context1); mpc180AfhaSetKey(myKey2, context2); MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA encryptBlock21 malloc(strlen(block21)); mpc180AfhaProcess(block21, strlen(block21), encryptBlock21, context2); encryptBlock22 malloc(strlen(block22)); mpc180AfhaProcess(block22, strlen(block22), encryptBlock22, context2); encryptBlock12 malloc(strlen(block12)); mpc180AfhaProcess(block12, strlen(block12), encryptBlock12, context1); MPC180Afha Routines following sections describe different functional routines that allow context switching, encrypting decrypting. 6.1.1 mpc180AfhaSetKey() Sets AFHA use, using keyLen bytes long key. Valid values keyLen between context structure pointer that passed allow context switches occur. parameter, doNotSaveContext TRUE, AFHA context which MPC180 currently processing will saved, context will invalidated. STATUS mpc180AfhaSetKey unsigned char *key, unsigned keyLen, AFHA_CTX *context, BOOLEAN doNotSaveContext Returns following: ERROR following: response from MPC180 6.1.2 mpc180AfhaProcess() bytes data inBuff encrypted decrypted using (from mpc180AfhaSetKey()). results stored outBuff. MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA STATUS mpc180AfhaProcess unsigned char *inBuff, unsigned len, unsigned char *outBuff, AFHA_CTX *context Returns: ERROR response from MPC180. MPC180Rng Module MPC180Rng module provides application software with method generating 32-bit random numbers. There interfaces provided, provide random number, second provide block random numbers. single random number interface uses MPC180 Open Address mode, while block random number interface employees FIFO mode DMA. Table MPC180Rng Module Module mpc180Rand MPC180Rng mpc180RandLongs Routine MPC180Rng Routines following sections describe functions that generate 32-bit random numbers store them buffer. 7.1.1 mpc180Rand() This routine generates random number. unsigned long mpc180Rand Returns: 32-bit random number 7.1.2 mpc180RandLongs() This routine generates 32-bit random numbers stores them buff. STATUS mpc180Rand unsigned long *buff, unsigned Returns: ERROR response from MPC180. MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA MPC180 Interface Module Porting following sections describe main operating system specific concept semaphores, required files interface module code, configuration interface modules, external variables functions. Include Files interface module code uses file vxWorks.h. This includes standard vxWorks type includes. Using this code another system will require redefining those types that system. example, type UINT32 should defined 32-bit unsigned integer your target system. addition, semaphore mechanism (described Section 8.2), file semLib.h included, provide definitions semaphore type (SEM_ID) semaphore function calls. This will need replaced appropriate files depending communication mechanism used port. Several drivers also ANSI standard string functions specified string.h. Semaphores main operating system specific concepts used code types semaphores. first these mpc180Mutex, which used make sure that only task able MPC180 time. There three calls involved with this semaphore: semMCreate(mpc180Mutex.-This call creates semaphore later use. semTake(mpc180Mutex, WAIT_FOREVER)-This call takes semaphore, preventing another task from using MPC180. semGive(mpc180Mutex)-This call gives semaphore, allowing another task MPC180. second type semaphores Binary Semaphores that used communication between interrupt service routine main line routines. other multitasking operating systems, these calls should replaced with appropriate semaphore calls specific operating system. single threaded system multitasking OS), Mutex necessary, Binary Semaphore mechanism replaced setting clearing global flags. semaphores used code follows: SEM_ID SEM_ID SEM_ID SEM_ID SEM_ID SEM_ID SEM_ID SEM_ID SEM_ID SEM_ID mpc180Mutex; mpc180PkhaDoneSemaphore; mpc180PkhaErdySemaphore; mpc180DesDoneSemaphore; mpc180AfhaInitSemaphore; mpc180AfhaPermuteSemaphore; mpc180AfhaFullMessageSemaphore; mpc180AfhaSubMessageSemaphore; mpc180MdhaSemaphore; mpc180IdmaOutSemaphore; There three calls involved with these semaphores: semBCreate-This call creates semaphore later use. semTake-This call used mainline code wait semaphore given Interrupt Service Routine. usually timeout associated with semGive-This call gives semaphore from ISR, allowing mainline task continue. MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA Also note, user chaining several PKHA operations higher level arithmetic function, they should "mpc180 Mutex" higher level functions prevent another task from disturbing state PKHA registers between level function calls. Conditional Compilation Three configurations interface modules built: Processor Transfer Data MPC180, MPC180 byte swapping. this configuration, processor transfers data from MPC180's FIFO buffers, controller. addition, byte swapping required algorithms performed switching MPC180 endian means externally provided function (see section 8.4). this configuration, macro definitions necessary. Transfer Data MPC180, MPC180 byte swapping This works same configuration except this case, 8260 engine used transfer data to/from MPC180. required macros this configuration are: #define INCLUDE_MPC180_DMA Processor Transfer Data MPC180, Processor byte swapping. This same configuration however, processor performs byte swapping software, external endian function should provided. required macros this configuration are: #define INCLUDE_MPC180_SW_BYTE_SWAP NOTE macros options must defined same time because drivers will perform required functions they are. Required Externals MPC180 interface modules require three external variables (shown Table 8-1) three external functions. Table 8-1. External Variables Required MPC180 Interface External variable code extern const UINT32 MPC180_BASE_ADRS; extern const MPC180_INPUT_DMA_CHANNEL; Definition Specifies base address MPC180 memory. Specifies which channel used transfer data MPC180. extern const MPC180_OUTPUT_DMA_CHANNEL; Specifies which channel used transfer data MPC180. first three required external functions follows: void sysMpc180Endian(int endian) where endian either MPC180_BIG_ENDIAN MPC180_LITTLE_ENDIAN This function used change state MPC180 Endian dependent hardware. reference design, this tied Parallel Port both MPC8260 MPC860. function following form: void sysMpc180Endian endian MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA immrVal vxImmrGet() (endian MPC180_BIG_ENDIAN) *PDATA( immrVal PA1; endian else *PDATA( immrVal ~PA1; little endian other required external functions calls drivers start transfers. They have following prototypes: void ppc8260IdmaStart(int channel, unsigned char *source, unsigned char *destination, UINT32 size, BOOL interrupt, direction); void ppc8260IdmaChainStart(int channel, unsigned char *source1, unsigned char *source2, unsigned char *destination, UINT32 size1, UINT32 size2, BOOL interrupt); IPsec This section describes MPC180 functionality with Wind River's modifications WindNetIPsec WindNet (these modifications shown user's guide base WindNet IPsec WindNet products). These release notes support Wind River's modifications WindNet IPsec WindNet products allow MPC180 Security Processor with these products. user's guide base WindNet IPsec WindNet products which describes functionality unchanged these modifications. information drivers used these modifications, consult mpc180 Interface Library Guide. NOTE Forward slashes used pathname delimiters both UNIX Windows filenames since this default vxWorks. Installation installation instructions base WindNet IPsec WindNet products should followed stated release notes those products. However, before these products built shown section 2.3.2 2.4.2 IPsec/IKE release notes), modifications MPC180 should installed. IPsec products have been built already, current build should deleted described IPsec/IKE release notes. Also, MPC180 Interface Modules must installed prior building IPsec/IKE. MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA install modifications MPC180, extract file containing modifications (ipsec_ike_mpc180.zip) into Tornado installation directory. Once modifications installed, WindNet IPSec WindNet built used their installation instructions. Distribution Archive this release, distribution archive consists source files listed this section. Note that file paths relative installDir/target/. WNCrypto Files src/wrn/wncrypto/openssl/sha.h vxWorks following sections describe installation MPC180 interface modules, integration, distribution archives. 10.1 Introduction These release notes support MPC180 Security Processor Interface Modules with vxWorks. information interface modules (including porting issues), consult MPC180 Interface Library Guide. NOTE Forward slashes used pathname delimiters both UNIX Windows filenames since this default vxWorks. 10.2 Installation install MPC180 Interface Modules, extract file containing source files (mpc180_drivers.zip) into Tornado installation directory. Once modules installed, vxWorks image built following instructions. 10.3 Building Interface Modules Throughout remainder installation instructions, following variables used: Variable cpuFamily toolChain Definition Specifies target family, such PPCEC603 PPC860 Specifies tool, such MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA Follow these instructions build WindNet IPSec. command prompt shell Execute torVars Tornado command line build environment. make directory typing these command lines switches: make cpuFamily TOOL toolChain command line step builds configuration Processor Transfer Data MPC180, MPC180 byte swapping macro definitions). build other configurations following commands should used instead step Transfer Data mpc180, mpc180 byte swapping (#define INCLUDE_MPC180_DMA) make cpuFamily TOOL toolChain Processor Transfer Data mpc180, Processor byte swapping. (#define INCLUDE_MPC180_SW_BYTE_SWAP) make cpuFamily TOOL toolChain SWBYTESWAP 10.4 Integration Once modules built, they integrated with users board support package. 10.5 Distribution Archive this release, distribution archive consists source files listed this section. Note that file paths relative installDir/target/. h/drv/crypto/mpc180.h h/drv/crypto/mpc180Afha.h h/drv/crypto/mpc180Des.h h/drv/crypto/mpc180Dma.h h/drv/crypto/mpc180Init.h h/drv/crypto/mpc180Mdha.h h/drv/crypto/mpc180Pkha.h h/drv/crypto/mpc180Rng.h h/drv/dma/ppc8260Idma.h src/drv/crypto/Makefile src/drv/crypto/mpc180Afha.c src/drv/crypto/mpc180Des.c src/drv/crypto/mpc180Dma.c src/drv/crypto/mpc180Init.c src/drv/crypto/mpc180Mdha.c src/drv/crypto/mpc180Pkha.c src/drv/crypto/mpc180Rng.c MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA MPC180 Security Co-Processor Software Reference Guide More Information This Product, www.freescale.com MOTOROLA REACH USA/EUROPE/LOCATIONS LISTED: Motorola Literature Distribution P.O. 5405, Denver, Colorado 80217 1-303-675-2140 (800) 441-2447 JAPAN: Motorola Japan Ltd. SPS, Technical Information Center 3-20-1, Minami-Azabu Minato-ku Tokyo 106-8573 Japan 81-3-3440-3569 ASIA/PACIFIC: Information this document provided solely enable system software implementers Motorola products. There express implied copyright licenses granted hereunder design fabricate integrated circuits integrated circuits based information this document. Motorola reserves right make changes without further notice products herein. Motorola makes warranty, representation guarantee regarding suitability products particular purpose, does Motorola assume liability arising application product circuit, specifically disclaims liability, including without Motorola Semiconductors H.K. Ltd. Silicon Harbour Centre, King Street Industrial Estate, N.T., Hong Kong 852-26668334 TECHNICAL INFORMATION CENTER: (800) 521-6274 HOME PAGE: www.motorola.com/semiconductors limitation consequential incidental damages. "Typical" parameters which provided Motorola data sheets and/or specifications vary different applications actual performance vary over time. operating parameters, including "Typicals" must validated each customer application customer's technical experts. Motorola does convey license under patent rights rights others. Motorola products designed, intended, authorized components systems intended surgical implant into body, other applications intended support sustain life, other application which failure Motorola product could create situation where personal injury death occur. Should Buyer purchase Motorola products such unintended unauthorized application, Buyer shall indemnify hold Motorola officers, employees, subsidiaries, affiliates, distributors harmless against claims, costs, damages, expenses, reasonable attorney fees arising directly indirectly, claim personal injury death associated with such unintended unauthorized use, even such claim alleges that Motorola negligent regarding design manufacture part. Motorola Stylized Logo registered U.S. Patent Trademark Office. digital trademark Motorola, Inc. other product service names property their respective owners. Motorola, Inc. Equal Opportunity/Affirmative Action Employer. Motorola, Inc. 2003 MPC180SWUG/D More Information This Product, www.freescale.com Other recent searchesTW0149A - TW0149A TW0149A Datasheet NJU6623 - NJU6623 NJU6623 Datasheet MF431 - MF431 MF431 Datasheet DS5470 - DS5470 DS5470 Datasheet MBD-153-AL - MBD-153-AL MBD-153-AL Datasheet LA7321 - LA7321 LA7321 Datasheet 7321M - 7321M 7321M Datasheet CY7C1303AV25 - CY7C1303AV25 CY7C1303AV25 Datasheet CY7C1306AV25 - CY7C1306AV25 CY7C1306AV25 Datasheet 2SK3022 - 2SK3022 2SK3022 Datasheet 2N3439 - 2N3439 2N3439 Datasheet 2N3439L - 2N3439L 2N3439L Datasheet 2N3440 - 2N3440 2N3440 Datasheet 2N3440L - 2N3440L 2N3440L Datasheet
Privacy Policy | Disclaimer |