summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2025-04-22 14:08:24 +0000
committerjsing <>2025-04-22 14:08:24 +0000
commit18eaab4606e6e48d98c069e3754d92fe0beb365e (patch)
treeaf6c54927e580687980c75a18a475201dda1065b /src
parent48fd82d423b1e5366283ee628900d5918ef9532f (diff)
downloadopenbsd-18eaab4606e6e48d98c069e3754d92fe0beb365e.tar.gz
openbsd-18eaab4606e6e48d98c069e3754d92fe0beb365e.tar.bz2
openbsd-18eaab4606e6e48d98c069e3754d92fe0beb365e.zip
Use OPENSSL_assert() instead of assert().
While here, tidy up the assignment of n and test directly. ok tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/modes/ctr128.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lib/libcrypto/modes/ctr128.c b/src/lib/libcrypto/modes/ctr128.c
index c2ce1bda21..6d1bcff313 100644
--- a/src/lib/libcrypto/modes/ctr128.c
+++ b/src/lib/libcrypto/modes/ctr128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ctr128.c,v 1.15 2025/04/22 14:01:07 jsing Exp $ */ 1/* $OpenBSD: ctr128.c,v 1.16 2025/04/22 14:08:24 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -49,7 +49,6 @@
49 * 49 *
50 */ 50 */
51 51
52#include <assert.h>
53#include <string.h> 52#include <string.h>
54 53
55#include <openssl/crypto.h> 54#include <openssl/crypto.h>
@@ -118,12 +117,10 @@ CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
118 unsigned char ivec[16], unsigned char ecount_buf[16], 117 unsigned char ivec[16], unsigned char ecount_buf[16],
119 unsigned int *num, block128_f block) 118 unsigned int *num, block128_f block)
120{ 119{
121 unsigned int n; 120 unsigned int n = *num;
122 size_t l = 0; 121 size_t l = 0;
123 122
124 assert(*num < 16); 123 OPENSSL_assert(n < 16);
125
126 n = *num;
127 124
128#if !defined(OPENSSL_SMALL_FOOTPRINT) 125#if !defined(OPENSSL_SMALL_FOOTPRINT)
129 if (16 % sizeof(size_t) == 0) 126 if (16 % sizeof(size_t) == 0)
@@ -201,11 +198,10 @@ CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
201 unsigned char ivec[16], unsigned char ecount_buf[16], 198 unsigned char ivec[16], unsigned char ecount_buf[16],
202 unsigned int *num, ctr128_f func) 199 unsigned int *num, ctr128_f func)
203{ 200{
204 unsigned int n, ctr32; 201 unsigned int n = *num;
205 202 unsigned int ctr32;
206 assert(*num < 16);
207 203
208 n = *num; 204 OPENSSL_assert(n < 16);
209 205
210 while (n && len) { 206 while (n && len) {
211 *(out++) = *(in++) ^ ecount_buf[n]; 207 *(out++) = *(in++) ^ ecount_buf[n];