This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

The program did not respond after debugging in an implementation of ecsign.c

Hello, please see the attached file in order to review the problem. Thanks.

Mario.6708.Post ECDSA SIGN 16_10_13.doc

  • Hi Mario,

    Thanks for your post.

    After seeing your problem, the issue could be like, the third party cryptographic library (Miracl) would not have linked properly and the library calls would not have resolved at run time. I guess, there could be issues with the library source or problem would be in the library linking at run time.

    Could able to figure out, where the code breaks when the program is halted after resume?

    Please make sure whether all the library and header paths are included in the project property settings so that, it automatically links the library calls when the program runs. We basically don't support third party libraries linked to CCS projects if the library source has some issues.

    For more help, please refer the CCSv5 user guide as below:

    http://processors.wiki.ti.com/index.php/Code_Composer_Studio_v5_Users_Guide#Cross-Compiling_the_Sources

    Please check the below links which could help you to solve the issue:

    http://processors.wiki.ti.com/index.php/Troubleshooting_CCSv5#Debugger

    http://processors.wiki.ti.com/index.php/FAQ_-_CCSv5#Q:_What_targets_support_CCS_function_profiling.3F

    Thanks & regards,

    Sivaraj K

    ------------------------------------------------------------------------------------------------------- 
    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------

     

  • Hi Sivaraj, thanks for your help.

    I reviewed the code of ecsign. c and I found a problem in the highlighted line. Next there is a modified version of the file, that was used in order to find the problem.

    /*
     *   Elliptic Curve Digital Signature Algorithm (ECDSA)
     *
     *
     *   This program asks for the name of a <file>, computes its message digest,
     *   signs it, and outputs the signature to a file <file>.ecs. It is assumed 
     *   that curve parameters are available from a file common.ecs, as well as 
     *   the private key of the signer previously generated by the ecsgen program
     *
     *   The curve is y^2=x^3+Ax+B mod p
     *
     *   The file common.ecs is presumed to exist, and to contain the domain
     *   information {p,A,B,q,x,y}, where A and B are curve parameters, (x,y) are
     *   a point of order q, p is the prime modulus, and q is the order of the 
     *   point (x,y). In fact normally q is the prime number of points counted
     *   on the curve. 
     *
     */
    
    #include <stdio.h>
    #include "miracl.h"
    #include <stdlib.h>
    #include <string.h>
    
    #ifdef MR_COUNT_OPS
    int fpm2,fpi2,fpc,fpa,fpx;
    #endif
    
    void strip(char *name)
    { /* strip off filename extension */
        int i;
        for (i=0;name[i]!='\0';i++)
        {
            if (name[i]!='.') continue;
            name[i]='\0';
            break;
        }
    }
    
    static void hashing(FILE *fp,big hash)
    { /* compute hash function */
        char h[20];
        int ch;
        sha sh;
        shs_init(&sh);
        while ((ch=fgetc(fp))!=EOF) shs_process(&sh,ch);
        shs_hash(&sh,h);
        bytes_to_big(20,h,hash);
    }
    
    int main()
    {
        FILE *fp;
        char ifname[50],ofname[50];
        big a,b,p,q,x,y,d,r,s,k,hash;
        epoint *g;
        long seed;
        int bits;
        miracl *mip;
    
    #ifndef MR_EDWARDS
        fp=fopen("c:\\common.ecs","rt");/*Modified Line here*/ /*ORIGINAL: fp=fopen("common.ecs","rt");*/
        if (fp==NULL)
        {
            printf("file common.ecs does not exist\n");
            return 0;
        }
        fscanf(fp,"%d\n",&bits);
    #else
        fp=fopen("edwards.ecs","rt");
        if (fp==NULL)
        {
            printf("file edwards.ecs does not exist\n");
            return 0;
        }
        fscanf(fp,"%d\n",&bits);
    #endif
     mip=mirsys(bits/4,16); /* Use Hex internally */
    /* get public data */
    
            /* randomise */
                printf("Enter 9 digit random number seed  = ");
                scanf("%ld",&seed);
                getchar();
                irand(seed);
        return 0;
    }

    When I did not include the highlighted line, the program ran without problem, up to this point. How can I solve this?. Thanks.

    Mario.

  • Excuse me.

    The line with the problem is:

    mip=mirsys(bits/4,16); /* Use Hex internally */

    Thanks.

    Mario.


  • HI Mario,

    Thanks for your update.

    In my opinion, if you have any problem in the code, you shall keep break points in the code by halting the program whereever you suspect there is problem, please catch the global and local variables in the watch window and validate the same as expected or not.

    Kindly clarify whether it is a logical error or system error because of your third party cryptographic library (Miracl)

    Thanks & regards,

    Sivaraj K

    ------------------------------------------------------------------------------------------------------- 
    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------