cipher-3des1.c (256281) | cipher-3des1.c (258343) |
---|---|
1/* $OpenBSD: cipher-3des1.c,v 1.8 2013/05/17 00:13:13 djm Exp $ */ | 1/* $OpenBSD: cipher-3des1.c,v 1.9 2013/11/08 00:39:15 djm Exp $ */ |
2/* 3 * Copyright (c) 2003 Markus Friedl. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 52 unchanged lines hidden (view full) --- 62static int 63ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, 64 int enc) 65{ 66 struct ssh1_3des_ctx *c; 67 u_char *k1, *k2, *k3; 68 69 if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) { | 2/* 3 * Copyright (c) 2003 Markus Friedl. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 52 unchanged lines hidden (view full) --- 62static int 63ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, 64 int enc) 65{ 66 struct ssh1_3des_ctx *c; 67 u_char *k1, *k2, *k3; 68 69 if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) { |
70 c = xmalloc(sizeof(*c)); | 70 c = xcalloc(1, sizeof(*c)); |
71 EVP_CIPHER_CTX_set_app_data(ctx, c); 72 } 73 if (key == NULL) 74 return (1); 75 if (enc == -1) 76 enc = ctx->encrypt; 77 k1 = k2 = k3 = (u_char *) key; 78 k2 += 8; --- 105 unchanged lines hidden --- | 71 EVP_CIPHER_CTX_set_app_data(ctx, c); 72 } 73 if (key == NULL) 74 return (1); 75 if (enc == -1) 76 enc = ctx->encrypt; 77 k1 = k2 = k3 = (u_char *) key; 78 k2 += 8; --- 105 unchanged lines hidden --- |