]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/emv/emv_roca.c
EVM fixes and additions (RRG repository PRs 78-82 by @merlokk) (#776)
[proxmark3-svn] / client / emv / emv_roca.c
index 3701ddf8ba58781a1582f3cd7376e0bd162c7b28..bc317db8dd5931bd8b82b6afd4a9946f630363c8 100644 (file)
@@ -28,6 +28,7 @@
 #include <stdbool.h>
 
 #include "ui.h"
+#include "util.h"
 #include "mbedtls/bignum.h"
 
 
@@ -146,11 +147,10 @@ cleanup:
        return ret;
 }
 
-int roca_self_test( int verbose ) {
+int roca_self_test( void ) {
        int ret = 0;
 
-       if( verbose != 0 )
-               printf( "\nROCA check vulnerability tests\n" );
+       PrintAndLogEx(INFO, "ROCA check vulnerability tests" );
 
        // positive
        uint8_t keyp[] = "\x94\x4e\x13\x20\x8a\x28\x0c\x37\xef\xc3\x1c\x31\x14\x48\x5e\x59"\
@@ -158,16 +158,13 @@ int roca_self_test( int verbose ) {
                                        "\x27\x83\x30\xd3\xf4\x71\xa2\x53\x8f\xa6\x67\x80\x2e\xd2\xa3\xc4"\
                                        "\x4a\x8b\x7d\xea\x82\x6e\x88\x8d\x0a\xa3\x41\xfd\x66\x4f\x7f\xa7";
 
-       if( verbose != 0 )
-               printf( "  ROCA positive test: " );
        
        if (emv_rocacheck(keyp, 64, false)) {
-               if( verbose != 0 )
-                       printf( "passed\n" );
-       } else {
-               ret = 1;
-               if( verbose != 0 )
-                       printf( "failed\n" );
+               PrintAndLogEx(SUCCESS, "Weak modulus [ %s]", _GREEN_(PASS) );   
+       }
+       else {
+               ret++;
+               PrintAndLogEx(FAILED, "Weak modulus [ %s]", _RED_(FAIL) );
        }
 
        // negative
@@ -176,18 +173,12 @@ int roca_self_test( int verbose ) {
                                        "\x27\x83\x30\xd3\xf4\x71\xa2\x53\x8f\xa6\x67\x80\x2e\xd2\xa3\xc4"\
                                        "\x4a\x8b\x7d\xea\x82\x6e\x88\x8d\x0a\xa3\x41\xfd\x66\x4f\x7f\xa7";
 
-       if( verbose != 0 )
-               printf( "  ROCA negative test: " );
-
        if (emv_rocacheck(keyn, 64, false)) {
-               ret = 1;
-               if( verbose != 0 )
-                       printf( "failed\n" );
+               ret++;
+               PrintAndLogEx(FAILED, "Strong modulus [ %s]", _RED_(FAIL) );
        } else {
-               if( verbose != 0 )
-                       printf( "passed\n" );
+               PrintAndLogEx(SUCCESS, "Strong modulus [ %s]", _GREEN_(PASS) ); 
        }
 
-       
        return ret;
 }
Impressum, Datenschutz