Skip to content

Commit

Permalink
adb: Try to exclude auth and openssl dep.
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed Feb 11, 2024
1 parent 4e1d9e5 commit 840cb81
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 10 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ SUBDIRS= \
adb \
adb/daemon \
base \
libcrypto_utils \
libcutils

all: adb/adbd adbd.service
Expand Down Expand Up @@ -34,7 +33,7 @@ base/libbase.a: subdirs $(top_srcdir)/base/*.cpp
libcrypto_utils/libcrypto_utils.a: subdirs libcrypto_utils/android_pubkey.c
$(MAKE) -C libcrypto_utils

adb/adbd adb/xdg-adbd: subdirs libcutils/libcutils.a base/libbase.a libcrypto_utils/libcrypto_utils.a $(top_srcdir)/adb/*.cpp adb/xdg-adbd.c
adb/adbd adb/xdg-adbd: subdirs libcutils/libcutils.a base/libbase.a $(top_srcdir)/adb/*.cpp
$(MAKE) -C adb

clean: subdirs
Expand Down
15 changes: 7 additions & 8 deletions adb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ LIBADB_linux_SRC_FILES := \
LOCAL_SRC_FILES := \
$(LIBADB_SRC_FILES) \
$(LIBADB_linux_SRC_FILES) \
adb_auth_client.cpp \
fdevent.cpp

LOCAL_SRC_FILES += \
adb_auth_client_dummy.cpp
# adb_auth_client.cpp \
LOCAL_SRC_FILES += \
services.cpp \
file_sync_service.cpp \
Expand Down Expand Up @@ -78,16 +81,12 @@ CFLAGS= $(OPT_CFLAGS) $(LOCAL_CFLAGS) $(LOCAL_INCLUDES)
${CC} -g -c -fPIC $(CFLAGS) $(LFLAGS) $< -o $@
#gcc -g -c -fPIC $(CFLAGS) $(LFLAGS) $< -o $@

all: $(LOCAL_MODULE) xdg-adbd
all: $(LOCAL_MODULE)

$(LOCAL_MODULE): $(OBJS)
${CXX} -fPIC $(CXXFLAGS) $^ -L. -L ../libcutils/*.o ../base/*.o ../libcrypto_utils/*.o -lpthread -lresolv -lcrypto -lssl -lutil -o $@
${CXX} -fPIC $(CXXFLAGS) $^ -L. -L ../libcutils/*.o ../base/*.o -lpthread -lresolv -lutil -o $@
#g++ -fPIC $(CXXFLAGS) $^ -L ../libcutils/*.o ../base/*.o ../libcrypto_utils/*.o -lpthread -lresolv -lcrypto -lssl -lutil -o $@

xdg-adbd: xdg-adbd.c
${CC} -o $@ $< $(CFLAGS) $(LFLAGS) `pkg-config --libs --cflags glib-2.0`
#gcc -o $@ $< $(CFLAGS) $(LFLAGS) `pkg-config --libs --cflags glib-2.0`

clean:
rm -f $(LOCAL_MODULE) xdg-adbd *.o daemon/*.o
rm -f $(LOCAL_MODULE) *.o daemon/*.o

73 changes: 73 additions & 0 deletions adb/adb_auth_client_dummy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#define TRACE_TAG AUTH

#include "sysdeps.h"
#include "adb_auth.h"

#include <resolv.h>
#include <stdio.h>
#include <string.h>

#include "cutils/list.h"
#include "cutils/sockets.h"

#include "adb.h"
#include "fdevent.h"
#include "transport.h"

#if 0
static fdevent listener_fde;
static fdevent framework_fde;
static int framework_fd = -1;

static void usb_disconnected(void* unused, atransport* t);
static struct adisconnect usb_disconnect = { usb_disconnected, nullptr};
static atransport* usb_transport;
static bool needs_retry = false;
#endif

int adb_auth_generate_token(void *token, size_t token_size)
{
FILE *f;
int ret;

f = fopen("/dev/urandom", "re");
if (!f)
return 0;

ret = fread(token, token_size, 1, f);

fclose(f);
return ret * token_size;
}

int __attribute__((weak)) adb_auth_verify(uint8_t* token, size_t token_size, uint8_t* sig, int siglen)
{
int ret = 0;
return ret;
}

void __attribute__((weak)) adb_auth_confirm_key(unsigned char *key, size_t len, atransport *t)
{
}

void __attribute__((weak)) adbd_cloexec_auth_socket() {
}

void __attribute__((weak)) adbd_auth_init(void) {
}

0 comments on commit 840cb81

Please sign in to comment.