Skip to content

Instantly share code, notes, and snippets.

@kaidokert
Last active March 6, 2021 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaidokert/9adc8556ba09ec4f497975f6d23cfeb6 to your computer and use it in GitHub Desktop.
Save kaidokert/9adc8556ba09ec4f497975f6d23cfeb6 to your computer and use it in GitHub Desktop.
Query STM32 parts for security features
-- The SQLite database file is in STMCube installation, cube-finder-db.db
select * from (
select substr(rpn,1,length(rpn)-2) as rpn, --remove last 2 letters of RPN which are memory size
core, featurename, featureitemname
from (
select replace(replace(rpn,'-A',''),'-X','') as rpn, --squash minor variants
strValue as core, f.name featurename, fi.item featureitemname
from cpn
join cpn_has_attribute cha on cha.cpn_id=cpn.id
join attribute catt on catt.id=cha.attribute_id
join rpn_has_cpn rhc on rhc.cpn_id=cpn.id
join rpn on rpn.id=rhc.rpn_id
join rpn_has_featurelist rhf on rhf.rpn_id=rpn.id
join feature f on rhf.feature_id=f.id
join featureitem fi on rhf .featureItem_id=fi.id
where catt.name='core'
and cha.strValue in ('Arm Cortex-M0', 'Arm Cortex-M0+', 'Arm Cortex-M3','Arm Cortex-M3+','Arm Cortex-M4','Arm Cortex-M4+','Arm Cortex-M7','Arm Cortex-M7+')
and ( upper(fi.item) like '%PUBLIC%' or upper(fi.item) like '%PRIVATE%'
or upper(fi.item) like '%PKA%' or upper(fi.item) like '%AES%'
or upper(fi.item) like '%HASH%' or upper(fi.item) like '%CRYPT%'
or upper(fi.item) like '%SHA%'
-- or upper(fi.item) like '%ECC%' -- this returns ecc memory, rather than elliptic curve
--or upper(fi.item) like '%CRC%' -- most parts have this
)
and (not f.name like '%DMA controller%') and (not fi.item like '%DMA controller%')
and (not fi.item like '%HW semaphores for resources sharing%')
order by rpn
)
)
group by core, rpn, featurename, featureitemname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment