Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8320689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:44:36+00:00 2026-06-08T22:44:36+00:00

I am using a toolkit to do some Elliptical Curve Cryptography on an ATMega2560.

  • 0

I am using a toolkit to do some Elliptical Curve Cryptography on an ATMega2560. When trying to use the print functions in the toolkit I am getting an empty string. I know the print functions work because the x86 version prints the variables without a problem. I am not experienced with ATMega and would love any help on this matter. The print code is included below.

Code to print a big number (it itself calls a util_print)

void bn_print(bn_t a) {
int i;

if (a->sign == BN_NEG) {
    util_print("-");
}
if (a->used == 0) {
    util_print("0\n");
} else {
#if WORD == 64
    util_print("%lX", (unsigned long int)a->dp[a->used - 1]);
    for (i = a->used - 2; i >= 0; i--) {
        util_print("%.*lX", (int)(2 * (BN_DIGIT / 8)),
                (unsigned long int)a->dp[i]);
    }
#else
    util_print("%llX", (unsigned long long int)a->dp[a->used - 1]);
    for (i = a->used - 2; i >= 0; i--) {
        util_print("%.*llX", (int)(2 * (BN_DIGIT / 8)),
                (unsigned long long int)a->dp[i]);
    }
#endif
    util_print("\n");
}
}

The code to actually print a big number variable:

static char buffer[64 + 1];
void util_printf(char *format, ...) {
#ifndef QUIET
#if ARCH == AVR
char *pointer = &buffer[1];
va_list list;
va_start(list, format);
vsnprintf(pointer, 128, format, list);
buffer[0] = (unsigned char)2;
va_end(list);
#elif ARCH == MSP
va_list list;
va_start(list, format);
vprintf(format, list);
va_end(list);
#else
va_list list;
va_start(list, format);
vprintf(format, list);
fflush(stdout);
va_end(list);
#endif
#endif
}

edit: I do have UART initialized and can output printf statments to a console.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:44:39+00:00Added an answer on June 8, 2026 at 10:44 pm

    Alright so I found a workaround to print the bn numbers to a stdout on an ATMega2560. The toolkit comes with a function that writes a variable to a string (bn_write_str). So I implemented my own print function as such:

    void print_bn(bn_t a)
    {
        char print[BN_SIZE]; // max precision of a bn number
        int bi = bn_bits(a); // get the number of bits of the number
        bn_write_str(print, bi, a, 16) // 16 indicates the radix (hexadecimal)
        printf("%s\n"), print);
    }
    

    This function will print a bn number in hexadecimal format.
    Hope this helps anyone using the RELIC toolkit with an AVR.

    This skips the util_print calls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET page using the AJAX control toolkit for some controls. A
I am using the WPF toolkit datagrid to display some data and want to
I'm using an ajax toolkit accorion bound to a SiteMapDataSource. Some of the nodes
I'm working on some charting, and am currently using the Silverlight Toolkit. At the
I have some COD files that I have developed using the Widget toolkit for
I'm using the gWidgets package in R (specifically the RGtk2 toolkit). I've created some
I'm using the SilverLight Toolkit to implement some drag/drop functionality in a Silverlight 4
I am using the StackedColumnSeries from the Silverlight toolkit to display some data. I
I get some trouble with the binding using MVVM toolkit and would likr to
I am reading image files in Java using java.awt.Image img = Toolkit.getDefaultToolkit().createImage(filePath); On some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.