Bug #3146

make quick and easy KDF calibrator based on /proc/cpuinfo

Added by hans almost 4 years ago. Updated almost 3 years ago.

Status:ClosedStart date:03/27/2014
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:0.1
Component:

Description

Using the info in /proc/cpuinfo, in effect a tiny text file, cacheword should be able to generate very good guesses at appropriate KDF iteration counts in a matter of milliseconds. It could be based on processor type (ARMv6 vs ARMv7 vs MIPS vs i386, etc), BogoMIPS, CPU clock if available, and processor count if that's relevant.


Related issues

Related to CacheWord - Task #3127: test new KDF calibrator on various devices Closed 03/25/2014 03/27/2014
Related to CacheWord - Task #3665: remove spongycastle dep Closed 08/22/2014
Related to IOCipher - Bug #492: SQLCipher uses a ridiculously low iteration count in the ... Closed 01/10/2013

Associated revisions

Revision e5fd84db
Added by Hans-Christoph Steiner over 3 years ago

replace heavy KDF iteration count function with one based on /proc/cpuinfo

The previous KDF iteration count measuring method took a long time to run
and depended on including spongycastle. In the interest of keeping the
library as minimal as possible, it is good to remove dependencies. In the
interest of usability, calculating the iteration count should be very fast.

fixes #3146 https://dev.guardianproject.info/issues/3146
fixes #3665 https://dev.guardianproject.info/issues/3665
fixes #492 https://dev.guardianproject.info/issues/492

History

#1 Updated by abeluck almost 4 years ago

This seems like a good idea, but I'm not sure how to go about evaluating the info in cpuinfo and deriving a value. I don't know too much about hardware specifics and how they translate into KDF performance. Any suggestions or links to read?

#2 Updated by hans almost 4 years ago

You could probably get somewhere useful just going on BogoMIPS, that's supposed to be a vague guess at the relative speed of the CPU. I believe ARMv7 added instructions that speed up many crypto operations, so that would be faster than ARMv6 (think i686 vs i5 vs i7).

You probably could just start by just sticking a value for all ARMv6 vs ARMv7. The other thing to check in /proc/cpuinfo is flags. That'll tell you specific CPU features, like whether it supports NEON, SSE2, etc. You can tell from the flags whether the CPU has the special instruction for AES encryption (NI-AES I think its called).

#3 Updated by hans over 3 years ago

  • Target version set to 0.1

#4 Updated by hans over 3 years ago

A quick survey of /proc/cpuinfo on some real devices:

  • Motorola Xoom:
    Processor    : ARMv7 Processor rev 0 (v7l)
    processor    : 0
    BogoMIPS    : 215.16
    
    processor    : 1
    BogoMIPS    : 215.16
    
    Features    : swp half thumb fastmult vfp edsp vfpv3 vfpv3d16 
    
  • Samsung Note II
    Processor    : ARMv7 Processor rev 0 (v7l)
    processor    : 0
    BogoMIPS    : 1592.52
    
    processor    : 1
    BogoMIPS    : 3185.04
    
    processor    : 2
    BogoMIPS    : 3185.04
    
    processor    : 3
    BogoMIPS    : 3185.04
    
    Features    : swp half thumb fastmult vfp edsp neon vfpv3 tls 
    
  • Google Nexus 7 (1st gen)
    Processor    : ARMv7 Processor rev 9 (v7l)
    processor    : 0
    BogoMIPS    : 1993.93
    
    processor    : 1
    BogoMIPS    : 1993.93
    
    processor    : 2
    BogoMIPS    : 1993.93
    
    processor    : 3
    BogoMIPS    : 1993.93
    
    Features    : swp half thumb fastmult vfp edsp neon vfpv3 tls 
    
  • ZTE V880
    Processor    : ARMv6-compatible processor rev 5 (v6l)
    BogoMIPS    : 245.61
    Features    : swp half thumb fastmult vfp edsp java
    
  • LG P705
    Processor    : ARMv7 Processor rev 1 (v7l)
    BogoMIPS    : 239.86
    Features    : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4
    

#5 Updated by hans over 3 years ago

And someone else's collection of /proc/cpuinfo dumps:

#6 Updated by Anonymous over 3 years ago

  • Status changed from New to Resolved

Applied in changeset cacheword|commit:e5fd84db6929a7e8cc61bda5257abacfd831c212.

#7 Updated by hans almost 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF