- mpz_export(edsig, NULL, 1, 1, 0, 0, dsasig.r);
- mpz_export(&edsig[32], NULL, 1, 1, 0, 0, dsasig.s);
+ mpz_export(edsig, &count, 1, 1, 0, 0, dsasig.r);
+ if (count < 32) {
+ memmove(&edsig[32 - count], edsig, count);
+ while (count < 32) {
+ count++;
+ edsig[32 - count] = 0;
+ }
+ }
+ mpz_export(&edsig[32], &count, 1, 1, 0, 0, dsasig.s);
+ if (count < 32) {
+ memmove(&edsig[32 - count], edsig, count);
+ while (count < 32) {
+ count++;
+ edsig[32 - count] = 0;
+ }
+ }