summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam/sm_test.c
AgeCommit message (Collapse)Author
2019-05-07MLK-21617: crypto: caam - update SM test error handlingHoria Geantă
Update SM test module to return an error code in all cases and based on this print an indication (test passed / failed) to make test automation easier. Signed-off-by: Horia Geantă <horia.geanta@nxp.com> Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2019-02-19crypto: caam - make dev_dbg() format string constantHoria Geantă
Changing dev_info() to dev_dbg() has exposed an issue with the format string, which is not constant - and leads to compilation failure in case CONFIG_DYNAMIC_DEBUG=y: In file included from ./include/linux/printk.h:334:0, from ./include/linux/kernel.h:14, from drivers/crypto/caam/compat.h:9, from drivers/crypto/caam/sm_test.c:23: drivers/crypto/caam/sm_test.c: In function 'key_display': ./include/linux/dynamic_debug.h:75:16: error: initializer element is not constant static struct _ddebug __aligned(8) \ ^ ./include/linux/dynamic_debug.h:111:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_KEY' DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, 0, 0) ^ ./include/linux/dynamic_debug.h:133:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA' DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ ^ ./include/linux/device.h:1351:2: note: in expansion of macro 'dynamic_dev_dbg' dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ ^ drivers/crypto/caam/sm_test.c:77:2: note: in expansion of macro 'dev_dbg' dev_dbg(dev, label); ^ ./include/linux/dynamic_debug.h:75:16: error: (near initialization for 'descriptor.format') static struct _ddebug __aligned(8) \ ^ ./include/linux/dynamic_debug.h:111:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_KEY' DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, 0, 0) ^ ./include/linux/dynamic_debug.h:133:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA' DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ ^ ./include/linux/device.h:1351:2: note: in expansion of macro 'dynamic_dev_dbg' dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ ^ drivers/crypto/caam/sm_test.c:77:2: note: in expansion of macro 'dev_dbg' dev_dbg(dev, label); ^ make[3]: *** [drivers/crypto/caam/sm_test.o] Error 1 Fixes: c59d342def7b ("crypto: caam - lower SM test verbosity") Suggested-by: Leonard Crestez <leonard.crestez@nxp.com> Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-02-18crypto: caam - lower SM test verbosityHoria Geantă
Let's use dev_dbg() instead of dev_info() to minimize verbosity in case we're not interested in low-level details. While here, replace dev_info() with dev_err() in places where errors are reported. Reported-by: Abel Vesa <abel.vesa@nxp.com> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-02-12MLK-20204: drivers: crypto: caam: sm: test: Dealloc keyslot properlyFranck LENORMAND
Some keyslot values were used during deallocation but were not initiliazed nor set properly. drivers/crypto/caam/sm_test.c:446: CID 3901091 (#1 of 1): Type: Uninitialized scalar variable (UNINIT) Classification: Unclassified Severity: Unspecified Action: Modeling Required Owner: nxa21133 Defect only exists locally. drivers/crypto/caam/sm_test.c:98: 1. var_decl: Declaring variable "keyslot24" without initializer. drivers/crypto/caam/sm_test.c:113: 2. path: Condition "!ctrlpriv", taking false branch. drivers/crypto/caam/sm_test.c:118: 3. path: Condition "kspriv == NULL", taking false branch. drivers/crypto/caam/sm_test.c:123: 4. path: Condition "!units", taking false branch. drivers/crypto/caam/sm_test.c:130: 5. path: Condition "units < 2", taking false branch. drivers/crypto/caam/sm_test.c:150: 6. path: Condition "blob8 == NULL", taking false branch. drivers/crypto/caam/sm_test.c:150: 7. path: Condition "blob16 == NULL", taking false branch. drivers/crypto/caam/sm_test.c:150: 8. path: Condition "blob24 == NULL", taking false branch. drivers/crypto/caam/sm_test.c:150: 9. path: Condition "blob32 == NULL", taking false branch. drivers/crypto/caam/sm_test.c:178: 10. path: Condition "sm_keystore_slot_alloc(ksdev, unit, (16U /* (8 % 16) ? (8 >> 4) + 1 << 4 : 8 */), &keyslot8)", taking true branch. drivers/crypto/caam/sm_test.c:179: 11. path: Jumping to label "dealloc". drivers/crypto/caam/sm_test.c:446: 12. uninit_use_in_call: Using uninitialized value "keyslot24" when calling "sm_keystore_slot_dealloc". drivers/crypto/caam/sm_store.c:771: 12.1. path: Condition "smpriv->slot_alloc == NULL", taking false branch. drivers/crypto/caam/sm_store.c:771: 12.2. path: Condition "smpriv->pagedesc[unit].ksdata == NULL", taking false branch. drivers/crypto/caam/sm_store.c:775: 12.3. read_parm: Reading a parameter value. drivers/crypto/caam/sm_test.c:445: CID 3901093 (#1 of 1): Type: Uninitialized scalar variable (UNINIT) Classification: Unclassified Severity: Unspecified Action: Modeling Required Owner: nxa21133 Defect only exists locally. drivers/crypto/caam/sm_test.c:98: 1. var_decl: Declaring variable "keyslot16" without initializer. drivers/crypto/caam/sm_test.c:113: 2. path: Condition "!ctrlpriv", taking false branch. drivers/crypto/caam/sm_test.c:118: 3. path: Condition "kspriv == NULL", taking false branch. drivers/crypto/caam/sm_test.c:123: 4. path: Condition "!units", taking false branch. drivers/crypto/caam/sm_test.c:130: 5. path: Condition "units < 2", taking false branch. drivers/crypto/caam/sm_test.c:150: 6. path: Condition "blob8 == NULL", taking false branch. drivers/crypto/caam/sm_test.c:150: 7. path: Condition "blob16 == NULL", taking false branch. drivers/crypto/caam/sm_test.c:150: 8. path: Condition "blob24 == NULL", taking false branch. drivers/crypto/caam/sm_test.c:150: 9. path: Condition "blob32 == NULL", taking false branch. drivers/crypto/caam/sm_test.c:178: 10. path: Condition "sm_keystore_slot_alloc(ksdev, unit, (16U /* (8 % 16) ? (8 >> 4) + 1 << 4 : 8 */), &keyslot8)", taking true branch. drivers/crypto/caam/sm_test.c:179: 11. path: Jumping to label "dealloc". drivers/crypto/caam/sm_test.c:445: 12. uninit_use_in_call: Using uninitialized value "keyslot16" when calling "sm_keystore_slot_dealloc". drivers/crypto/caam/sm_store.c:771: 12.1. path: Condition "smpriv->slot_alloc == NULL", taking false branch. drivers/crypto/caam/sm_store.c:771: 12.2. path: Condition "smpriv->pagedesc[unit].ksdata == NULL", taking false branch. drivers/crypto/caam/sm_store.c:775: 12.3. read_parm: Reading a parameter value. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com> Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
2019-02-12Add missing NULL checks in CAAM smRadu Solea
Missing NULL checks in CAAM sm_store and sm_test cause kernel crashes if caam init fails. Signed-off-by: Radu Solea <radu.solea@nxp.com>
2019-02-12MLK-9710-15 Correct size of padded key buffersSteve Cornelius
Correct size of padded key buffers for the Secure Memory test module. Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com> (cherry picked from commit da77cf5583c064deefd09a5e91851ab4398701a0) Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
2019-02-12MLK-9710-12 Adapt sm_test as a black-key handling exampleSteve Cornelius
Converted sm_test to an example that can show: - key covering - secret encapsulation as external memory blob - secret decapsulation from external memory blob - checks and displays of the handling of key content Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com> (cherry picked from commit 45818b72fc4b3fe3fff755b1f9a27cd5519ca2cf) Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
2019-02-12ENGR00289885 [iMX6Q] Add Secure Memory and SECVIO support.Dan Douglass
1. Pull in secure memory support from 3.0.35 kernel. 2. Pull in SECVIO support from 3.0.35 kernel. 3. Make changes to support device tree. 4. Add device tree setting for SECVIO sources. [<vicki.milhoan@freescale.com>: Edited to apply to 3.14] Signed-off-by: Dan Douglass <b41520@freescale.com> (cherry picked from commit f3bfd42e2db3af8326734bebf750e94e74734f6e) Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com> Signed-off-by: Dan Douglass <dan.douglass@freescale.com>