]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - dsa/dsa_verify.c
switching to simualtion testport
[avr-crypto-lib.git] / dsa / dsa_verify.c
index 1faa68ed018f025cf52f18e7e363316c79873dbf..f7a588a383e38fdef75bc7e33c3af3ef755b61ca 100644 (file)
@@ -1,7 +1,7 @@
 /* dsa_verify.c */
 /*
     This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+    Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #include "dsa.h"
 #include "hfal-basic.h"
 
-uint8_t dsa_verify_bigint(const dsa_signature_t* s, const bigint_t* m,
-                                 const dsa_ctx_tctx){
-       if(s->r.length_B==0 || s->s.length_B==0){
+uint8_t dsa_verify_bigint(const dsa_signature_t *s, const bigint_t *m,
+                                 const dsa_ctx_t *ctx){
+       if(s->r.length_W==0 || s->s.length_W==0){
                return DSA_SIGNATURE_FAIL;
        }
        if(bigint_cmp_u(&(s->r), &(ctx->domain.q))>=0 || bigint_cmp_u(&(s->s), &(ctx->domain.q))>=0){
                return DSA_SIGNATURE_FAIL;
        }
        bigint_t w, u1, u2, v1, v2;
-       uint8_t w_b[ctx->domain.q.length_B], u1_b[ctx->domain.q.length_B*2], u2_b[ctx->domain.q.length_B*2];
-       uint8_t v1_b[ctx->domain.p.length_B*2], v2_b[ctx->domain.p.length_B];
+       uint8_t w_b[ctx->domain.q.length_W], u1_b[ctx->domain.q.length_W*2], u2_b[ctx->domain.q.length_W*2];
+       uint8_t v1_b[ctx->domain.p.length_W*2], v2_b[ctx->domain.p.length_W];
        w.wordv = w_b;
        u1.wordv = u1_b;
        u2.wordv = u2_b;
@@ -54,14 +54,14 @@ uint8_t dsa_verify_bigint(const dsa_signature_t* s, const bigint_t* m,
        return DSA_SIGNATURE_FAIL;
 }
 
-uint8_t dsa_verify_message(const dsa_signature_t* s, const void* m, uint16_t m_len_b,
-                                                 const hfdesc_t* hash_desc, const dsa_ctx_t* ctx){
+uint8_t dsa_verify_message(const dsa_signature_t *s, const void *m, uint16_t m_len_b,
+                                                 const hfdesc_t *hash_desc, const dsa_ctx_t *ctx){
        bigint_t z;
-       uint8_t n_B = ctx->domain.q.length_B;
+       uint8_t n_B = ctx->domain.q.length_W;
        uint8_t hash_value[(hfal_hash_getHashsize(hash_desc)+7)/8];
        hfal_hash_mem(hash_desc, hash_value, m, m_len_b);
        z.wordv=hash_value;
-       z.length_B=n_B;
+       z.length_W=n_B;
        bigint_changeendianess(&z);
        bigint_adjust(&z);
        return dsa_verify_bigint(s, &z, ctx);