summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-08-17 09:46:43 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-08-22 10:26:04 +0100
commit90f2d452a860adef46dde22ddaf39811a0a43c5d (patch)
tree9dd60f892f646917f40b65928ce0bdf46f12c73d /lib/libc
parent091f39675a98ee9e22ed78f52e239880bedf8911 (diff)
libc: Remove sscanf() and timingsafe_bcmp()
sscanf() is unused and it doesn't work, so it doesn't make sense to keep it. timingsafe_bcmp() isn't used anywhere. Change-Id: Ib5d28ff21d0f3ccc36c5c0fb5474b3384105cf80 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/libc.mk6
-rw-r--r--lib/libc/sscanf.c27
-rw-r--r--lib/libc/timingsafe_bcmp.c36
3 files changed, 2 insertions, 67 deletions
diff --git a/lib/libc/libc.mk b/lib/libc/libc.mk
index ded3d745..022e6bfa 100644
--- a/lib/libc/libc.mk
+++ b/lib/libc/libc.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -12,14 +12,12 @@ LIBC_SRCS := $(addprefix lib/libc/, \
printf.c \
putchar.c \
puts.c \
- sscanf.c \
strchr.c \
strcmp.c \
strlen.c \
strncmp.c \
strnlen.c \
- subr_prf.c \
- timingsafe_bcmp.c)
+ subr_prf.c)
INCLUDES += -Iinclude/lib/libc \
-Iinclude/lib/libc/sys
diff --git a/lib/libc/sscanf.c b/lib/libc/sscanf.c
deleted file mode 100644
index a5876cff..00000000
--- a/lib/libc/sscanf.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <stdio.h>
-#include <sys/cdefs.h>
-
-/*
- * TODO: This is not a real implementation of the sscanf() function. It just
- * returns the number of expected arguments based on the number of '%' found
- * in the format string.
- */
-int
-sscanf(const char *__restrict str, char const *__restrict fmt, ...)
-{
- int ret = 0;
-
- while (*fmt != '\0') {
- if (*fmt++ == '%') {
- ret++;
- }
- }
-
- return ret;
-}
diff --git a/lib/libc/timingsafe_bcmp.c b/lib/libc/timingsafe_bcmp.c
deleted file mode 100644
index d0981580..00000000
--- a/lib/libc/timingsafe_bcmp.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $OpenBSD: timingsafe_bcmp.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */
-/*
- * Copyright (c) 2010 Damien Miller. All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <string.h>
-
-int __timingsafe_bcmp(const void *, const void *, size_t);
-
-int
-__timingsafe_bcmp(const void *b1, const void *b2, size_t n)
-{
- const unsigned char *p1 = b1, *p2 = b2;
- int ret = 0;
-
- for (; n > 0; n--)
- ret |= *p1++ ^ *p2++;
- return (ret != 0);
-}
-
-__weak_reference(__timingsafe_bcmp, timingsafe_bcmp);