X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=rsa%2Frsaes_pkcs1v15.c;h=c1f753fa9220feb3a60f610c544911b2646d2049;hp=2bc35aca9a12e3479559129ce494ea41424db723;hb=4b5da1dc27a791b5c448274a3db09cd035b33493;hpb=fdbda6486df88be6ac2ba948f21e84c396499535 diff --git a/rsa/rsaes_pkcs1v15.c b/rsa/rsaes_pkcs1v15.c index 2bc35ac..c1f753f 100644 --- a/rsa/rsaes_pkcs1v15.c +++ b/rsa/rsaes_pkcs1v15.c @@ -1,7 +1,7 @@ /* rsa_pkcs1v15.c */ /* This file is part of the ARM-Crypto-Lib. - Copyright (C) 2006-2011 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 @@ -33,12 +33,12 @@ #include "random_dummy.h" -uint16_t rsa_pkcs1v15_compute_padlength_B(bigint_t* modulus, uint16_t msg_length_B){ +uint16_t rsa_pkcs1v15_compute_padlength_B(bigint_t *modulus, uint16_t msg_length_B){ return bigint_get_first_set_bit(modulus) / 8 + 1 - msg_length_B - 3; } -uint8_t rsa_encrypt_pkcs1v15(void* dest, uint16_t* out_length, const void* src, - uint16_t length_B, rsa_publickey_t* key, const void* pad){ +uint8_t rsa_encrypt_pkcs1v15(void *dest, uint16_t *out_length, const void *src, + uint16_t length_B, rsa_publickey_t *key, const void *pad){ int16_t pad_length; bigint_t x; pad_length = rsa_pkcs1v15_compute_padlength_B(&key->modulus, length_B); @@ -79,14 +79,14 @@ uint8_t rsa_encrypt_pkcs1v15(void* dest, uint16_t* out_length, const void* src, cli_hexdump_block(x.wordv, x.length_W * sizeof(bigint_word_t), 4, 16); #endif bigint_adjust(&x); - rsa_os2ip(&x, NULL, length_B+pad_length+3); + rsa_os2ip(&x, NULL, length_B + pad_length + 3); rsa_enc(&x, key); rsa_i2osp(NULL, &x, out_length); return 0; } -uint8_t rsa_decrypt_pkcs1v15(void* dest, uint16_t* out_length, const void* src, - uint16_t length_B, rsa_privatekey_t* key, void* pad){ +uint8_t rsa_decrypt_pkcs1v15(void *dest, uint16_t *out_length, const void *src, + uint16_t length_B, rsa_privatekey_t *key, void *pad){ bigint_t x; uint16_t m_length, pad_length=0, idx=0; x.wordv = dest;