X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=keysize_descriptor.c;h=5dcdcc05008088c0c109debd5a6d806e1348eba3;hb=795fc6b98b4cb914fde7ed86c239a39e7db512e7;hp=17f4d473ef27a7c778357c676956e4f4dd13a31b;hpb=17332291e15183d71d88ed868275e3cb53917180;p=avr-crypto-lib.git diff --git a/keysize_descriptor.c b/keysize_descriptor.c index 17f4d47..5dcdcc0 100644 --- a/keysize_descriptor.c +++ b/keysize_descriptor.c @@ -1,6 +1,6 @@ /* keysize_descriptor.c */ /* - This file is part of the This file is part of the AVR-Crypto-Lib. + This file is part of the AVR-Crypto-Lib. Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de) This program is free software: you can redistribute it and/or modify @@ -39,16 +39,16 @@ uint8_t is_valid_keysize_P(PGM_VOID_P ks_desc, uint16_t keysize){ items = pgm_read_byte(ks_desc++); while(items--){ item = pgm_read_word(ks_desc); - ks_desc+=2; + ks_desc = (uint8_t*)ks_desc + 2; if(item==keysize) return 1; } - ks_desc -= 2; + ks_desc = (uint8_t*)ks_desc - 2; } if(type==KS_TYPE_RANGE){ uint16_t max, min; min = pgm_read_word(ks_desc); - ks_desc+=2; + ks_desc = (uint8_t*)ks_desc + 2; max = pgm_read_word(ks_desc); if(min<=keysize && keysize<=max) return 1; @@ -56,11 +56,11 @@ uint8_t is_valid_keysize_P(PGM_VOID_P ks_desc, uint16_t keysize){ if(type==KS_TYPE_ARG_RANGE){ uint16_t max, min, dist, offset; min = pgm_read_word(ks_desc); - ks_desc+=2; + ks_desc = (uint8_t*)ks_desc + 2; max = pgm_read_word(ks_desc); - ks_desc+=2; + ks_desc = (uint8_t*)ks_desc + 2; dist = pgm_read_word(ks_desc); - ks_desc+=2; + ks_desc = (uint8_t*)ks_desc + 2; offset = pgm_read_word(ks_desc); if(min<=keysize && keysize<=max && (keysize%dist==offset)) return 1; @@ -69,7 +69,7 @@ uint8_t is_valid_keysize_P(PGM_VOID_P ks_desc, uint16_t keysize){ /* bad error, you may insert a big warning message here */ return 0; } - return is_valid_keysize(ks_desc+1, keysize) /* search the next record */ + return is_valid_keysize_P((uint8_t*)ks_desc+1, keysize); /* search the next record */ }