aboutsummaryrefslogtreecommitdiff
path: root/drivers/crypto/caam/ctrl.c
AgeCommit message (Collapse)AuthorFilesLines
2013-09-13crypto: caam - fix RNG4 AAI definesAlex Porosanu1-1/+1
RNG4 defines in desc.h were incomplete (bits AI & PS were missing), while SK was set as an ALG related bit. This patchs adds the missing bits and corrects the SK bit. Signed-off-by: Alex Porosanu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2013-09-13crypto: caam - uninstantiate RNG state handle 0 if instantiated by caam driverAlex Porosanu1-6/+51
If the caam driver module instantiates the RNG state handle 0, then upon the removal of the module, the RNG state handle is left initialized. This patch takes care of reverting the state of the handle back to its previous uninstantatied state. Signed-off-by: Alex Porosanu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2013-09-13crypto: caam - split RNG4 instantiation functionAlex Porosanu1-48/+92
This patch splits the RNG4 state handle instantiation function into two parts: one that handles the creation of the descriptor which instructs the CAAM to perform the instantiation of the state handle and another function that performs the running of the said descriptor using the DECO debug mechanism. Signed-off-by: Alex Porosanu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2013-09-13crypto: caam - fix RNG4 instantiationAlex Porosanu1-16/+47
The RNG4 block in CAAM needs to be 'seeded' first before being used for generating pseudo-random data. The 'seeding' is done by getting entropy from the TRNG ring oscillator. The RTFRQMAX register controls the maximum allowable number of samples that can be aquired during an entropy sample. Depending on the clock at which the RNG4 block (and for that matter the SEC block) runs, it's possible that a hard-coded value for the maximum frequency is inadequate, i.e. more samples than needed are taken. This is an error, and thus the RNG4 block doesn't get initialized. The patch attempts to alleviate this issue by trying with progressivly larger frequencies, until the number of samples is adequate. This patch also fixes how a descriptor is deemed as being finished: instead of checking the VALID field in the DECO debug register, it makes sure that the DECO is idle, by checking the DECO state field of the said register. Signed-off-by: Alex Porosanu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2013-09-13crypto: caam - fix RNG state handle instantiation descriptorAlex Porosanu1-1/+3
The way the DECO runs a descriptor through the direct (debug) interface is different from the JRI interface: the DECO will continue to try and execute the next commands, after the descriptor buffer has ended. This leads to unpredictable results and possibly to locking up of the DECO. This patch adds a halt command at the end of the descriptor to ensure the DECO halts when it reaches the end of the descriptor buffer. Signed-off-by: Alex Porosanu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2013-08-01crypto: caam - Remove unused functions from Job RingRuchika Gupta1-3/+0
Signed-off-by: Ruchika Gupta <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2013-08-01crypto: caam - RNG instantiation by directly programming DECORuchika Gupta1-38/+36
Remove the dependency of RNG instantiation on Job Ring. Now RNG instantiation for devices with RNG version > 4 is done by directly programming DECO 0. Signed-off-by: Ruchika Gupta <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2013-05-14crypto: caam - FIX RNG init for RNG greater than equal to 4Ruchika Gupta1-3/+7
For SEC including a RNG block version >= 4, special initialization must occur before any descriptor that uses RNG block can be submitted. This initialization is required not only for SEC with version greater than 5.0, but for SEC with RNG version >=4. There may be a case where RNG has already been instantiated by u-boot or boot ROM code.In such SoCs, if RNG is initialized again SEC would returns "Instantiation error". Hence, the initialization status of RNG4 should be also checked before doing RNG init. Signed-off-by: Ruchika Gupta <[email protected]> Signed-off-by: Alex Porosanu <[email protected]> Signed-off-by: Andy Fleming <[email protected]> Reviewed-by: Vakul Garg <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2013-05-02Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6Linus Torvalds1-0/+3
Pull crypto update from Herbert Xu: - XTS mode optimisation for twofish/cast6/camellia/aes on x86 - AVX2/x86_64 implementation for blowfish/twofish/serpent/camellia - SSSE3/AVX/AVX2 optimisations for sha256/sha512 - Added driver for SAHARA2 crypto accelerator - Fix for GMAC when used in non-IPsec secnarios - Added generic CMAC implementation (including IPsec glue) - IP update for crypto/atmel - Support for more than one device in hwrng/timeriomem - Added Broadcom BCM2835 RNG driver - Misc fixes * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (59 commits) crypto: caam - fix job ring cleanup code crypto: camellia - add AVX2/AES-NI/x86_64 assembler implementation of camellia cipher crypto: serpent - add AVX2/x86_64 assembler implementation of serpent cipher crypto: twofish - add AVX2/x86_64 assembler implementation of twofish cipher crypto: blowfish - add AVX2/x86_64 implementation of blowfish cipher crypto: tcrypt - add async cipher speed tests for blowfish crypto: testmgr - extend camellia test-vectors for camellia-aesni/avx2 crypto: aesni_intel - fix Kconfig problem with CRYPTO_GLUE_HELPER_X86 crypto: aesni_intel - add more optimized XTS mode for x86-64 crypto: x86/camellia-aesni-avx - add more optimized XTS code crypto: cast6-avx: use new optimized XTS code crypto: x86/twofish-avx - use optimized XTS code crypto: x86 - add more optimized XTS-mode for serpent-avx xfrm: add rfc4494 AES-CMAC-96 support crypto: add CMAC support to CryptoAPI crypto: testmgr - add empty test vectors for null ciphers crypto: testmgr - add AES GMAC test vectors crypto: gcm - fix rfc4543 to handle async crypto correctly crypto: gcm - make GMAC work when dst and src are different hwrng: timeriomem - added devicetree hooks ...
2013-03-22crypto: caam - set RDB bit in security configuration registerVakul Garg1-0/+3
This change is required for post SEC-5.0 devices which have RNG4. Setting RDB in security configuration register allows CAAM to use the "Random Data Buffer" to be filled by a single request. The Random Data Buffer is large enough for ten packets to get their IVs from a single request. If the Random Data Buffer is not enabled, then each IV causes a separate request, and RNG4 hardware cannot keep up resulting in lower IPSEC throughput if random IVs are used. Signed-off-by: Vakul Garg <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2013-03-18treewide: Fix typos in printk and commentMasanari Iida1-1/+1
Signed-off-by: Masanari Iida <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2013-01-03Drivers: crypto: remove __dev* attributes.Greg Kroah-Hartman1-1/+1
CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, __devinitdata, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <[email protected]> Cc: Herbert Xu <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Kent Yoder <[email protected]> Cc: Jamie Iles <[email protected]> Cc: Kim Phillips <[email protected]> Cc: Shengzhou Liu <[email protected]> Cc: Alex Porosanu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-09-27crypto: caam - increase TRNG clocks per sampleKim Phillips1-3/+3
we need to configure the TRNG to use more clocks per sample to handle the two back-to-back 64KiB random descriptor requests on higher frequency P5040s. Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2012-07-11crypto: caam - ERA retrieval and printing for SEC deviceAlex Porosanu1-2/+39
This patch adds support for retrieving and printing of SEC ERA information. It is useful for knowing beforehand what features exist from the SEC point of view on a certain SoC. Only era-s 1 to 4 are currently supported; other eras will appear as unknown. Signed-off-by: Alex Porosanu <[email protected]> - rebased onto current cryptodev master - made caam_eras static Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2012-06-27crypto: caam - add support for SEC v5.x RNG4Kim Phillips1-2/+127
The SEC v4.x' RNGB h/w block self-initialized. RNG4, available on SEC versions 5 and beyond, is based on a different standard that requires manual initialization. Also update any new errors From the SEC v5.2 reference manual: The SEC v5.2's RNG4 unit reuses some error IDs, thus the addition of rng_err_id_list over the CHA-independent err_id_list. Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2012-06-27crypto: caam - assign 40-bit masks on SEC v5.0 and aboveKim Phillips1-2/+7
SEC v4.x were only 36-bit, SEC v5+ are 40-bit capable. Also set a DMA mask for any job ring devices created. Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2012-03-29crypto: caam - add backward compatible string sec4.0Shengzhou Liu1-0/+16
In some device trees of previous version, there were string "fsl,sec4.0". To be backward compatible with device trees, we have CAAM driver first check "fsl,sec-v4.0", if it fails, then check for "fsl,sec4.0". Signed-off-by: Shengzhou Liu <[email protected]> Acked-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2012-01-26crypto: caam - fix gcc 4.6 warningKim Phillips1-1/+1
drivers/crypto/caam/ctrl.c: In function 'caam_probe': drivers/crypto/caam/ctrl.c:49:6: warning: unused variable 'd' [-Wunused-variable] Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2011-12-20crypto: caam - remove DECO access initialization codeKim Phillips1-13/+0
Access to the SEC4 DECOs (DEscriptor COntrollers) (for debug purposes) isn't supported or used, and its register access initialization code erroneously makes illegal i/o accesses that show up as errors when run under simulation. Remove it until proper support (via DECORR) is added. Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2011-11-30crypto: convert drivers/crypto/* to use module_platform_driver()Axel Lin1-12/+1
This patch converts the drivers in drivers/crypto/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Cc: James Hsiao <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: Kim Phillips <[email protected]> Cc: "David S. Miller" <[email protected]> Signed-off-by: Axel Lin <[email protected]> Acked-by: Vladimir Zapolskiy <[email protected]> Acked-by: Jamie Iles <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2011-07-25Merge branch 'for-linus' of ↵Linus Torvalds1-13/+13
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: fs: take the ACL checks to common code bury posix_acl_..._masq() variants kill boilerplates around posix_acl_create_masq() generic_acl: no need to clone acl just to push it to set_cached_acl() kill boilerplate around posix_acl_chmod_masq() reiserfs: cache negative ACLs for v1 stat format xfs: cache negative ACLs if there is no attribute fork 9p: do no return 0 from ->check_acl without actually checking vfs: move ACL cache lookup into generic code CIFS: Fix oops while mounting with prefixpath xfs: Fix wrong return value of xfs_file_aio_write fix devtmpfs race caam: don't pass bogus S_IFCHR to debugfs_create_...() get rid of create_proc_entry() abuses - proc_mkdir() is there for purpose asus-wmi: ->is_visible() can't return negative fix jffs2 ACLs on big-endian with 16bit mode_t 9p: close ACL leaks ocfs2_init_acl(): fix a leak VFS : mount lock scalability for internal mounts
2011-07-24caam: don't pass bogus S_IFCHR to debugfs_create_...()Al Viro1-13/+13
it will be replaced with S_IFREG anyway Signed-off-by: Al Viro <[email protected]>
2011-06-30crypto: caam - fix build warning when DEBUG_FS not configuredKim Phillips1-1/+3
drivers/crypto/caam/ctrl.c: In function 'caam_probe': drivers/crypto/caam/ctrl.c:55:23: warning: unused variable 'perfmon' Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2011-05-19crypto: caam - platform_bus_type migrationKim Phillips1-5/+4
this fixes a build error since cryptodev-2.6 got rebased to include commit d714d1979d7b4df7e2c127407f4014ce71f73cd0 "dt: eliminate of_platform_driver shim code". Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2011-03-27crypto: caam - standardize device tree naming convention to utilize '-vX.Y'Kim Phillips1-3/+3
Help clarify that the number trailing in compatible nomenclature is the version number of the device, i.e., change: "fsl,p4080-sec4.0", "fsl,sec4.0"; to: "fsl,p4080-sec-v4.0", "fsl,sec-v4.0"; Signed-off-by: Kim Phillips <[email protected]> Cc: Kumar Gala <[email protected]> Cc: Steve Cornelius <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2011-03-27crypto: caam - Add support for the Freescale SEC4/CAAMKim Phillips1-0/+270
The SEC4 supercedes the SEC2.x/3.x as Freescale's Integrated Security Engine. Its programming model is incompatible with all prior versions of the SEC (talitos). The SEC4 is also known as the Cryptographic Accelerator and Assurance Module (CAAM); this driver is named caam. This initial submission does not include support for Data Path mode operation - AEAD descriptors are submitted via the job ring interface, while the Queue Interface (QI) is enabled for use by others. Only AEAD algorithms are implemented at this time, for use with IPsec. Many thanks to the Freescale STC team for their contributions to this driver. Signed-off-by: Steve Cornelius <[email protected]> Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>