* Add 'const' parameter to input arguments in crypto_ms.*
* Round ZPasswordHash buffers up to 24 bytes, as the DES MakeKey() function
accesses ZPasswordHash[21]
Closes github issue #392
[paulus@ozlabs.org - tidied up headline and commit message]
Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
u_char *PasswordHash,
u_char *response)
{
u_char *PasswordHash,
u_char *response)
{
- u_char ZPasswordHash[21];
+ u_char ZPasswordHash[24];
PPP_CIPHER_CTX *ctx;
BZERO(ZPasswordHash, sizeof(ZPasswordHash));
PPP_CIPHER_CTX *ctx;
BZERO(ZPasswordHash, sizeof(ZPasswordHash));
#include <openssl/evp.h>
int
#include <openssl/evp.h>
int
-DesEncrypt(unsigned char *clear, unsigned char *key, unsigned char *cipher)
+DesEncrypt(const unsigned char *clear, const unsigned char *key, unsigned char *cipher)
{
int retval = 0;
unsigned int clen = 0;
{
int retval = 0;
unsigned int clen = 0;
-DesDecrypt(unsigned char *cipher, unsigned char *key, unsigned char *clear)
+DesDecrypt(const unsigned char *cipher, const unsigned char *key, unsigned char *clear)
{
int retval = 0;
unsigned int clen = 0;
{
int retval = 0;
unsigned int clen = 0;
0xD0, 0x2E, 0x43, 0x86, 0xBC, 0xE9, 0x12, 0x26
};
0xD0, 0x2E, 0x43, 0x86, 0xBC, 0xE9, 0x12, 0x26
};
- unsigned char ZPasswordHash[21] = {
+ unsigned char ZPasswordHash[24] = {
0x44, 0xEB, 0xBA, 0x8D, 0x53, 0x12, 0xB8, 0xD6,
0x11, 0x47, 0x44, 0x11, 0xF5, 0x69, 0x89, 0xAE
0x44, 0xEB, 0xBA, 0x8D, 0x53, 0x12, 0xB8, 0xD6,
0x11, 0x47, 0x44, 0x11, 0xF5, 0x69, 0x89, 0xAE
unsigned char expected[24] = {
0x82, 0x30, 0x9E, 0xCD, 0x8D, 0x70, 0x8B, 0x5E,
unsigned char expected[24] = {
0x82, 0x30, 0x9E, 0xCD, 0x8D, 0x70, 0x8B, 0x5E,
0xD0, 0x2E, 0x43, 0x86, 0xBC, 0xE9, 0x12, 0x26
};
0xD0, 0x2E, 0x43, 0x86, 0xBC, 0xE9, 0x12, 0x26
};
- unsigned char ZPasswordHash[21] = {
+ unsigned char ZPasswordHash[24] = {
0x44, 0xEB, 0xBA, 0x8D, 0x53, 0x12, 0xB8, 0xD6,
0x11, 0x47, 0x44, 0x11, 0xF5, 0x69, 0x89, 0xAE
};
0x44, 0xEB, 0xBA, 0x8D, 0x53, 0x12, 0xB8, 0xD6,
0x11, 0x47, 0x44, 0x11, 0xF5, 0x69, 0x89, 0xAE
};
* This is the DES encrypt functions as described by RFC2759.
*
* Parameters:
* This is the DES encrypt functions as described by RFC2759.
*
* Parameters:
- * unsigned char *clear:
+ * const unsigned char *clear:
* A 8 byte input array to be encrypted
*
* A 8 byte input array to be encrypted
*
+ * const unsigned char *key:
* A raw 7-byte array to be expanded to 8 with odd-parity
*
* unsigned char *cipher:
* A raw 7-byte array to be expanded to 8 with odd-parity
*
* unsigned char *cipher:
*
* DesEncrypt returns 1 on success
*/
*
* DesEncrypt returns 1 on success
*/
-int DesEncrypt(unsigned char *clear, unsigned char *key,
+int DesEncrypt(const unsigned char *clear, const unsigned char *key,
unsigned char *cipher);
/**
* This is the DES decrypt functions as described by RFC2759.
*
* Parameters:
unsigned char *cipher);
/**
* This is the DES decrypt functions as described by RFC2759.
*
* Parameters:
- * unsigned char *cipher:
+ * const unsigned char *cipher:
* A 8 byte input array to be decrypted
*
* A 8 byte input array to be decrypted
*
+ * const unsigned char *key:
* A raw 7-byte array to be expanded to a 8-byte key with odd-parity
*
* unsigned char *clear:
* A raw 7-byte array to be expanded to a 8-byte key with odd-parity
*
* unsigned char *clear:
*
* DesDecrypt returns 1 on success
*/
*
* DesDecrypt returns 1 on success
*/
-int DesDecrypt(unsigned char *cipher, unsigned char *key,
+int DesDecrypt(const unsigned char *cipher, const unsigned char *key,
unsigned char *clear);
#endif /* PPP_PPPCRYPT_H */
unsigned char *clear);
#endif /* PPP_PPPCRYPT_H */