X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=inline;f=src%2Fopenssl%2Fcipher.c;h=743449a33a498f70c7bdf9c37f54c3623ca0d386;hb=3d75dbc0880484ff6d2f689a9b981def3cd75b5e;hp=86a1acad889d981a8afcbdbed2eb58b0490b5260;hpb=791c1898ea8f92b07f1d79e90540c257ac38298d;p=tinc diff --git a/src/openssl/cipher.c b/src/openssl/cipher.c index 86a1acad..743449a3 100644 --- a/src/openssl/cipher.c +++ b/src/openssl/cipher.c @@ -101,13 +101,13 @@ bool cipher_encrypt(cipher_t *cipher, const void *indata, size_t inlen, void *ou if(EVP_EncryptInit_ex(&cipher->ctx, NULL, NULL, NULL, NULL) && EVP_EncryptUpdate(&cipher->ctx, (unsigned char *)outdata, &len, indata, inlen) && EVP_EncryptFinal(&cipher->ctx, (unsigned char *)outdata + len, &pad)) { - *outlen = len + pad; + if(outlen) *outlen = len + pad; return true; } } else { int len; if(EVP_EncryptUpdate(&cipher->ctx, outdata, &len, indata, inlen)) { - *outlen = len; + if(outlen) *outlen = len; return true; } } @@ -122,13 +122,13 @@ bool cipher_decrypt(cipher_t *cipher, const void *indata, size_t inlen, void *ou if(EVP_DecryptInit_ex(&cipher->ctx, NULL, NULL, NULL, NULL) && EVP_DecryptUpdate(&cipher->ctx, (unsigned char *)outdata, &len, indata, inlen) && EVP_DecryptFinal(&cipher->ctx, (unsigned char *)outdata + len, &pad)) { - *outlen = len + pad; + if(outlen) *outlen = len + pad; return true; } } else { int len; if(EVP_EncryptUpdate(&cipher->ctx, outdata, &len, indata, inlen)) { - *outlen = len; + if(outlen) *outlen = len; return true; } }